Python 06d scrap

 0    6 flashcards    swiatangielskiego
download mp3 print play test yourself
 
Question Answer
instalacja webscraping
start learning
pip install beautifulsoup4
import webscraping oraz urllib oraz lxml
start learning
import bs4 as bs import urllib. request import lxml
pobranie html z url
start learning
url_content = urllib. request. urlopen('url'). read()
ekstrakcja linków do stron filmów
start learning
find_url = bs. BeautifulSoup(url_content, 'lxml')
wyodrębnić wszystkie wystąpienia określonego tagu
start learning
find_url_tds = find_url. findAll('td', {'class': 'titleColumn'})
jeśli wielokrotnie wyodrębniasz linki, możesz użyć poniższej funkcji:
start learning
base_url + find_url_td. find('a'). attrs['href']

You must sign in to write a comment