1 Star 0 Fork 182

GSAM / Python爬虫

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
爬取猫眼电影数据.py 940 Bytes
一键复制 编辑 原始数据 按行查看 历史
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)
Python
1
https://gitee.com/dushuren/python_reptilian.git
git@gitee.com:dushuren/python_reptilian.git
dushuren
python_reptilian
Python爬虫
master

搜索帮助