Subversion Repositories SmartDukaan

Rev

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

Rev 17105 Rev 17106
Line 86... Line 86...
86
            rank = rank +1
86
            rank = rank +1
87
            if rank >100:
87
            if rank >100:
88
                break
88
                break
89
            titleTag = tag.find('p', {'class' : 'product_title'})
89
            titleTag = tag.find('p', {'class' : 'product_title'})
90
            source_product_name = titleTag.text
90
            source_product_name = titleTag.text
-
 
91
            '''
91
            encoding =  chardet.detect(source_product_name)
92
            encoding =  chardet.detect(source_product_name)
92
            try:
93
            try:
93
                source_product_name = source_product_name.decode(encoding.get('encoding'))
94
                source_product_name = source_product_name.decode(encoding.get('encoding'))
94
            except:
95
            except:
95
                source_product_name = source_product_name.decode('latin-1')
96
                source_product_name = source_product_name.decode('latin-1')
-
 
97
            '''
-
 
98
            source_product_name = source_product_name.encode('utf8')
96
            productUrl = titleTag.find('a').get('href')
99
            productUrl = titleTag.find('a').get('href')
97
            productUrl = 'http://www.homeshop18.com'+str(productUrl)
100
            productUrl = 'http://www.homeshop18.com'+str(productUrl)
98
            inStock = 1
101
            inStock = 1
99
            identifier = tag['id'].split('_')[1]
102
            identifier = tag['id'].split('_')[1]
100
            available_price = long(tag.find('p',{'class':'price clearfix'}).find('b').text.split(' ')[1])
103
            available_price = long(tag.find('p',{'class':'price clearfix'}).find('b').text.split(' ')[1])
Line 119... Line 122...
119
            rank = rank +1
122
            rank = rank +1
120
            if rank >100:
123
            if rank >100:
121
                break
124
                break
122
            titleTag = tag.find('p', {'class' : 'product_title'})
125
            titleTag = tag.find('p', {'class' : 'product_title'})
123
            source_product_name = titleTag.text
126
            source_product_name = titleTag.text
-
 
127
            '''
124
            encoding =  chardet.detect(source_product_name)
128
            encoding =  chardet.detect(source_product_name)
125
            try:
129
            try:
126
                source_product_name = source_product_name.decode(encoding.get('encoding'))
130
                source_product_name = source_product_name.decode(encoding.get('encoding'))
127
            except:
131
            except:
128
                source_product_name = source_product_name.decode('latin-1')
132
                source_product_name = source_product_name.decode('latin-1')
-
 
133
            '''
-
 
134
            source_product_name = source_product_name.encode('utf8')
129
            productUrl = titleTag.find('a').get('href')
135
            productUrl = titleTag.find('a').get('href')
130
            productUrl = 'http://www.homeshop18.com'+str(productUrl)
136
            productUrl = 'http://www.homeshop18.com'+str(productUrl)
131
            inStock = 1
137
            inStock = 1
132
            identifier = tag['id'].split('_')[1]
138
            identifier = tag['id'].split('_')[1]
133
            available_price = long(tag.find('p',{'class':'price clearfix'}).find('b').text.split(' ')[1])
139
            available_price = long(tag.find('p',{'class':'price clearfix'}).find('b').text.split(' ')[1])