joelnazarene

BASE

Mar 31st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.12 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://www.base-search.net/Search/Results?lookfor='
  8.  
  9. b1=input("enter text \n")
  10. b2=b1.replace(" ","+")
  11. b3='&name=&oaboost=1&newsearch=1&refid=dcbasen'
  12. #print(b2)
  13. print("\n\n")
  14. url=url+b2+b3
  15. driver.get(url)
  16. time.sleep(2)
  17. refs=driver.page_source
  18. pagesoup=soup(refs,"html.parser")
  19. #containers=pagesoup.findAll("div",{"class":'main-section'})
  20. containers=pagesoup.findAll("div",{"class":"col-sm-8 col-lg-9"})
  21. #print(containers[0].a['href'])
  22. #print("reached contA")
  23. i=0
  24. #u="https://www.scienceopen.com"
  25. for container in containers :
  26.  # print("for loop")
  27.   try :
  28.    if(len(container.text)>200):
  29.    #     i=i+1
  30.        
  31.        # print(i)
  32.         #if(i%2!=0):
  33.        
  34.         #   driver.get(u + container['href'])
  35.          #  refs=driver.page_source
  36.         #   s=soup(refs,"html.parser")
  37.           # c=s.find("div",{"itemprop":"description"})
  38.         print(container.div.span.next_sibling.text)
  39.         print("\n")
  40.   except :
  41.         continue
  42. driver.close()
Add Comment
Please, Sign In to add comment