説明
A.プロジェクト
情報と情報の分析のためのサッカークイズのページをクロール
II。コードの一部を示しています
import requests
from lxml.html import etree
headers = {'Referer': 'http://www.okooo.com/jingcai/',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'}
url = 'XXXXXXXXXXX'
response = requests.get(url, headers=headers)
response.encoding = response.apparent_encoding
response_html = etree.HTML(response.text)
id_xpath = '//*[@class="touzhu_1"]/@data-mid'
hname_xpath = '//*[@class="touzhu_1"]/@data-hname'
aname_xpath = '//*[@class="touzhu_1"]/@data-aname'
id_list = response_html.xpath(id_xpath)
hname_list = response_html.xpath(hname_xpath)
aname_list = response_html.xpath(aname_xpath)
III。完全なコード圧縮フォルダの場合
プロジェクトリンクします。https://github.com/a568972484/Crawl_for_football_infor
コア動的なコードとしても、フォルダを圧縮さ
ニーズは、作者に連絡してください
著者:a568972484
小さな魚の塩漬けのywy:ブログで
ブログのリンクhttps://www.cnblogs.com/pythonywy