Class: Vidload::Mp2t::Api::DownloaderBuilder
- Inherits:
-
Object
- Object
- Vidload::Mp2t::Api::DownloaderBuilder
- Defined in:
- lib/vidload/mp2t/api.rb
Constant Summary collapse
- REQUIRED_ARGS =
%i[video_url hls_url master_playlist_name playwright_cli_path video_referer ts_seg_pattern hls_index_pattern].freeze
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize ⇒ DownloaderBuilder
constructor
A new instance of DownloaderBuilder.
- #with_author_name(author_name) ⇒ Object
- #with_hls_index_pattern(hls_index_pattern) ⇒ Object
- #with_hls_url(hls_url) ⇒ Object
- #with_kwargs(**kwargs) ⇒ Object
- #with_master_playlist_name(master_playlist_name) ⇒ Object
- #with_output_dir(output_dir) ⇒ Object
- #with_playwright_cli_path(playwright_cli_path) ⇒ Object
- #with_ts_seg_pattern(ts_seg_pattern) ⇒ Object
- #with_video_name(video_name) ⇒ Object
- #with_video_referer(video_referer) ⇒ Object
- #with_video_url(video_url) ⇒ Object
Constructor Details
#initialize ⇒ DownloaderBuilder
Returns a new instance of DownloaderBuilder.
24 25 26 |
# File 'lib/vidload/mp2t/api.rb', line 24 def initialize @kwargs = {} end |
Instance Method Details
#build ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/vidload/mp2t/api.rb', line 83 def build REQUIRED_ARGS.each do |required_arg| raise ArgumentError, "#{required_arg} must be provided" unless @kwargs[required_arg] end @kwargs[:output_dir] = './' unless @kwargs[:output_dir] @kwargs[:video_name] = "#{@kwargs[:author_name]}_#{@kwargs[:video_name]}" if @kwargs[:author_name] Downloader.new(**@kwargs) end |
#with_author_name(author_name) ⇒ Object
43 44 45 46 |
# File 'lib/vidload/mp2t/api.rb', line 43 def () @kwargs[:author_name] = self end |
#with_hls_index_pattern(hls_index_pattern) ⇒ Object
73 74 75 76 |
# File 'lib/vidload/mp2t/api.rb', line 73 def with_hls_index_pattern(hls_index_pattern) @kwargs[:hls_index_pattern] = hls_index_pattern self end |
#with_hls_url(hls_url) ⇒ Object
48 49 50 51 |
# File 'lib/vidload/mp2t/api.rb', line 48 def with_hls_url(hls_url) @kwargs[:hls_url] = hls_url self end |
#with_kwargs(**kwargs) ⇒ Object
28 29 30 31 |
# File 'lib/vidload/mp2t/api.rb', line 28 def with_kwargs(**kwargs) @kwargs = kwargs self end |
#with_master_playlist_name(master_playlist_name) ⇒ Object
53 54 55 56 |
# File 'lib/vidload/mp2t/api.rb', line 53 def with_master_playlist_name(master_playlist_name) @kwargs[:master_playlist_name] = master_playlist_name self end |
#with_output_dir(output_dir) ⇒ Object
78 79 80 81 |
# File 'lib/vidload/mp2t/api.rb', line 78 def with_output_dir(output_dir) @kwargs[:output_dir] = output_dir self end |
#with_playwright_cli_path(playwright_cli_path) ⇒ Object
58 59 60 61 |
# File 'lib/vidload/mp2t/api.rb', line 58 def with_playwright_cli_path(playwright_cli_path) @kwargs[:playwright_cli_path] = playwright_cli_path self end |
#with_ts_seg_pattern(ts_seg_pattern) ⇒ Object
68 69 70 71 |
# File 'lib/vidload/mp2t/api.rb', line 68 def with_ts_seg_pattern(ts_seg_pattern) @kwargs[:ts_seg_pattern] = ts_seg_pattern self end |
#with_video_name(video_name) ⇒ Object
38 39 40 41 |
# File 'lib/vidload/mp2t/api.rb', line 38 def with_video_name(video_name) @kwargs[:video_name] = video_name self end |
#with_video_referer(video_referer) ⇒ Object
63 64 65 66 |
# File 'lib/vidload/mp2t/api.rb', line 63 def with_video_referer(video_referer) @kwargs[:video_referer] = video_referer self end |
#with_video_url(video_url) ⇒ Object
33 34 35 36 |
# File 'lib/vidload/mp2t/api.rb', line 33 def with_video_url(video_url) @kwargs[:video_url] = video_url self end |