Class: YtDlp::Video
- Inherits:
-
Object
- Object
- YtDlp::Video
- Defined in:
- lib/yt_dlp/video.rb
Overview
Data model for a video accessed from an URL.
Constant Summary collapse
- MANDATORY_OPTIONS =
Required to get informations about the video.
{ dump_json: true, simulate: false }.freeze
- INFORMATION_OPTIONS =
Optimisation purpose. Do not download the video if you only need information.
MANDATORY_OPTIONS.merge(skip_download: true).freeze
Instance Attribute Summary collapse
-
#executable_path ⇒ Object
readonly
Returns the value of attribute executable_path.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #download ⇒ Object
- #information ⇒ Object
-
#initialize(url, executable_path = YtDlp.config.executable_path, **options) ⇒ Video
constructor
Initialize a Video.
Constructor Details
#initialize(url, executable_path = YtDlp.config.executable_path, **options) ⇒ Video
Initialize a Video.
26 27 28 29 30 |
# File 'lib/yt_dlp/video.rb', line 26 def initialize(url, executable_path = YtDlp.config.executable_path, **) @url = url @executable_path = executable_path = end |
Instance Attribute Details
#executable_path ⇒ Object (readonly)
Returns the value of attribute executable_path.
8 9 10 |
# File 'lib/yt_dlp/video.rb', line 8 def executable_path @executable_path end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/yt_dlp/video.rb', line 8 def end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/yt_dlp/video.rb', line 8 def url @url end |
Instance Method Details
#download ⇒ Object
32 33 34 35 |
# File 'lib/yt_dlp/video.rb', line 32 def download @information = (.merge(MANDATORY_OPTIONS)) @information[:filename] end |
#information ⇒ Object
37 38 39 |
# File 'lib/yt_dlp/video.rb', line 37 def information @information ||= (.merge(INFORMATION_OPTIONS)) end |