Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bs4
- from urllib import urlopen as uReq
- from bs4 import BeautifulSoup as soup
- myurl="https://search.yahoo.com/yhs/search?hspart=ddc&hsimp=yhs-linuxmint&type=__alt__ddc_linuxmint_com&p="
- a="jesus"
- b=raw_input('enter the keyword \n\n')
- myurl=myurl+b
- uClient=uReq(myurl)
- pagehtml=uClient.read()
- uClient.close()
- pagesoup=soup(pagehtml,"html.parser")
- containers=pagesoup.findAll("h3",{"class":"title"})
- for container in containers :
- if len(container.a['href']) < 80 :
- print(container.a['href'])
- print("\n")
- #print(pagesoup)
- #filename="products2.csv"
- '''f=open(filename,"w")
- headers="brand"
- f.write(headers)
- for container in containers :
- brand = container.a.img["title"]
- #print("\n"+brand)
- f.write("\n" + brand)
- f.close()'''
Add Comment
Please, Sign In to add comment