爬猫眼电影数据

news/2024/9/9 14:13:25

猫眼的一些数据api

影片:
即将上映:http://api.maoyan.com/mmdb/movie/v2/list/rt/order/coming.json?ci=1&limit=12&token=
热      映:http://api.maoyan.com/mmdb/movie/v5/list/hot.json?ci=1&limit=12&token=
影片基本信息:http://api.maoyan.com/mmdb/movie/v5/1235560.json
影片视频:http://api.maoyan.com/mmdb/v1/movie/257594/videos.json?offset=0&limit=100
影片图片:https://api.maoyan.com/mmdb/movie/photos/257594/list.json
影片演员:http://api.maoyan.com/mmdb/movie/1262593/role/celebrities.json
影片公司:https://api.maoyan.com/mmdb/movie/1250661/feature/relatedCompanies.json
彩蛋信息:https://api.maoyan.com/mmdb/movie/tips/1218727/list.json
影片相关介绍:https://api.maoyan.com/mmdb/movie/246061/feature/v2/list.json 
幕后花絮:https://api.maoyan.com/mmdb/movie/246061/feature/highlights.json 
家长引导:https://api.maoyan.com/mmdb/movie/246061/feature/parentguidances.json
电影原声:https://api.maoyan.com/mmdb/movie/246061/feature/filmMusics.json  
电影技术参数:https://api.maoyan.com/mmdb/movie/246061/feature/technicals.json 幕后花絮(H5接口)http://m.maoyan.com/movie/246061/extras/highlights?_v_=yes 
家长引导(H5接口)http://m.maoyan.com/movie/246061/extras/parentguidances?_v_=yes  技术参数,出品公司(专业版接口)https://piaofang.maoyan.com/movie/246061/moresections 
电影相关影片:https://api.maoyan.com/mmdb/movie/887623/feature/relatedFilm.json
影人:
影人基本信息:https://api.maoyan.com/mmdb/v6/celebrity/3147.json
影人图片:https://api.maoyan.com/mmdb/v7/celebrity/28625/photos.json
影人搜索列表:https://api.maoyan.com/mmdb/search/integrated/keyword/list.json
影人演艺:https://api.maoyan.com/mmdb/v2/celebrity/28625/feature/yearbook.json
影人生活:https://api.maoyan.com/mmdb/v2/celebrity/28625/feature/life.json
影人社会影响:https://api.maoyan.com/mmdb/v2/celebrity/28625/feature/effect.json
影人趣闻花絮:https://api.maoyan.com/mmdb/v2/celebrity/28625/feature/trivia.json
影人语录:https://api.maoyan.com/mmdb/v2/celebrity/28625/feature/quotes.json
影人人物评价:https://api.maoyan.com/mmdb/v2/celebrity/28625/feature/evaluation.json
影人图片(H5接口)https://m.maoyan.com/celebrity/29264/photos?_v_=yes
演艺经历(专业版接口)https://piaofang.maoyan.com/celebrity/showCareer?id=28490
影人基本信息和图片(网页)https://maoyan.com/films/celebrity/18079
公司:
电影公司详情:https://api.maoyan.com/mmdb/movie/feature/company/283.json

都是json的请求,直接用requests.get就行
直接上代码

import requests
import csv
import json
import requests
import pandas as pddef get_json(date):# date = '20131212'url = 'http://piaofang.maoyan.com/second-box?beginDate={}'.format(date)headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36','Accept': 'application/json, text/javascript, */*; q=0.01'}response = requests.get(url,headers=headers, timeout=5).json()return responseif __name__ == '__main__':url = 'http://api.maoyan.com/mmdb/movie/v5/1235560.json'print(get_json(date='20110101'))import pandas as pdfrom datetime import datetime# date_str = datetime.strftime(date[0], '%y%m%d')date = pd.date_range('2011/1/1', '2019/12/13', freq='D')date_str = ['20' + datetime.strftime(d, '%y%m%d') for d in date]import randomimport timepath = './data/'for date in date_str[:-1000]:delta = random.randint(1, 10)time.sleep(delta)print('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$')print('sleeping {} secondes'.format(delta))print(date)data = get_json(date)with open(path + date + '.txt', 'w') as f:f.write(str(data))

import random
import timeimport requests
import pandas
import json
import os
from coming_soon import Spiderclass MovieInfoSpider:def get_json(self,movieID):# date = '20131212'url = 'http://api.maoyan.com/mmdb/movie/v5/{}.json'.format(movieID)headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36','Accept': 'application/json, text/javascript, */*; q=0.01'}response = requests.get(url,headers=headers, timeout=5).json()return responsedef get_movieID(self,path):movieID_list = []for file in os.listdir(path):try:with open(path + file, 'r') as f:content = eval(f.read())movie_list = content['data']['list']for movie in movie_list:movieID_list.append(movie['movieId'])except Exception as e:print(e)return movieID_listif __name__ == '__main__':spider = MovieInfoSpider()movieids = spider.get_movieID(path='/home/andrew/Desktop/movie_all/')# print(movieids)for id in movieids:content = spider.get_json(movieID=id)Spider.json_to_txt('../movie_info/' + str(id) + '.txt', content)print(id)delta = random.randint(1,20)time.sleep(delta)print('sleeping {} seconds'.format(delta))
import requests
import pandas as pdclass Spider:def get_json(self,url):headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36','Accept': 'application/json, text/javascript, */*; q=0.01'}response = requests.get(url,headers=headers, timeout=5).json()return response@staticmethoddef json_to_txt(file_name, json_name):with open(file_name, 'w') as f:f.write(str(json_name))if __name__ == '__main__':spdier = Spider()content  = spdier.get_json(url = 'http://api.maoyan.com/mmdb/movie/v2/list/rt/order/coming.json?ci=1&limit=12&token='
)from datetime import datetimespdier.json_to_txt('../coming_movie/' + str(datetime.today()) + '.txt',content)

http://lihuaxi.xjx100.cn/news/268092.html

相关文章

Mail Archiving Expert电子邮件归档专家

概况作为企业往来最通用的交流工具,企业中有95%以上的文件都是通过邮件来传递与沟通,但是一旦当邮件服务罢工,影响的不仅仅是企业信息交流无法正确与及时的传达,更可能影响企业与客户之间的交易,其后果更是不堪设想&am…

Python再夺冠,上古语言COBOL大流行,IEEE Spectrum 2020年度编程语言排行榜出炉!...

整理 | 屠敏题图 | 东方 IC出品 | CSDN 博客领域驱动技术,技术鞭策领域。近日,IEEE Spectrum 最新发布了 2020 年年度编程语言排行榜。IEEE Spectrum 编程语言排行榜一年发布一次,截止到今年,该排行榜已经连续发布了七年。与其他榜…

C语言,分解质因数一个解法!_只愿与一人十指紧扣_新浪博客

题目内容: 每个非素数(合数)都可以写成几个素数(也可称为质数)相乘的形式,这几个素数就都叫做这个合数的质因数。比如,6可以被分解为2x3,而24可以被分解为2x2x2x3。 现在&#xff0c…

join......on 后面的and 和where的区别

a.where 是在两个表join完成后,再附上where条件。   b. and 则是在表连接前过滤A表或B表里面哪些记录符合连接条件,同时会兼顾是left join还是right join。即   假如是左连接的话,如果左边表的某条记录不符合连接条件,那么它不…

有人从英伟达借了台DGX A100,让神经网络自己造了个GTA5自己玩

视学算法报道机器之心编辑部人类玩家游戏还没玩通,AI 已经能造个游戏了。侠盗猎车手 5(GTA5)是一款经典的动作冒险游戏,深受玩家欢迎,多个研究团队曾为它推出补丁,以使其具有更加逼真的游戏质感。在第三方不…

Linux之链接命令

Linux之链接命令 1. 链接命令的介绍 链接命令是创建链接文件,链接文件分为: 软链接硬链接 命令说明ln -s创建软链接ln创建硬链接 2. 软链接 类似于Windows下的快捷方式,当一个源文件的目录层级比较深,我们想要方便使用它可以给源文件创建一…

函数调用过程,栈帧的一点理解

栈帧图例一张 寄存器理解 程序寄存器组是唯一能被所有函数共享的资源。虽然某一时刻只有一个函数在执行,但需保证当某个函数调用其他函数时,被调函数不会修改或覆盖主调函数稍后会使用到的寄存器值。因此,IA32采用一套统一的寄存器使用约定&a…

H.264中CBR VBR FIXQP

CBR(Constant Bit Rate)固定比特率(固定码率,差不多一样)。即在码率统计时间内保证编码码率平稳。码率稳定主要由两个量来评估,这两个量都可以由用户在创建编码通道时指定。 ( 这个会牺牲图像的清晰度,当图…