Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import BeautifulSoup
- import requests
- file_from = open("links.txt", "r")
- list_of_urls = file_from.read().splitlines()
- aid_words = ["financial", "aid", "merit", "scholarship"]
- count = 0
- fin_aid = []
- while count <= 10:
- for url in list_of_urls:
- clean = 1
- result = "nothing found"
- source = requests.get(url)
- plain_text = source.text
- soup = BeautifulSoup.BeautifulSoup(plain_text)
- print (str(url).upper())
- for links in soup.findAll('p', text = True):
- for word in aid_words:
- if word not in links:
- print ("not it " + str(clean))
- clean += 1
- pass
- else:
- result = str(word)
- print (result)
- fin_aid.append(url)
- break
- count += 1
- the_golden_book = {"link: ": str(url), "word found: ": str(result)}
- fin_aid.append(the_golden_book)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement