python学习--爱奇艺爬虫

来源:互联网 发布:淘宝店铺转让怎么弄 编辑:程序博客网 时间:2024/06/06 13:25
# -*- coding: UTF-8 -*-
'''
爱奇艺电影 主演和影片简介 爬虫
'''
import re
import urllib2
import json
url = 'https://v.qq.com/x/cover/fse52rd4klx7qn2.html'
text = urllib2.urlopen(url).read()
title = re.findall('<title>(.+?)_电影',text)
name = re.findall('leading_actor":\[(.+?)\],"vip',text)
content = re.findall('description":"(.+?)","cover_id',text)

for i in title:
print ' 剧名:', i
for i in name:
print ' 主演:',i.replace('"','').replace(',','')
for i in content:
print ' 简介:',i