0

I have come across a website whose webpages consist solely of JavaScript. This website hosts videos that I would like to mirror. When I open this website in Firefox and read the page source, I see the JavaScript imports in script tags. When I inspect the page in Firefox, I see HTML, including a video tag. I presume the JavaScript has generated that HTML. (I have not programmed JavaScript, so I do not know its intricacies.)

How do I go about expanding the JavaScript, after downloading the original page? I am after a command-line tool that does this. The resultant HTML is to be parsed by regex to extract the video source file name. My current idea of a bash script that grabs the video is structured like this:

wget the.website.com/page/of/javascript/;
cat inThePage.html |
executeJavaScriptAndBuildHTML |
sed "the HTML and extract the video file name" |
while read aVideoFileName; do
    wget $aVideoFileName;
done

I wonder if such a tool exists; usually JavaScript is executed in the context of an entire GUI web browser.

I have an inkling that the whole point of the JavaScript-only page is to prevent this kind of automated downloading.

7
  • If your extraction is legitimate, you should look for an API they would provide or ask them assistance, otherwise you are simply stealing from them and this is not acceptable both ethically and legally (in most locations). Commented Aug 9, 2016 at 0:56
  • My problem is specific. The answer should be general. How can JavaScript be executed without a full fledged browser?
    – bimmo
    Commented Aug 9, 2016 at 1:02
  • JS is we web-based script. It is designed and used only in the context of web pages. It's not a stand alone "language".
    – ejbytes
    Commented Aug 9, 2016 at 2:22
  • Also, since it seem you are new to this website, SuperUser is but one of many places to ask questions. You will want to move this question to a suitable forum; many long-timers will be chiming in to let you know that.
    – ejbytes
    Commented Aug 9, 2016 at 2:25
  • You mean, I should re-post it elsewhere to attract more eyes? Or is the question unsuitable for SU?
    – bimmo
    Commented Aug 9, 2016 at 2:48

0

You must log in to answer this question.

Browse other questions tagged .