#爬取ok资源网电影播放地址 #www.okzy.co #入口一:http://okzy.co/index.php?m=vod-search&wd={关键字}&submit=search #入口二:http://www.okzy.co/?m=vod-type-id-{1-34}.html
http://www.okzy.co/?m=vod-index-pg-{1-1110}.html
for x in range(1110):
print(“http://www.okzy.co/?m=vod-index-pg-{}.html".format(x))
#请求,响应,分析保存 #目标入口:首页->列表->子页面->内容(播放地址,对应名称)->保存(电影标题) import requests from lxml import etree #表格模块 #pip install prettytable from prettytable import PrettyTable host = ”http://www.okzy.co" rooturl = “/?m=vod-index-pg-{}.html”.format(1) #请求入口页 response = requests.get(host+rooturl) #输出页面内容-HTML response.encoding = ‘utf-8’
print(response.text)
if response