爬出来始终是第一页的内容
import requests
from requests.exceptions import RequestException
from pyquery import PyQuery as pq
import re
import simplejson as json
def get_one_page(url):
try:
response=requests.get(url)
if response.status_code==200:
return response.text
except RequestException:
return None
def parse_one_page(html):
doc = pq(html)
movie=doc('.video_item .sort_lst_tit').text()
actor=doc('.video_item .sort_lst_txt')
actor_list=[]
for items in actor.items():
# 遍历获取到的pyquery对象
item_i="".join(((items.text()).strip()[3:])).split()
item_ii=",".join(item_i)
#去掉空格,并传入list中
actor_list.append(item_ii)
movie_list=movie.split(' ')
# 将电影列表整理成列表
for it