1 Star 0 Fork 182

GSAM / Python爬虫

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
爬取豆瓣电影的一些信息 802 Bytes
一键复制 编辑 原始数据 按行查看 历史
import re
import urllib.request as r
def test(url,page):
html = r.urlopen(url).read().decode('utf-8')
# 上演时间
test = re.compile('<p class="releasetime">(.*?)</p>').findall(html)
# 片名
ttest = re.compile('<a href=".*?" title=(".*?")').findall(html)
ttest = set(ttest)
# 主演
tttest = re.compile('<p class="star">(.*?)</p>', re.S).findall(html)
tttest = set(tttest)
p=0
# 主演
for c in tttest:
print(c)
# 片名
for u in ttest:
print('片名:', u)
p += 1
print('一共%s个片名' % p)
# 上演时间
for i in test:
print(i)
print('当前是第%s页'%page)
for yy in range(0,100,10):
url='http://maoyan.com/board/4?offset=%s'%yy
test(url,yy)
Python
1
https://gitee.com/dushuren/python_reptilian.git
git@gitee.com:dushuren/python_reptilian.git
dushuren
python_reptilian
Python爬虫
master

搜索帮助