简体   繁体   English

如何使用js在网页中提取所有当前视频文件及其地址?

[英]How to extract all the current video files and its address in the web page with js?

 var imgs=document.images.length;

It can extract all the images on the web page. 它可以提取网页上的所有图像。
How extract all the flv files whose suffix is flv such as sample.flv in the web page with js?Not all the flv files on my local directory but web page. 如何使用js在网页中提取所有后缀为flv的flv文件,例如sample.flv ?不是我本地目录中的所有flv文件而是网页。
The plugin Video DownloadHelper in firefox can get the current mp4 file. firefox中的插件Video DownloadHelper可以获取当前的mp4文件。
在此输入图像描述 Why my js code can't do the same task? 为什么我的js代码不能执行相同的任务?

var Links = document.querySelectorAll('a[href$=".mp4"]');
console.log(Links);

在此输入图像描述

How to extract the current video files with js such as the plugin Video DownloadHelper in firefox? 如何用fires中的插件Video DownloadHelper等js提取当前视频文件?

Yahoo Movies use blob stream to transfer video data. 雅虎电影使用blob流传输视频数据。 There are no direct mp4/flv links anywhere, nor can you get such links directly. 在任何地方都没有直接的mp4/flv链接,也不能直接获得这样的链接。 The src of the <video> tag refers to a blob stream link: <video>标记的src引用blob流链接:

<video class="yvp-html5-video" preload="" id="2413371376" src="blob:https://www.yahoo.com/1dfafd99-a1ff-4cc8-bcff-255e69db9977"></video>

When you hit to download MP4 from Video DownloadHelper , the plugin actually reads the blob stream and writes it to disk in an MP4 file. 当您从Video DownloadHelper下载MP4时,该插件实际上会读取blob流并将其写入MP4文件中的磁盘。 It doesn't download a MP4 file. 它不下载MP4文件。 If you try to Copy URL , you'll get something like this to your clipboard: 如果你尝试Copy URL ,你会得到这样的东西给你的剪贴板:

https://roarack01.vpg.cdn.yimg.com/yahoomovies/61fb473f-04a2-381e-b2ae-9496dfba5e66_VYtMtix1DscECbXMT9tHT7yf2P9BZF-mRCMjBejFgALFHl7NSm1ZXPOMICAOr949v2xUgEASYLw-_1_0_vtt.m3u8?a=yahoomovies&ib=sapi&m=application%2fvnd.apple.mpegurl&mr=0&ns=c+i+ci+cii&vid=61fb473f-04a2-381e-b2ae-9496dfba5e66&x=1479599999&s=370695a7063b6aae06fb7f537c85773a

You can record a blob stream, but it's not an easy task. 您可以录制blob流,但这不是一件容易的事。

For more details on video blob stream, check these links: 有关视频blob流的更多详细信息,请查看以下链接:

What is blob in the <video src=blob:url>? <video src = blob:url>中的blob是什么?

Export HTML5 blob video to MP4 将HTML5 blob视频导出到MP4

W3C Media Source Extensions W3C媒体来源扩展

A URL for Blob and File reference Blob和文件引用的URL

If I'm understanding correctly you want to look for all the links which have an associated .flv . 如果我正确理解你想要查找所有具有相关联的.flv的链接。

If you want this, you can use querySelectorAll and select all the links ending in .flv using the css selector $= . 如果需要,可以使用querySelectorAll并使用css选择器$=选择以.flv结尾的所有链接。

var flvLinks = document.querySelectorAll('a[href$=".flv"]');

to get all flv files of a directory, please try the following code - 要获取目录的所有flv文件,请尝试以下代码 -

var files = fs.readdirSync("YOUR_DIRECTORY");
var path = require('path');

for(var i in files) {
   if(path.extname(files[i]) === ".flv") {
       //do your desired task here
   }
}

Hope it helps..:) 希望能帮助到你..:)

您可以在媒体子标签中的Chrome - >网络标签上检查所有视频请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使网页在目录树中包含所有js文件? - How to have web page include all js files in a directory tree? 使用 Node JS 从 Telegram Web 页面中提取所有 HTML 元素 - Extract all HTML elements from Telegram Web page with Node JS 如何将网页快照及其所有元素(css、js、图像等)保存到一个文件中 - How to save a web page snapshot with all its elements (css, js, images, ...) into one file 如何确保网页或android应用中的所有css和js文件都已加载? - How to make sure that all css and js files in web page or android app are loaded? CakePHP-网页尝试在webroot中加载所有js文件 - CakePHP - Web page try to load all the js files in the webroot 获取 web 页面上加载的所有 JS 文件的列表 - Get list of all JS files loaded on a web page JS:如何从当前网页打开2个链接 - JS: How to open 2 links from current web page 如何完全提取内联依赖项并将图像转换为dataURI的网页? - How do I extract a web page completely with its dependencies inlined, and images converted to dataURI? 如何确定网页中已加载JS文件的真实层次结构 - How to determine the true hierarchy of loaded JS files in a web page Javascript如何从其页面中提取令牌 - Javascript how to extract token from its page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM