爬取M3U8文件支持的网页在线播放资源(AES-128加密)

import os
import requests
import re
from multiprocessing import Pool
from Crypto.Cipher import AES

# 这个是你要保存的文件位置,可自定义,记得\\这个不要丢了,写这里是方便下面代码中不写。
path = r'E:\newfilm\\'
# 打开能播放你喜欢资源的网址,按F12,找到浏览器里XHR选项里m3u8文件,右键复制网址,记得选response 里面很多ts网址的。
m3u8 = 'https://youku-com.jjyl12349.com/20210517/BlYZo7Kz/1000kb/hls/index.m3u8'


def get_key(m3u8):
    response = requests.get(m3u8).text
    key_link = re.search('URI=\"(.*?)\"', response).group(1)
    key = requests.get(key_link).text.encode('utf-8')
    crypto = AES.new(key, AES.MODE_CBC, key)
    return crypto


def get_tslist(m3u8):
    response = requests.get(m3u8).text
    ts_list = re.findall('https:.*?\.ts', response)
    return ts_list


crypto = get_key(m3u8)


def down_ts(ts):
    res = requests.get(ts).content
    with open(path + ts.split('/')[-1], 'wb')as
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值