Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from bs4 import BeautifulSoup
- import re
- from selenium import webdriver
- query = input("What would you like to search: ")
- query = query.replace(" ","+")
- base = "http://www.google.de"
- query = "https://www.google.com/search?q=" + query
- driver = webdriver.Firefox(executable_path=r'C:UsersSwapnaliAppDataLocalgeckodriver.exe')
- driver.get(query)
- elem1 = driver.find_element_by_link_text("More places")
- elem1.click()
- Current_Url = driver.current_url
- print('Current_Url')
- print(Current_Url)
- r = requests.get(Current_Url)
- html_doc = r.text
- soup = BeautifulSoup(html_doc, 'html.parser')
- for s in soup.find('body'):
- allDetail = s.text
- print('allDetail')
- print(allDetail)
- for next_page in soup.select(".fl"):
- res = requests.get(query + next_page.get('href'))
- soup = BeautifulSoup(res.text,"html.parser")
- for i in re.findall(r'[+(]?[1-9][0-9 .-()]{8,}[0-9]', s.text):
- print(i)
Add Comment
Please, Sign In to add comment