Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bs4 import BeautifulSoup
- import requests
- search = input("Enter search term: ")
- params = {"q": search}
- r = requests.get("http://www.bing.com/search")
- soup = BeautifulSoup(r.text, "html.parser")
- results = soup.find("ol", {"id": "b_results"})
- links = results.findAll("li", {"class": "b_algo"})
- for item in links:
- item_text = item.find("a").text
- item_href = item.find("a").attrs["href"]
- if item_text and item_href:
- print(item_text)
- print(item_href)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement