[Python] 纯文本查看 复制代码 import requests
from bs4 import BeautifulSoup
url='https://s.paopaoche.net/'
headers={
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36',
}
plantform = ('android','apple','pc','zj','xcx','vr')
gname=input("请输入游戏名称:")
plantform_numb = input('输入下载平台(安卓请输入0,苹果请输入1,PC请输入2,主机请输入3,小程序请输入4,VR请输入5):') or '0'
cid = plantform[int(plantform_numb)]
params ={
'cid':cid,
'k':gname
}
r_page = requests.get(url,params = params, headers = headers)
soup = BeautifulSoup(r_page.text, 'lxml')
result = soup.find('dl',attrs={'id':"result"})
for child in result.children:
if not child.string:
temp_name_version = child.div.a.text
temp_name,temp_version = temp_name_version.split('下载')
name = temp_name.strip()
version = temp_version.strip()
url = child.div.a['href']
print(name,version,url) |