Python developer needed (super simple task)

Status
Not open for further replies.

kvvni

Senior Member
Joined
Feb 1, 2019
Messages
848
Reaction score
791
I need a simple script that will go to specific url's, find specific word and save the sentence to .txt.
Instant payment with your preferred method! can be done in selenium if you prefer, no problem with that
 
I need a simple script that will go to specific url's, find specific word and save the sentence to .txt.
Instant payment with your preferred method! can be done in selenium if you prefer, no problem with that

You can try something like this.

Python:
import requests
from bs4 import BeautifulSoup
urls = ['URL1',
        'URL2',
        'URL3']
words_to_find = ['WORD1', 'WORD2', 'WORD3']
with open('results.txt', 'w') as f:
for url in urls:
r = requests.get(url)
html_content = r.text
soup = BeautifulSoup(html_content, 'html.parser')
paragraphs = soup.find_all('p')
for p in paragraphs:
for word in words_to_find:
if word in p.text:
f.write(p.text)
break

Good luck :)
 
I need a simple script that will go to specific url's, find specific word and save the sentence to .txt.
Instant payment with your preferred method! can be done in selenium if you prefer, no problem with that
I can get your simple code done. Please reach me out at my telegram: @happyguy36
 
Status
Not open for further replies.
This thread has been auto closed due to the forum's thread age policy. Read more.
Back
Top