11
 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.
The plugin Video DownloadHelper in firefox can get the current mp4 file.
enter image description here Why my js code can't do the same task?

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

enter image description here

How to extract the current video files with js such as the plugin Video DownloadHelper in firefox?

Rizban Ahmad
  • 139
  • 1
  • 13
showkey
  • 482
  • 42
  • 140
  • 295
  • What do you meany by ***flv files*** ? – AsgarAli Nov 02 '16 at 11:57
  • Do you mean Flash Video? Those aren't images. – yunzen Nov 02 '16 at 12:06
  • I'm not sure this will be simple, flv files are usually used within a plugin or player of some kind rather than as "part of the document". It may be helpful to post more information about the page this is being used on as at the moment I think this will be a tough question to answer. – DBS Nov 02 '16 at 12:13

4 Answers4

16

Yahoo Movies use blob stream to transfer video data. There are no direct mp4/flv links anywhere, nor can you get such links directly. The src of the <video> tag refers to a blob stream link:

<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. It doesn’t download a MP4 file. If you try to Copy URL, you’ll get something like this to your clipboard:

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.

For more details on video blob stream, check these links:

What is blob in the <video src=blob:url>?

Export HTML5 blob video to MP4

W3C Media Source Extensions

A URL for Blob and File reference

Community
  • 1
  • 1
Christos Lytras
  • 36,310
  • 4
  • 80
  • 113
2

If I'm understanding correctly you want to look for all the links which have an associated .flv.

If you want this, you can use querySelectorAll and select all the links ending in .flv using the css selector $=.

var flvLinks = document.querySelectorAll('a[href$=".flv"]');
César Alberca
  • 2,321
  • 2
  • 20
  • 32
  • That will only select anchor links to an flv file, I doubt it works for any sort of embedded video. – DBS Nov 02 '16 at 12:14
  • Yes, this is what I thought he was asking for. If not, he will need to retrieve in some way the files the server and look for the flv files. – César Alberca Nov 02 '16 at 12:20
0

to get all flv files of a directory, please try the following code -

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..:)

masud_moni
  • 1,121
  • 16
  • 33
0

You can inspect all video requests on Chrome -> Networks tab in Media sub tab.

iamnamrud
  • 39
  • 7