Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import bs4
- import re
- from selenium import webdriver
- from bs4 import BeautifulSoup as soup
- driver = webdriver.Firefox()
- url="https://ieeexplore.ieee.org/search/searchresult.jsp?newsearch=true&queryText="
- b="web%20scrape"
- b1=input("enter text \n")
- b2=b1.replace(" ","%20")
- #print(b2)
- print("\n\n")
- url=url+b2
- driver.get(url)
- time.sleep(5)
- refs=driver.page_source
- pagesoup=soup(refs,"html.parser")
- #containers=pagesoup.findAll("div",{"class":'main-section'})
- containers=pagesoup.findAll("a",{"href":re.compile('/document/.*')})
- #print(containers[0].a['href'])
- i=0
- for container in containers :
- if(len(container.text)>20):
- i=i+1
- print("\n")
- print(i)
- print(container.text)
- print("\n")
- driver.close()
Add Comment
Please, Sign In to add comment