# 1.定位到2023必看热片
# 2.从2023必看热片中提取到子页面的链接地址
# 3.请求子页面的链接地址,拿到我们需要的下载的地址...
import requests
import re
domain = "https://www.dytt89.com/"
resp = requests.get(domain, verify=False) # verify=False 去掉安全验证
resp.encoding = 'gb2312' # 指定字符集
# print(resp.text)
# 拿到ul里面的li
obj1 = re.compile(r"2023必看热片.*?<ul>(?P<ul>.*?)<ul>", re.S)
obj2 = re.compile(r"<a href='(?P<href>.*?)'", re.S)
obj3 = re.compile(r'◎片 名(?P<movie>.*?)<br />.*?<td '
r'style="WORD-WRAP: break-word" bgcolor="#fdfddf"><a href="(?P<download>.*?)">', re.S)
result1 = obj1.finditer(resp.text)
child_href_list = []
for it in result1:
ul = it.group('ul')
# print(ul)
# 提取子页面的链接
result2 = obj2.finditer(ul)
for it1 in result2:
# print(it1.group('href'))
# 拼接子页面的url地址:域名 + 子页面的地址
child_href = domain + it1.group('href').strip("/")
child_href_list.append(child_href) # 把子页面链接保存起来
# 提取子页面内容
for href in child_href_list:
child_resp = requests.get(href, verify=False) # verify=False 去掉安全验证
child_resp.encoding = 'gb2312'
# print(child_resp.text)
result3 = obj3.search(child_resp.text)
print(result3.group("movie"))
print(result3.group("download"))
break # 循环用
运行结果
扫黑行动
magnet:?xt=urn:btih:ec2924161e5f2b47a3be8756feab15cde5db6655&dn=[电影天堂www.dytt89.com]扫黑行动-2022_HD国语中字.mp4&tr=http://t.t789.me:2710/announce&tr=http://t.t789.co:2710/announce&tr=http://t.t789.vip:2710/announce
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容