android - capture HLS Stream URL From Webview Android
问题描述
so I am trying to get the ".m3u8" link from an Embed Video (JWplayer) programmatically from my java android app, the source code of the embed page is obfuscated with this "adilbo_HTML_encoder" here's what i get from chrome View-Source :
<script type="text/javascript" language="Javascript">
var adilbo_HTML_encoder_DYk ='';
var hide_my_HTML_WiO=bzIwNFI.WDE1OFg.bTEyOGc.czEwNlM.UDE1NkM.QjIwMGo.dzIxMkQ.SzIwNVY.VjIwNFc.dzE1OFg.bzEyOGE.eTEwNmc.'+'eDEwNVI.bTE1Nk............................etc
so trying to get the URL with Jsoup won't work. what I tried :
1- De-obfuscating the code which was a fail ( if anyone know how please help ).
2-i noticed that Internet Download manager and a chrome extension named "Hls downloader" on my pc can successfully capture the .m3u8 link then I tried using another network extension named "Network sniffer" to capture the html requests and responses on page load ; I found some requests and responses to and from the famous wanted ".m3u8" streaming URL which is by the way secured with a token=XXXXXXXX and expiry=XXXXXX , so in my android app i tried to open the embed URL in a hidden WebView and try to get the streaming URL from there,
I tried using "onLoadResource" and "shouldInterceptRequest" methods to capture the URL but no success here is my code :
hddwebview.setVisibility(View.GONE);
hddwebview.setWebChromeClient(new WebChromeClient());
hddwebview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
hddwebview.getSettings().setJavaScriptEnabled(true);
hddwebview.loadUrl(url);
hddwebview.getSettings().setDomStorageEnabled(true);
hddwebview.setWebViewClient(new WebViewClient() {
@Override
public void onLoadResource(WebView view, String url) {
if(url.contains("/hls/")){
wantedurl=url; }
super.onLoadResource(view, url);
}
// @Nullable
// @Override
// public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
// if(url.contains("/hls/")){
wantedurl=url;
// }
// return super.shouldInterceptRequest(view, url);
// }
So what I need : a way to get the hls ".m3u8" url From this embed URL ( from my android app ofc ) I searched for a library ( like an advanced browser )or an android opensource video downloader that can capture the URL Like SNAPTUBE for example. THANKS.
解决方案
推荐阅读
- c# - 是否有代码注释将 XML 属性限制为枚举值?
- nlog - NLog.config -> 可以删除旧的日志文件吗?
- ansible - 在 Ansible Jinja2 模板中循环另一个 var 时将项目推送到一个 var
- linux - 为来自 tcsh 的文件预加载 open()
- c# - 使用 c# 在 MongoDB 上进行多个关键字搜索?
- javascript - 在每个对象中使用 Object.assign()
- java - 两个活动之间的共享元素转换不合适
- c# - 获取不同 XML 上的特定元素
- verilog - Verilog中非阻塞赋值的使用
- ios - 使用 Swift 泛型创建新的 NSManagedObjects