vidload 0.1.9 → 0.1.11
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 +34 -0
- data/lib/vidload/mp2t/api.rb +30 -4
- data/lib/vidload/version.rb +1 -1
- data/lib/vidload.rb +1 -0
- metadata +16 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f49b5b5ccfd0249511e3d7d9f14e13409d8c578efc202351fd5ebc5d82bbeba
|
|
4
|
+
data.tar.gz: 88f6b50466ce36d590f1407ad8daecd0dddeee00c4739b9d315d9feab8a3293c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff4a4ecf10a0df9d1d339f1d7e2d2af8c033d967b98a137bea85c41e65179e15f28e031c0bbf9fb7eeda36c1c16d05870072c4f98739912cf04241c05bb546bc
|
|
7
|
+
data.tar.gz: 8867c690eaac5b3ecfa177e22b6d44699657ca50d99f820a71b0f50dda3db8b34c56df99ddcd37c7c2a6a00ead4eda672725daaa6a3c4dce601ee7a0681851b4
|
data/lib/vidload/cli.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require "thor"
|
|
2
|
+
|
|
3
|
+
class Vidload::Cli < Thor
|
|
4
|
+
desc "mp2t VIDEO_URL", "download a mp2t containerized video"
|
|
5
|
+
method_option :video_name, type: :string, required: false
|
|
6
|
+
method_option :author_name, type: :string, required: false
|
|
7
|
+
method_option :hls_url, type: :string, required: true
|
|
8
|
+
method_option :master_playlist_name, type: :string, required: true
|
|
9
|
+
method_option :playwright_cli_path, type: :string, required: true
|
|
10
|
+
method_option :video_referer, type: :string, required: true
|
|
11
|
+
method_option :ts_seg_pattern, type: :string, required: true
|
|
12
|
+
method_option :hls_index_pattern, type: :string, required: true
|
|
13
|
+
def mp2t(video_url)
|
|
14
|
+
params = {
|
|
15
|
+
video_url: video_url,
|
|
16
|
+
video_name: options[:video_name],
|
|
17
|
+
hls_url: options[:hls_url],
|
|
18
|
+
master_playlist_name: options[:master_playlist_name],
|
|
19
|
+
playwright_cli_path: options[:playwright_cli_path],
|
|
20
|
+
video_referer: options[:video_referer],
|
|
21
|
+
ts_seg_pattern: options[:ts_seg_pattern],
|
|
22
|
+
hls_index_pattern: options[:hls_index_pattern],
|
|
23
|
+
author_name: options[:author_name]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
process_mp2t(params)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def process_mp2t(params)
|
|
32
|
+
raise NotImplementedError
|
|
33
|
+
end
|
|
34
|
+
end
|
data/lib/vidload/mp2t/api.rb
CHANGED
|
@@ -24,10 +24,10 @@ module Vidload::Mp2t::Api
|
|
|
24
24
|
playwright_cli_path:,
|
|
25
25
|
video_referer:,
|
|
26
26
|
ts_seg_pattern:,
|
|
27
|
-
hls_index_pattern
|
|
27
|
+
hls_index_pattern:,
|
|
28
|
+
author_name:
|
|
28
29
|
)
|
|
29
30
|
raise ArgumentError, "video_url must be provided" unless video_url
|
|
30
|
-
raise ArgumentError, "video_name must be provided" unless video_name
|
|
31
31
|
raise ArgumentError, "hls_url must be provided" unless hls_url
|
|
32
32
|
raise ArgumentError, "master_playlist_name must be provided" unless master_playlist_name
|
|
33
33
|
raise ArgumentError, "playwright_cli_path must be provided" unless playwright_cli_path
|
|
@@ -36,7 +36,6 @@ module Vidload::Mp2t::Api
|
|
|
36
36
|
raise ArgumentError, "hls_index_pattern must be provided" unless hls_index_pattern
|
|
37
37
|
|
|
38
38
|
@video_url = video_url
|
|
39
|
-
@video_name = video_name
|
|
40
39
|
@hls_url = hls_url
|
|
41
40
|
@master_playlist_name = master_playlist_name
|
|
42
41
|
@playwright_cli_path = playwright_cli_path
|
|
@@ -44,6 +43,8 @@ module Vidload::Mp2t::Api
|
|
|
44
43
|
@ts_seg_pattern = ts_seg_pattern
|
|
45
44
|
@hls_index_pattern = hls_index_pattern
|
|
46
45
|
@max_lines = IO.console.winsize[0]
|
|
46
|
+
@author_name = author_name
|
|
47
|
+
@video_name = if @author_name then "#{@author_name}_#{video_name}" else nil end
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
def self.from_argv
|
|
@@ -56,6 +57,21 @@ module Vidload::Mp2t::Api
|
|
|
56
57
|
video_referer: ARGV[5],
|
|
57
58
|
ts_seg_pattern: ARGV[6],
|
|
58
59
|
hls_index_pattern: ARGV[7],
|
|
60
|
+
author_name: ARGV[8],
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def self.from_hash(hash)
|
|
65
|
+
new(
|
|
66
|
+
video_url: hash[:video_url],
|
|
67
|
+
author_name: hash[:author_name],
|
|
68
|
+
video_name: hash[:video_name],
|
|
69
|
+
hls_url: hash[:hls_url],
|
|
70
|
+
master_playlist_name: hash[:master_playlist_name],
|
|
71
|
+
playwright_cli_path: hash[:playwright_cli_path],
|
|
72
|
+
video_referer: hash[:video_referer],
|
|
73
|
+
ts_seg_pattern: hash[:ts_seg_pattern],
|
|
74
|
+
hls_index_pattern: hash[:hls_index_pattern],
|
|
59
75
|
)
|
|
60
76
|
end
|
|
61
77
|
|
|
@@ -82,6 +98,9 @@ module Vidload::Mp2t::Api
|
|
|
82
98
|
puts "\tmaster_playlist_name=#{@master_playlist_name}"
|
|
83
99
|
puts "\tplaywright_cli_path=#{@playwright_cli_path}"
|
|
84
100
|
puts "\tvideo_referer=#{@video_referer}"
|
|
101
|
+
puts "\tts_seg_pattern=#{@ts_seg_pattern}"
|
|
102
|
+
puts "\thls_index_pattern=#{@hls_index_pattern}"
|
|
103
|
+
puts "\tauthor_name=#{@author_name}"
|
|
85
104
|
end
|
|
86
105
|
|
|
87
106
|
def self.display_with_spinner(loading_msg = "Loading...")
|
|
@@ -100,7 +119,14 @@ module Vidload::Mp2t::Api
|
|
|
100
119
|
page.on("response", -> (resp) { listen_to_video_starts(resp) })
|
|
101
120
|
navigate_to_url(@video_url, page)
|
|
102
121
|
video_starter_callbacks.each do |callback|
|
|
103
|
-
callback.call(page)
|
|
122
|
+
res = callback.call(page)
|
|
123
|
+
if !@video_name && res[:video_name]
|
|
124
|
+
@video_name = res[:video_name]
|
|
125
|
+
end
|
|
126
|
+
if !@author_name && res[:author_name]
|
|
127
|
+
@author_name = res[:author_name]
|
|
128
|
+
@video_name = "#{@author_name}_#{@video_name}"
|
|
129
|
+
end
|
|
104
130
|
end
|
|
105
131
|
end
|
|
106
132
|
|
data/lib/vidload/version.rb
CHANGED
data/lib/vidload.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vidload
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Patacode <pata.codegineer@gmail.com>
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '1.8'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: thor
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '1.5'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '1.5'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: rake
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -73,6 +87,7 @@ extensions: []
|
|
|
73
87
|
extra_rdoc_files: []
|
|
74
88
|
files:
|
|
75
89
|
- lib/vidload.rb
|
|
90
|
+
- lib/vidload/cli.rb
|
|
76
91
|
- lib/vidload/mp2t.rb
|
|
77
92
|
- lib/vidload/mp2t/api.rb
|
|
78
93
|
- lib/vidload/mp2t/remuxer.sh
|