如果媒体播放列表(M3U8文件)不需要解密,并且受到"Ext-X-Session-Key"的影响,你可以按照以下方式解决:
def remove_session_key(m3u8_file):
with open(m3u8_file, 'r') as file:
lines = file.readlines()
with open(m3u8_file, 'w') as file:
for line in lines:
if not line.startswith('#EXT-X-SESSION-KEY'):
file.write(line)
m3u8_file = 'your_playlist.m3u8'
remove_session_key(m3u8_file)
import re
def remove_session_key(m3u8_file):
with open(m3u8_file, 'r') as file:
content = file.read()
# 移除EXT-X-SESSION-KEY标签
content = re.sub(r'#EXT-X-SESSION-KEY.*\n', '', content)
with open(m3u8_file, 'w') as file:
file.write(content)
m3u8_file = 'your_playlist.m3u8'
remove_session_key(m3u8_file)
无论使用哪种方法,这将确保"EXT-X-SESSION-KEY"标签从M3U8文件中移除,从而不会影响媒体播放列表的解密过程。
下一篇:不需要解压文件即可阅读7-zip