Facebook
From Przemysław, 11 Months ago, written in Python.
Embed
Download Paste or View Raw
Hits: 98
  1. import requests, bs4
  2. r = requests.get('http://4programmers.net/Forum/All?sort=id&order=desc')
  3.  
  4. r.raise_for_status()
  5.  
  6. rFile = open('requests_write.html', 'wb')
  7. for x in r.iter_content(100000):
  8.     rFile.write(x)
  9. rFile.close()
  10.  
  11. exampleFile = open('requests_write.html')
  12. exampleSoup = bs4.BeautifulSoup(exampleFile.read())
  13. elems = exampleSoup.select("h5")
  14.  
  15. print("Tytuł najnowszego tematu na forum 4programmers.net:",elems[0].getText())