Subversion Repositories SmartDukaan

Rev

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

Rev 20344 Rev 20376
Line 129... Line 129...
129
        live = product['live']
129
        live = product['live']
130
        r_info = __RankInfo(supc, rank, category, productName, p_url, color, ppid, [], live)
130
        r_info = __RankInfo(supc, rank, category, productName, p_url, color, ppid, [], live)
131
        temp = supcMap.get(ppid)
131
        temp = supcMap.get(ppid)
132
        temp.append(r_info)
132
        temp.append(r_info)
133
        supcMap[ppid] = temp  
133
        supcMap[ppid] = temp  
-
 
134
        if product['subAttributes'] is not None:
134
        for subAttribute in product['subAttributes']:
135
            for subAttribute in product['subAttributes']:
135
            sub_supc = subAttribute['supc']
136
                sub_supc = subAttribute['supc']
136
            sub_value = subAttribute['value']
137
                sub_value = subAttribute['value']
137
            sub_name = subAttribute['name']
138
                sub_name = subAttribute['name']
138
            subAttr = __SubAttributes(sub_supc, color, sub_name, sub_value)
139
                subAttr = __SubAttributes(sub_supc, color, sub_name, sub_value)
139
            subAttributes_list = r_info.subAttributes
140
                subAttributes_list = r_info.subAttributes
140
            subAttributes_list.append(subAttr)
141
                subAttributes_list.append(subAttr)
141
    return supcMap
142
    return supcMap
142
            
143
            
143
    
144
    
144
 
145
 
145
def scrapeBestSellerMobiles():
146
def scrapeBestSellerMobiles():
Line 147... Line 148...
147
    bestSellers = []
148
    bestSellers = []
148
    rank = 1
149
    rank = 1
149
    for z in [0,20,40,60,80]:
150
    for z in [0,20,40,60,80]:
150
        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)
151
        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)
151
        soup = getSoupObject(url)
152
        soup = getSoupObject(url)
152
        for product in soup.findAll('div',{'class':'product-desc-rating title-section-expand'}):
153
        for product in soup.findAll('a',{'class':'dp-widget-link'}):
-
 
154
            print product['href']
153
            try:
155
            try:
154
                supcMap = fetchSupcDetails(product.find('a')['href'],rank, 3)
156
                supcMap = fetchSupcDetails(product['href'],rank, 3)
155
            except:
157
            except:
156
                continue
158
                continue
-
 
159
            print "supcMap ",supcMap
157
            bestSellers.append(supcMap)
160
            bestSellers.append(supcMap)
158
            rank = rank + 1
161
            rank = rank + 1
159
 
162
 
160
def scrapeBestSellerTablets():
163
def scrapeBestSellerTablets():
161
    global bestSellers
164
    global bestSellers
162
    bestSellers = []
165
    bestSellers = []
163
    rank = 1
166
    rank = 1
164
    for z in [0,20,40,60,80]:
167
    for z in [0,20,40,60,80]:
165
        url = "http://www.snapdeal.com/acors/json/product/get/search/133/%d/20?sort=bstslr&keyword=&clickSrc=&viewType=List&lang=en&snr=false" %(z)
168
        url = "http://www.snapdeal.com/acors/json/product/get/search/133/%d/20?sort=bstslr&keyword=&clickSrc=&viewType=List&lang=en&snr=false" %(z)
166
        soup = getSoupObject(url)
169
        soup = getSoupObject(url)
167
        for product in soup.findAll('div',{'class':'product-desc-rating title-section-expand'}):
170
        for product in soup.findAll('a',{'class':'dp-widget-link'}):
-
 
171
            print product['href']
-
 
172
            try:
168
            supcMap = fetchSupcDetails(product.find('a')['href'],rank, 5)
173
                supcMap = fetchSupcDetails(product['href'],rank, 5)
-
 
174
            except:
-
 
175
                continue
-
 
176
            print "supcMap ",supcMap
169
            bestSellers.append(supcMap)
177
            bestSellers.append(supcMap)
170
            rank = rank + 1
178
            rank = rank + 1
171
 
179
 
172
 
180
 
173
def resetRanks(category):
181
def resetRanks(category):