admin管理员组文章数量:1565292
import requests,re
def getdetail(url):
response = requests.get(url)
#dytt的编码为gbk非utf-8
html = response.content.decode('gbk')
# 电影详情页标题
movie_title_name = re.search('<h1><font color=#07519a>(.*)</f',html)
movie_title = movie_title_name.group(1)
# 电影 磁力 magnet
movie_magnet_url = re.search('/><a href="(.*)"><str',html)
# print(movie_magnet.group(1))
movie_magnet = movie_magnet_url.group(1)
# torrent种子
movie_torrent_url = re.search('ddf"><a href="(.*)">ft',html)
movie_torrent = movie_torrent_url.group(1)
# print(movie_torrent.group(1))
# 这个列表用来title
movie_title_list = []
movie_title_list.append(movie_title)
# 这个列表两个下载的链接
movie_down_url = []
movie_down_url.append(movie_magnet)
movie_down_url.append(movie_torrent)
movie_down_url_all = []
movie_down_url_all.append(movie_down_url)
#保持标题,磁力,种子的同步准确性
movie_dict = dict(zip(movie_title_list,movie_down_url_all))
print(movie_dict)
def getpage():
num = int(input('你要爬取多少页电影呢'))
#获取每一页的url
for i in range(1,num):
lurl = 'http://www.dytt8/html/gndy/dyzz/list_23_%s.html' % i
response = requests.get(lurl)
html = response.text
#取出电影详情页的url
movie_url_list = re.findall('<a href="(.*)" class="ulink"',html)
for movie_item in movie_url_list:
movie_url = 'http://www.dytt8'+movie_item
getdetail(movie_url)
if __name__ == '__main__':
getpage()
版权声明:本文标题:python实现电影天堂种子磁力的爬取 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1725947610a1050256.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论