Advertisement
Guest User

Untitled

a guest
Jul 9th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. import BeautifulSoup
  2. import requests
  3.  
  4. file_from = open("links.txt", "r")
  5. list_of_urls = file_from.read().splitlines()
  6.  
  7. aid_words = ["financial", "aid", "merit", "scholarship"]
  8.  
  9. count = 0
  10.  
  11. fin_aid = []
  12.  
  13. while count <= 10:
  14. for url in list_of_urls:
  15. clean = 1
  16. result = "nothing found"
  17. source = requests.get(url)
  18. plain_text = source.text
  19. soup = BeautifulSoup.BeautifulSoup(plain_text)
  20. print (str(url).upper())
  21. for links in soup.findAll('p', text = True):
  22. for word in aid_words:
  23. if word not in links:
  24. print ("not it " + str(clean))
  25. clean += 1
  26. pass
  27. else:
  28. result = str(word)
  29. print (result)
  30. fin_aid.append(url)
  31. break
  32. count += 1
  33. the_golden_book = {"link: ": str(url), "word found: ": str(result)}
  34. fin_aid.append(the_golden_book)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement