Skip to content

Commit cdd8bc6

Browse files
authored
update sudo.py
fixed some error at line 102,104,106,117,43,99,77
1 parent e0ebad3 commit cdd8bc6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

ecommerce-scraper/sudo.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def get_src(site,args):
1515
#webbrowser.open(site+args)
1616
req = requests.get(site+args)
1717
if not req:
18-
print 'Connection Failed for '+site
18+
print ('Connection Failed for '+site)
1919
return None
2020
soup = bs4.BeautifulSoup(req.text,"html.parser")
2121
return soup
@@ -40,7 +40,7 @@ def show_amz(args):
4040
ctr = 0
4141
for pr in soup.select('a.a-link-normal.a-text-normal > span.a-size-base.a-color-price.s-price.a-text-bold'):
4242
x = re.findall(r'([\d\,\.]+)',str(pr.get_text))
43-
print 'Amazon ->',title[ctr]+': ',x[3]
43+
print ('Amazon ->',title[ctr]+': ',x[3])
4444
ctr += 1
4545
if ctr==5:
4646
break
@@ -74,7 +74,7 @@ def show_flip(args):
7474

7575
flip_result=dict(zip(price,product,))
7676
for price,prd in flip_result.items():
77-
print 'FlipKart'+'-> '+prd+':'+price
77+
print ('FlipKart'+'-> '+prd+':'+price)
7878

7979
def show_snap(args):
8080
res = 5
@@ -96,30 +96,30 @@ def show_snap(args):
9696

9797
snap_result = dict(zip(price,product))
9898
for price,prd in snap_result.items():
99-
print 'SnapDeal'+'-> '+prd+':'+price
99+
print ('SnapDeal'+'-> '+prd+':'+price)
100100

101101
def main(args):
102-
print 'Pulling Request from Web.......\n'
102+
print ('Pulling Request from Web.......\n')
103103
show_flip(args)
104-
print ' ----------------------------------------------------------------------------------------------------------------------------'
104+
print (' ----------------------------------------------------------------------------------------------------------------------------')
105105
show_snap(args)
106106

107-
print ' ----------------------------------------------------------------------------------------------------------------------------'
107+
print (' ----------------------------------------------------------------------------------------------------------------------------')
108108
show_amz(args)
109109

110-
print ' ----------------------------------------------------------------------------------------------------------------------------'
110+
print (' ----------------------------------------------------------------------------------------------------------------------------')
111111
if __name__ == '__main__':
112112
args = sys.argv[1:]
113113
if not args:
114-
print "Usage:- [search query] => will give results of search query from amazon,flipkart,snapdeal, no args it will give result from main page of these shopping site"
114+
print ("Usage:- [search query] => will give results of search query from amazon,flipkart,snapdeal, no args it will give result from main page of these shopping site")
115115
args = ' '.join(args)
116116
main(args)
117-
query=raw_input('>> q(quit), open web page with : az(amazon),fk(flipkart),sd(snapdeal) :')
117+
query=input('>> q(quit), open web page with : az(amazon),fk(flipkart),sd(snapdeal) :')
118118
if query == 'az':
119119
openweb(amazon+args)
120120
elif query == 'fk':
121121
openweb(flipkart+args)
122122
elif query == 'sd':
123123
openweb(snapdeal+args)
124124
else:
125-
sys.exit(1)
125+
sys.exit(1)

0 commit comments

Comments
 (0)