Subversion Repositories SmartDukaan

Rev

Rev 17390 | Rev 20172 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17390 Rev 18202
Line 146... Line 146...
146
    bestSellers = []
146
    bestSellers = []
147
    rank = 1
147
    rank = 1
148
    for z in [0,20,40,60,80]:
148
    for z in [0,20,40,60,80]:
149
        url = "http://www.snapdeal.com/acors/json/product/get/search/175/%d/20?q=&sort=bstslr&keyword=&clickSrc=&viewType=List&lang=en&snr=false" %(z)
149
        url = "http://www.snapdeal.com/acors/json/product/get/search/175/%d/20?q=&sort=bstslr&keyword=&clickSrc=&viewType=List&lang=en&snr=false" %(z)
150
        soup = getSoupObject(url)
150
        soup = getSoupObject(url)
151
        for product in soup.findAll('div',{'class':'outerImg'}):
151
        for product in soup.findAll('div',{'class':'product-desc-rating title-section-expand'}):
152
            print product.find('a')['pogid']
-
 
153
            print product.find('a')['href']
-
 
154
            try:
152
            try:
155
                supcMap = fetchSupcDetails(product.find('a')['href'],rank, 3)
153
                supcMap = fetchSupcDetails(product.find('a')['href'],rank, 3)
156
            except:
154
            except:
157
                continue
155
                continue
158
            bestSellers.append(supcMap)
156
            bestSellers.append(supcMap)
Line 163... Line 161...
163
    bestSellers = []
161
    bestSellers = []
164
    rank = 1
162
    rank = 1
165
    for z in [0,20,40,60,80]:
163
    for z in [0,20,40,60,80]:
166
        url = "http://www.snapdeal.com/acors/json/product/get/search/133/%d/20?sort=bstslr&keyword=&clickSrc=&viewType=List&lang=en&snr=false" %(z)
164
        url = "http://www.snapdeal.com/acors/json/product/get/search/133/%d/20?sort=bstslr&keyword=&clickSrc=&viewType=List&lang=en&snr=false" %(z)
167
        soup = getSoupObject(url)
165
        soup = getSoupObject(url)
168
        for product in soup.findAll('div',{'class':'outerImg'}):
166
        for product in soup.findAll('div',{'class':'product-desc-rating title-section-expand'}):
169
            print product.find('a')['pogid']
-
 
170
            print product.find('a')['href']
-
 
171
            try:
-
 
172
                supcMap = fetchSupcDetails(product.find('a')['href'],rank, 5)
167
            supcMap = fetchSupcDetails(product.find('a')['href'],rank, 5)
173
            except:
-
 
174
                continue
-
 
175
            bestSellers.append(supcMap)
168
            bestSellers.append(supcMap)
176
            rank = rank + 1
169
            rank = rank + 1
177
 
170
 
178
 
171
 
179
def resetRanks(category):
172
def resetRanks(category):
Line 261... Line 254...
261
        commitBestSellers(3)
254
        commitBestSellers(3)
262
    scrapeBestSellerTablets()
255
    scrapeBestSellerTablets()
263
    if len(bestSellers) > 0:
256
    if len(bestSellers) > 0:
264
        resetRanks(5)
257
        resetRanks(5)
265
        commitBestSellers(5)
258
        commitBestSellers(5)
266
        
259
    print bestSellers
267
    sendEmail()
260
    sendEmail()
268
 
261
 
269
if __name__=='__main__':
262
if __name__=='__main__':
270
    main()
263
    main()
271
264