

Replace ABCDEFGHIJ with your video’s code. You can install it using NPM: npm install puppeteerĬode const puppeteer = require('puppeteer') Ĭonst browser = await puppeteer.launch() Ĭonst el = document.querySelector('#videooverlay') From there, all I needed to do was to download the file. Because Puppeteer allows you to listen for the network requests, all I had to do is look for the request that contained the video file extension, and then echo that out. This little script is requesting an OpenLoad embed link, pressing the play button once, which triggers a network request to the video file’s URL. To solve this issue, I wrote a small script which is using Chromium’s Puppeteer tool for creating headless requests using the Chromium browser. OpenLoad is fetching the source video URL after you press play, so it’s not as easy as fetching the video’s source code and parsing the link, because it doesn’t exist initially, it’s obfuscated into the JS code. The Problemĭevelopers that don’t want other people to be able to easily download their videos usually protect their content by obfuscating the code or loading it over JS. Nevertheless, the process of programmatically (headless) downloading files loaded with VideoJS, as is the case for OpenLoad, is pretty interesting, so I thought I should share my approach.

The files belonged to them, and OpenLoad has an API designed for this, but I didn’t find out about it until it was too late. Puppeteer creates its own browser user profile which it cleans up on every run.Someone came up to me recently with the task of downloading a few video files hosted via OpenLoad. This article describes some differences for Linux users. See this article for a description of the differences between Chromium and Chrome. See Puppeteer.launch() for more information.

You can also use Puppeteer with Firefox Nightly (experimental support). const puppeteer = require ( 'puppeteer' ) Ĭonst browser = await puppeteer. You create an instance of Browser, open pages, and then manipulate them with Puppeteer's API.Įxample: navigating to and saving a screenshot as example.png: Puppeteer will be familiar to people using other browser testing frameworks.

All examples below use async/await which is only supported in Node v7.6.0 or greater. Starting from v3.0.0 Puppeteer starts to rely on Node 10.18.1+. Prior to v1.18.1, Puppeteer required at least Node v6.4.0.
