Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望能够自动填写key和iv #411

Open
erikaemma opened this issue Jun 29, 2024 · 2 comments
Open

希望能够自动填写key和iv #411

erikaemma opened this issue Jun 29, 2024 · 2 comments

Comments

@erikaemma
Copy link

最近下载的视频地址是“http://demo.com/a.m3u8?auto_key=123”,然后文件中有如下内容:

#EXT-X-KEY:METHOD=AES-128,URI="https://demo2.com/crypt.key?auth_key=123",IV=0x456

crypt.key下载后需要使用base64转码:
data:application/octet-stream;base64,abcdefg==

也就是说这个key(abcdefg==)和iv(0x456)都能够自动获得。而且这个网站非常变态,视频无论是否正在播放,这个key是随时变化的,有时候手工操作根本来不及

@wnpllrzodiac
Copy link

你自己做个nginx代理处理下,再给 N_m3u8DL-RE ?
感觉不是媒体侧标准行为

@nilaoda
Copy link
Owner

nilaoda commented Aug 7, 2024

软件已经提供了HLSKeyProcessor来实现自定义KEY解析逻辑。

示例代码:

internal class DemoProcessor2 : KeyProcessor
{
public override bool CanProcess(ExtractorType extractorType, string keyLine, string m3u8Url, string m3u8Content, ParserConfig parserConfig)
{
return extractorType == ExtractorType.HLS && parserConfig.Url.Contains("playertest.longtailvideo.com");
}
public override EncryptInfo Process(string keyLine, string m3u8Url, string m3u8Content, ParserConfig parserConfig)
{
Logger.InfoMarkUp($"[white on green]My Key Processor => {keyLine}[/]");
var info = new DefaultHLSKeyProcessor().Process(keyLine, m3u8Url, m3u8Content, parserConfig);
Logger.InfoMarkUp("[red]" + HexUtil.BytesToHex(info.Key!, " ") + "[/]");
return info;
}
}

//demo1
parserConfig.ContentProcessors.Insert(0, new DemoProcessor());
//demo2
parserConfig.KeyProcessors.Insert(0, new DemoProcessor2());
//for www.nowehoryzonty.pl
parserConfig.UrlProcessors.Insert(0, new NowehoryzontyUrlProcessor());

你可以自行修改源码来实现针对某网站的特殊行为。


目前尚未构想如何不修改源代码实现“插件”功能。欢迎讨论。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants