Subversion Repositories SmartDukaan

Rev

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

Rev 12256 Rev 12275
Line 69... Line 69...
69
            sellerColumn =  data.find('p', attrs={'class' : re.compile('.*olpSellerName*')})
69
            sellerColumn =  data.find('p', attrs={'class' : re.compile('.*olpSellerName*')})
70
            store=""
70
            store=""
71
            if self.findStore:
71
            if self.findStore:
72
                print "Seller info ",sellerColumn
72
                print "Seller info ",sellerColumn
73
                x = sellerColumn.find('a')['href']
73
                x = sellerColumn.find('a')['href']
74
                print "&&&&"
74
                print x
-
 
75
                temp =  sellerColumn.find('a')
75
                storeUrl = x
76
                store = temp.text
76
                store = self.findStoreFront(storeUrl)
77
                if len(store)==0:
77
                try:
78
                    storeUrl = x
78
                    ind = store.index("@ Amazon.in")
79
                    dom_in = storeUrl.find("www.amazon.in")
-
 
80
                    if dom_in ==-1:
79
                    store = store[0:ind].strip()
81
                        storeUrl="http://amazon.in"+storeUrl
80
                except:
82
                    store = self.findStoreFront(storeUrl)
81
                    try:
83
                    try:
82
                        ind = store.split(":")
84
                        ind = store.index("@ Amazon.in")
83
                        store = ind[1].strip()
85
                        store = store[0:ind].strip()
84
                    except:
86
                    except:
-
 
87
                        try:
-
 
88
                            ind = store.split(":")
-
 
89
                            store = ind[1].strip()
-
 
90
                        except:
85
                        store =""
91
                            store =""
86
            ratingColumn = data.find('p', attrs={'class' : 'a-spacing-small'}).find('a').contents[0]
92
            ratingColumn = data.find('p', attrs={'class' : 'a-spacing-small'}).find('a').contents[0]
87
            print "Rating info ",ratingColumn
93
            print "Rating info ",ratingColumn
88
            print "***********************"
94
            print "***********************"
89
            return unitCost+shippingCost,store
95
            return unitCost+shippingCost,store
90
    
96
    
Line 108... Line 114...
108
        return soup.title.string
114
        return soup.title.string
109
            
115
            
110
 
116
 
111
if __name__ == '__main__':
117
if __name__ == '__main__':
112
    scraper = AmazonScraper()
118
    scraper = AmazonScraper()
113
    scraper.read('http://www.amazon.in/gp/offer-listing/B001D0ROGO/ref=olp_sort_ps',True)
119
    scraper.read('http://www.amazon.in/gp/offer-listing/B006PB44NM/ref=olp_sort_ps',True)
114
    print scraper.createData()
120
    print scraper.createData()
115
    
121
    
116
122