我怎样才能得到正确的URL将视频文件从嵌入的视频? [英] How can I get the correct url to the video file from an embedded video?
问题描述
我想从任何网站上嵌入的视频得到实际的视频文件的URL。它本质上是没有的YouTube。它可以是任何网站。 我编码为Android Java的。
I want to get the actual Video File Url from an embedded video on any website. It essentially is not YouTube. It can be any website. I am coding for android on Java.
例如: 我想要做的事情是一样的,因为这IDM按钮的:
For Example : The thing I want to do is same as this IDM button does :
[其实不一样,因为按钮有捕捉时,它得到的球员开始了网络数据流。但我想从玩家获取该文件直。] 有没有办法实现这一点?任何外部库可以[例如Jsoup]做到这一点?
[Actually not the same because the button there captures a network stream when it gets started by the player. But I want to get the file straight from the player.] Is there a way to attain this? Can Any external Library [e.g. Jsoup] do this?
我已经使用Jsoup获得页面的其他一些内容,但我不知道如何做到这一点。
I am already using Jsoup to get some other contents of the page but I have no idea how to do this.
推荐答案
如果使用jsoup你就可以得到的网址很容易。只要使用jsoup选择所有可能的视频标签(< IFRAME>
,<视频>
,<嵌入>
等)。然后得到的src
属性,并存储在您想要的:
If your using jsoup you can get the url quite easily. Just use jsoup to select all the possible video tags (<iframe>
, <videos>
, <embed>
, etc). Then get the src
attribute and store that where you want it:
示例
//Standard Jsoup search
Elements iframes = body.select("iframe");
/*Gets the src of all the iframes or other tag, and if you have
multiple videos you might have to do this in a for loop.*/
String videoURL = iframes.attr("src");
这篇关于我怎样才能得到正确的URL将视频文件从嵌入的视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!