joelnazarene

IEEEEEEE

Mar 27th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. import time
  2. import bs4
  3. import re
  4. from selenium import webdriver
  5. from bs4 import BeautifulSoup as soup
  6. driver = webdriver.Firefox()
  7. url="https://ieeexplore.ieee.org/search/searchresult.jsp?newsearch=true&queryText="
  8. b="web%20scrape"
  9. b1=input("enter text \n")
  10. b2=b1.replace(" ","%20")
  11. #print(b2)
  12. print("\n\n")
  13. url=url+b2
  14. driver.get(url)
  15. time.sleep(5)
  16. refs=driver.page_source
  17. pagesoup=soup(refs,"html.parser")
  18. #containers=pagesoup.findAll("div",{"class":'main-section'})
  19. containers=pagesoup.findAll("a",{"href":re.compile('/document/.*')})
  20. #print(containers[0].a['href'])
  21.  
  22. i=0
  23. for container in containers :
  24.    
  25.     if(len(container.text)>20):
  26.         i=i+1
  27.         print("\n")
  28.         print(i)
  29.         print(container.text)
  30.         print("\n")
  31.  
  32. driver.close()
Add Comment
Please, Sign In to add comment