Python爬取中国票房网所有电影片名和演员名字,爬取齐鲁网大陆所有电视剧名称
爬取CBO中国票房网所有电影片名和演员名字
# -*- coding: utf-8 -*-
# 爬取CBO中国票房网所有电影片名
import json
import requests
import time with open("moviename.txt", 'a') as fh:
for pn in range(1,320):
url = 'http://www.cbooo.cn/Mdata/getMdata_movie?area=50&type=0&year=0&initial=%E5%85%A8%E9%83%A8&pIndex=' + str(pn)
print(url)
time.sleep(2)
try:
result = requests.get(url).text
jresult = json.loads(result)
movices = jresult.get('pData')
for movie in movices:
moviename = movie.get('MovieName')
print(moviename)
fh.write(moviename + "\n")
except:
print('第'+ str(pn) + '失败!') # 爬取CBO中国票房网所有演员
import json
import requests
import time with open("moviestar.txt", 'a') as fh:
for pn in range(1,2665):
url = 'http://www.cbooo.cn/Mdata/getMdate_pList?area=50&type=0&year=0&initial=%E5%85%A8%E9%83%A8&pIndex=' + str(pn)
print(url)
time.sleep(2)
try:
result = requests.get(url).text
jresult = json.loads(result)
movices = jresult.get('pData')
for movie in movices:
moviename = movie.get('cnName')
print(moviename)
fh.write(moviename + "\n")
except:
print('第'+ str(pn) + '失败!')
爬取电视剧名称
# -*- coding: utf-8 -*-
# 爬取所有电视剧名称
# 来源:齐鲁电影网 from bs4 import BeautifulSoup
import urllib
url = "http://www.qilumovie.com/filmclass-txt/9.html"
html = urllib.request.urlopen(url).read()
htmldecode = html.decode("gbk") #重点关注
soup = BeautifulSoup(htmldecode,"lxml")
body = soup.body
maplist = body.find_all("li") with open("tvplay.txt",'a') as fh:
for tvl in maplist:
tv = tvl.a.text
print(tv)
fh.write(tv + '\n')
如有错误,还请大侠指教一二!
Python爬取中国票房网所有电影片名和演员名字,爬取齐鲁网大陆所有电视剧名称的更多相关文章
- python实战项目 — 爬取中国票房网年度电影信息并保存在csv
import pandas as pd import requests from bs4 import BeautifulSoup import time def spider(url, header ...
- 票房和口碑称霸国庆档,用 Python 爬取猫眼评论区看看电影《我和我的家乡》到底有多牛
今年的国庆档电影市场的表现还是比较强势的,两名主力<我和我的家乡>和<姜子牙>起到了很好的带头作用. <姜子牙>首日破 2 亿,一举刷新由<哪吒之魔童降世&g ...
- Python爬取中国天气网
Python爬取中国天气网 基于requests库制作的爬虫. 使用方法:打开终端输入 “python3 weather.py 北京(或你所在的城市)" 程序正常运行需要在同文件夹下加入一个 ...
- 初识python 之 爬虫:爬取中国天气网数据
用到模块: 获取网页并解析:import requests,html5lib from bs4 import BeautifulSoup 使用pyecharts的Bar可视化工具"绘制图表& ...
- Python爬虫爬取BT之家找电影资源
一.写在前面 最近看新闻说圣城家园(SCG)倒了,之前BT天堂倒了,暴风影音也不行了,可以说看个电影越来越费力,国内大厂如企鹅和爱奇艺最近也出现一些幺蛾子,虽然目前版权意识虽然越来越强,但是很多资源在 ...
- python爬取中国知网部分论文信息
爬取指定主题的论文,并以相关度排序. #!/usr/bin/python3 # -*- coding: utf-8 -*- import requests import linecache impor ...
- python爬取中国大学排名
教程来自:[Python网络爬虫与信息提取].MOOC. 北京理工大学 目标:爬取最好大学网前50名大学 代码如下: import requests from bs4 import Beautiful ...
- Python爬取全球是最大的电影数据库网站IMDb数据
在使用 Python 开发爬虫的过程中,requests 和 BeautifulSoup4(别名bs4) 应用的比较广泛,requests主要用于模拟浏览器的客户端请求,以获取服务器端响应,接收到的响 ...
- scrapy实例:爬取中国天气网
1.创建项目 在你存放项目的目录下,按shift+鼠标右键打开命令行,输入命令创建项目: PS F:\ScrapyProject> scrapy startproject weather # w ...
随机推荐
- error LNK2019: 无法解析的外部符号 __vsnwprintf,该符号在函数 "long __stdcall StringVPrintfWorkerW
答案就是链接:legacy_stdio_definitions.lib 这个lib即可
- 使用Cygwin登录Raspberry PI
偿试了很多ssh终端程序,像ScureCRT,Putty,SSHSecureShellClient,SSH Client Tunnelier,每个工具都有自己的特点,putty对中文的支持还算好的,其 ...
- Debug 路漫漫-04
1.错误使用 cat 要串联的数组的维度不一致. ——前面给个初始化即可: D = cell(length(trainIdx),1); user_itemData = cell(length(trai ...
- JavaScript 表单验证入门
JavaScript 表单验证 JavaScript 可用来在数据被送往服务器前对 HTML 表单中的这些输入数据进行验证. 被 JavaScript 验证的这些典型的表单数据有: 用户是否已填写表单 ...
- 是否只查看安全传送的网页内容? 去掉 IE弹出窗口
选择IE工具intemt选项,在选项卡里选择安全,然后在安全选项卡里点自定义级别,在设置里找到‘其他’这个分类,在次分类下找到‘显示混合内容’选择‘启用’然后保存退出就OK了,当然楼上几位说安全问题, ...
- memcached缓存基本概念
Memcached是一套分布式内存对象缓存系统. 用于在动态应用系统中缓存数据库的数据,减少数据库的访问压力,达到提升网站系统性能的目的:memcached在企业应用场景中一般是用来作为数据库的cac ...
- java线程池的应用
package com.test; import java.util.concurrent.Callable; public class TestThread implements Callable& ...
- HDU 1896 Stones (优先队列)
Stones Time Limit: 5000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Subm ...
- SpringBoot配置属性之NOSQL
SpringBoot配置属性系列 SpringBoot配置属性之MVC SpringBoot配置属性之Server SpringBoot配置属性之DataSource SpringBoot配置属性之N ...
- windows下安装phpredis模块 (转)
1.下载: http://pecl.php.net/package/redis/2.2.7/windows 2.下载后 由于里面有两个模块分别是vc6,vc9编译的,我们需要知道我们的Php是vc6还 ...