Python: Read URL

From OnnoWiki
Revision as of 08:34, 29 April 2019 by Onnowpurbo (talk | contribs)
Jump to navigation Jump to search
pip install requests
pip install BeautifulSoup4

Script

import requests
from BeautifulSoup import BeautifulSoup

link = "http://www.somesite.com/details.pl?urn=2344"
f = requests.get(link)
print(f.text)
soup = BeautifulSoup(f)
all_text = .join(soup.findAll(text=True))
print(all_text)


Pranala Menarik