Skip to content

Instantly share code, notes, and snippets.

@dionnys5
Created September 27, 2016 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dionnys5/8fe1f77cc4598ed939502d9a2c3ad3ac to your computer and use it in GitHub Desktop.
Save dionnys5/8fe1f77cc4598ed939502d9a2c3ad3ac to your computer and use it in GitHub Desktop.
Salva em txt os ultimos tweets do UOL
import urllib
import urllib.request
from bs4 import BeautifulSoup
url = "https://twitter.com/UOL"
WebPage = urllib.request.urlopen(url)
soup = BeautifulSoup(WebPage,"html.parser")
print("Tweet Scraping...")
with open("UolTweets.txt","w") as f:
for tweets in soup.findAll('div',{"class":"content"}):
t = tweets.find('p').text
f.write(t+"\n")
print("Done!")
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment