1 Star 1 Fork 186

JonK/Python爬虫

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
爬取猫眼电影数据.py 940 Bytes
Copy Edit Raw Blame History
import requests
from pyquery import PyQuery as pq
url='https://box.maoyan.com/promovie/api/box/second.json'
headers={
'user-agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0'
}
response=requests.get(url,headers=headers)
if response.status_code==200:
test=response.json()
else:
print('不是200')
if test:
items=test.get('data').get('list')
#print(items)
for item in items:
#print(items)
shuju={}
shuju['片名']=item.get('movieName')
shuju['上映天数']=item.get('releaseInfo')
shuju['综合票房']=item.get('boxInfo')
shuju['收入票房']=item.get('sumBoxInfo')
shuju['票房占比']=item.get('showRate')
shuju['上座率']=item.get('avgSeatView')
shuju['场均人次']=item.get('avgShowView')
print(shuju)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/JonDO/python_reptilian.git
git@gitee.com:JonDO/python_reptilian.git
JonDO
python_reptilian
Python爬虫
master

Search