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

能获取某个链接中的视频url吗? #61

Open
dongbeicxy opened this issue Sep 28, 2023 · 3 comments
Open

能获取某个链接中的视频url吗? #61

dongbeicxy opened this issue Sep 28, 2023 · 3 comments

Comments

@dongbeicxy
Copy link

能获取某个链接中的视频url吗?比如:https://twitter.com/TrueKhabri/status/1706944641067622521?s=09

@youlookwhat
Copy link
Owner

没有现成的方法,不过你可以按照下面的示例去得到链接中的视频url(将"img"换为"video"),不过只适用于很简答的视频网页,你给的那个链接不适用。

/**
* 前端注入JS:
* 这段js函数的功能就是,遍历所有的img节点,并添加onclick函数,函数的功能是在图片点击的时候调用本地java接口并传递url过去
*/
private void loadImageClickJs() {
byWebView.getLoadJsHolder().loadJs("javascript:(function(){" +
"var objs = document.getElementsByTagName("img");" +
"for(var i=0;i<objs.length;i++)" +
"{" +
"objs[i].onclick=function(){window.injectedObject.imageClick(this.getAttribute("src"));}" +
"}" +
"})()");
}

@dongbeicxy
Copy link
Author

请问有些根据url获取视频链接的app的实现原理是什么呢?用python?

@youlookwhat
Copy link
Owner

具体我也不太了解,如果确定播放时是一个链接的话,就看怎么得到了,可以用python或其他方式抓包。
不过有可能播放是一个视频id,通过sdk播放的,这个要看具体情况饿了。

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

2 participants