Abstract
The constructor of the VideoScraperCore class.
Optional
options: { browserExecutablePath?: string; debug?: boolean; debugScope?: null | string; windowSize?: { width?: number | undefined; height?: number | undefined; } }The BrowserOptions to pass to the instance.
Optional
browserThe path to the browser executable. (Default value: '/usr/bin/google-chrome')
Optional
debug?: booleanIf true, it will show debug log. (Default value: false)
Optional
debugThe scope given to the euberlog debug logger. (Default value: 'VideoScraperCore')
Optional
windowThe object that says how big the window size will be. (Default value: { width: 1920, height: 1080 })
Protected
Abstract
afterThis method is called after the page, with the specified url, is loaded. It can be used for things such as logging in if it is requested before reaching the video page.
The ScrapingOptions that can be used or changed in this method
Optional
audio?: booleanIf true, the audio will be recorded. (Default value: true)
Optional
audioThe chosen bitrate for the audio component of the media. If not specified, it will be adaptive, depending upon the sample rate and the number of channels. (Default value: undefined)
Optional
debug?: null | booleanIf null, the debug will be shown by looking at the passed BrowserOptions. Otherwise, if useGlobalDebug is false, this specifies if the debug will be shown.
Optional
debugIf useGlobalDebug is true, this will be ignore. Otherwise, this specifies if the euberlog logger scope for the debug of this scrape.
Optional
delayThe delay in milliseconds after that the duration milliseconds are past and before that the recording is stopped. (Default value: 15_000)
Optional
delayThe delay in milliseconds after that the play button has been clicked. (Default value: 0)
Optional
duration?: null | numberThe duration in milliseconds of the recorded video. The recording starts delayAfterVideoStarted milliseconds after that the play button has been clicked and finishes delayAfterVideoFinished milliseconds after that this duration has passed. If the value is null, the duration will be automatically gotten by looking at the page's video duration. (Default value: null)
Optional
frameThe number of milliseconds to record into each packet. (Default value: 20)
Optional
fullIf true, the video will be recorded after having put it on fullscreen. (Default value: false)
Optional
mimeThe mimetype of the recorded video or audio. (Default value: 'video/webm')
Optional
useIf true, the global logger will be used, ignoring other debug options in this object. (Default value: true)
Optional
video?: booleanIf true, the video will be recorded. (Default value: true)
Optional
videoThe chosen bitrate for the video component of the media. If not specified, the rate will be 2.5Mbps. (Default value: undefined)
The page (puppeteer) that is loaded
A logger instance to write log
Protected
Abstract
getReturns the video full screen selector, which is used by the method setVideoToFullScreen to put the video in full screen.
Protected
Abstract
getReturns the video play button selector, which is used by the method playVideo to play the video.
Protected
getGets the video duration by parsing the given page. This method can be overridden in case the page's way to display time is not compatible.
The extracted video duration
A browser page (of puppeteer)
A logger instance to write log
Protected
Abstract
getReturns the video duration selector, which is used by the method getVideoDuration to extract the video duration text from the page.
Protected
handleGiven the duration text gotten from the page's HTML (e.g. 1:30:23), it returns the duration in milliseconds. This method can be overridden in case the page's time format is not compatible.
The duration in milliseconds.
The duration text gotten from the page's HTML.
Protected
playPlays the video by clicking the play button. This method can be overridden in case the page's way to start the video is not compatible.
A browser page (of puppeteer)
A logger instance to write log
Scrapes a video.
The url of the video to save
The path where the video will be saved. Note that the extension should be webm.
Optional
options: { audio?: boolean; audioBitsPerSecond?: number; debug?: null | boolean; debugScope?: null | string; delayAfterVideoFinished?: number; delayAfterVideoStarted?: number; duration?: null | number; frameSize?: number; fullScreen?: boolean; mimeType?: BrowserMimeType; useGlobalDebug?: boolean; video?: boolean; videoBitsPerSecond?: number }The ScrapingOptions to pass to this method.
Optional
audio?: booleanIf true, the audio will be recorded. (Default value: true)
Optional
audioThe chosen bitrate for the audio component of the media. If not specified, it will be adaptive, depending upon the sample rate and the number of channels. (Default value: undefined)
Optional
debug?: null | booleanIf null, the debug will be shown by looking at the passed BrowserOptions. Otherwise, if useGlobalDebug is false, this specifies if the debug will be shown.
Optional
debugIf useGlobalDebug is true, this will be ignore. Otherwise, this specifies if the euberlog logger scope for the debug of this scrape.
Optional
delayThe delay in milliseconds after that the duration milliseconds are past and before that the recording is stopped. (Default value: 15_000)
Optional
delayThe delay in milliseconds after that the play button has been clicked. (Default value: 0)
Optional
duration?: null | numberThe duration in milliseconds of the recorded video. The recording starts delayAfterVideoStarted milliseconds after that the play button has been clicked and finishes delayAfterVideoFinished milliseconds after that this duration has passed. If the value is null, the duration will be automatically gotten by looking at the page's video duration. (Default value: null)
Optional
frameThe number of milliseconds to record into each packet. (Default value: 20)
Optional
fullIf true, the video will be recorded after having put it on fullscreen. (Default value: false)
Optional
mimeThe mimetype of the recorded video or audio. (Default value: 'video/webm')
Optional
useIf true, the global logger will be used, ignoring other debug options in this object. (Default value: true)
Optional
video?: booleanIf true, the video will be recorded. (Default value: true)
Optional
videoThe chosen bitrate for the video component of the media. If not specified, the rate will be 2.5Mbps. (Default value: undefined)
Changes the BrowserOptions options.
The new options.
Optional
browserThe path to the browser executable. (Default value: '/usr/bin/google-chrome')
Optional
debug?: booleanIf true, it will show debug log. (Default value: false)
Optional
debugThe scope given to the euberlog debug logger. (Default value: 'VideoScraperCore')
Optional
windowThe object that says how big the window size will be. (Default value: { width: 1920, height: 1080 })
Protected
setSets the video put the video in fullscreen. This method can be overridden in case the page's way to put the video in fullscreen is not compatible.
A browser page (of puppeteer)
A logger instance to write log
Generated using TypeDoc
The VideoScraperCore class, that can be extended to scrape a video from a website and saves it to a file.