1 Star 0 Fork 185

东方甲乙木 / Python爬虫

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
爬取猫眼电影信息.py 995 Bytes
一键复制 编辑 原始数据 按行查看 历史
from selenium import webdriver
import requests
from pyquery import PyQuery as pq
from urllib.parse import quote
#由于猫眼官方是不是ajax请求
werser=webdriver.Chrome()
def get_index():
try:
a = input('请输入电影的编号:')
url='http://maoyan.com/films/'+quote(a)
#print(url)
werser.get(url)
html=werser.page_source
#print(html)
doc=pq(html)
items=doc('.dra').text()
print('剧情简介:'+items)
print('下面输出用户对此电影的评论')
item=doc('.user .name').text()
ite=doc('.comment-content').text()
print(item + '用户:' + ite,'\n')
print('图集地址')
it=doc('.tab-img .clearfix .default-img').items()
for i in it:
#print(i)
print('地址:',i.attr('data-src'))
except Exception as e:
print('Errer:',e)
finally:
werser.close()
get_index()
Python
1
https://gitee.com/softwyy/python_reptilian.git
git@gitee.com:softwyy/python_reptilian.git
softwyy
python_reptilian
Python爬虫
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891