|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
哪个大神帮我看看这个爬虫,是爬爱奇艺VIP视频的,不知道为什么这个只能爬九个,麻烦帮我改一下
import requests
import re
import sys
type = sys.getfilesystemencoding()
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)\
Chrome/55.0.2883.87 Safari/537.36'}
html = requests.get('http://vip.iqiyi.com/hot.html?cid=1',headers=headers)
html.encoding = 'utf-8'
title = re.findall('<a target="_blank" rseat="709181_热播榜二级页_电影(.)" title="(.*?)"',html.text,re.S)
for each in title:
print(each)
讲来讲去,还是正则表达式没有写对:
- import requests
- import re
- import sys
- type = sys.getfilesystemencoding()
- headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)\
- Chrome/55.0.2883.87 Safari/537.36'}
- html = requests.get('http://vip.iqiyi.com/hot.html?cid=1',headers=headers)
- html.encoding = 'utf-8'
- title = re.findall(r'<a target="_blank" rseat="709181_热播榜二级页_电影(.*?)" title="(.*?)"',html.text,re.S)
- for each in title:
- print(each)
复制代码
|
|