vidload 0.1.11 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vidload/cli.rb +3 -1
- data/lib/vidload/mp2t/api.rb +5 -3
- data/lib/vidload/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f2f19f4a3e68894970ee46251031cabb28592bd242f0e1b7e2ecc8f5d40c3ee
|
|
4
|
+
data.tar.gz: 78b597dba867b0b988021cee4b8d35ea2a42d5df224af9cd052873c92687cada
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a4261172dc43b40d8f652f96103612d286825816c3d0acc57c2819364545158935c358a0b13b3cb7280d0b9281edc966cb8104c019306ad847548cf7de281120
|
|
7
|
+
data.tar.gz: ea0934e1a52dee15f4204a16c5e1bd08580742b634ad02f86cf17f776373b5b60216098ef94e07e4770903d341c482fd0c1f15b8b4bf738ab1614649588e90e9
|
data/lib/vidload/cli.rb
CHANGED
|
@@ -4,6 +4,7 @@ class Vidload::Cli < Thor
|
|
|
4
4
|
desc "mp2t VIDEO_URL", "download a mp2t containerized video"
|
|
5
5
|
method_option :video_name, type: :string, required: false
|
|
6
6
|
method_option :author_name, type: :string, required: false
|
|
7
|
+
method_option :output_dir, type: :string, required: false
|
|
7
8
|
method_option :hls_url, type: :string, required: true
|
|
8
9
|
method_option :master_playlist_name, type: :string, required: true
|
|
9
10
|
method_option :playwright_cli_path, type: :string, required: true
|
|
@@ -20,7 +21,8 @@ class Vidload::Cli < Thor
|
|
|
20
21
|
video_referer: options[:video_referer],
|
|
21
22
|
ts_seg_pattern: options[:ts_seg_pattern],
|
|
22
23
|
hls_index_pattern: options[:hls_index_pattern],
|
|
23
|
-
author_name: options[:author_name]
|
|
24
|
+
author_name: options[:author_name],
|
|
25
|
+
output_dir: options[:output_dir],
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
process_mp2t(params)
|
data/lib/vidload/mp2t/api.rb
CHANGED
|
@@ -19,13 +19,14 @@ module Vidload::Mp2t::Api
|
|
|
19
19
|
def initialize(
|
|
20
20
|
video_url:,
|
|
21
21
|
video_name:,
|
|
22
|
+
author_name:,
|
|
22
23
|
hls_url:,
|
|
23
24
|
master_playlist_name:,
|
|
24
25
|
playwright_cli_path:,
|
|
25
26
|
video_referer:,
|
|
26
27
|
ts_seg_pattern:,
|
|
27
28
|
hls_index_pattern:,
|
|
28
|
-
|
|
29
|
+
output_dir:
|
|
29
30
|
)
|
|
30
31
|
raise ArgumentError, "video_url must be provided" unless video_url
|
|
31
32
|
raise ArgumentError, "hls_url must be provided" unless hls_url
|
|
@@ -45,6 +46,7 @@ module Vidload::Mp2t::Api
|
|
|
45
46
|
@max_lines = IO.console.winsize[0]
|
|
46
47
|
@author_name = author_name
|
|
47
48
|
@video_name = if @author_name then "#{@author_name}_#{video_name}" else nil end
|
|
49
|
+
@output_dir = output_dir || "./"
|
|
48
50
|
end
|
|
49
51
|
|
|
50
52
|
def self.from_argv
|
|
@@ -136,7 +138,7 @@ module Vidload::Mp2t::Api
|
|
|
136
138
|
|
|
137
139
|
def trigger_video_download(video_url, seg_qty)
|
|
138
140
|
puts "Video starts. Starting download..."
|
|
139
|
-
run_cmd(DEMUXER_PATH, video_url, @video_name, @video_referer) do |line|
|
|
141
|
+
run_cmd(DEMUXER_PATH, video_url, "#{@output_dir}#{@video_name}", @video_referer) do |line|
|
|
140
142
|
if (line.include?("hls @") || line.include?("https @")) && line.match?(/#{@ts_seg_pattern}/i)
|
|
141
143
|
seg_nb = line.match(/#{@ts_seg_pattern}/i)[:seg_nb]
|
|
142
144
|
add_line(line)
|
|
@@ -144,7 +146,7 @@ module Vidload::Mp2t::Api
|
|
|
144
146
|
end
|
|
145
147
|
end
|
|
146
148
|
print "\r\e[2K"
|
|
147
|
-
puts "✔ Video downloaded successfully! Available in
|
|
149
|
+
puts "✔ Video downloaded successfully! Available in #{@output_dir}#{@video_name}.mp4"
|
|
148
150
|
VIDEO_DOWNLOADED_EVENT_QUEUE << true
|
|
149
151
|
end
|
|
150
152
|
|
data/lib/vidload/version.rb
CHANGED