vidload 0.5.1 → 0.5.3
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 +2 -2
- data/lib/vidload/mp2t/api.rb +9 -8
- data/lib/vidload/mp4/api.rb +3 -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: 2674d9d261f3cc70b53dc839aa9a83690b3a9a0db99aa601f3437e4e0b1131af
|
|
4
|
+
data.tar.gz: 6df78a1ff421c653780ac60a6f2ce0e273ac0dd81adbf2350f53c9241530e782
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f1d62a1f636b7e60487ae84ee38e971d61e583c8681c7d124871e7f141bbc7a0e79cf5281ce60a1bee10fe429dc264522ede268331cb2c8f240b10c7e307c3e
|
|
7
|
+
data.tar.gz: 8189ba5721861dd2a09d3330afbc11d3cbd711f9d9131058cbe2be37c56601c5e4cefa01f2af3c1c7c48622f46618e6ad9d69605c8e2c3c95cb46181521c5f10
|
data/lib/vidload/cli.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Vidload
|
|
|
8
8
|
method_option :video_name, type: :string, required: false
|
|
9
9
|
method_option :author_name, type: :string, required: false
|
|
10
10
|
method_option :output_dir, type: :string, required: false
|
|
11
|
-
method_option :
|
|
11
|
+
method_option :headless, type: :boolean, default: true
|
|
12
12
|
method_option :author_dir, type: :boolean, default: false
|
|
13
13
|
method_option :hls_url, type: :string, required: true
|
|
14
14
|
method_option :master_playlist_name, type: :string, required: true
|
|
@@ -29,7 +29,7 @@ module Vidload
|
|
|
29
29
|
method_option :video_name, type: :string, required: false
|
|
30
30
|
method_option :video_hub_url, type: :string, required: true
|
|
31
31
|
method_option :playwright_cli_path, type: :string, required: true
|
|
32
|
-
method_option :
|
|
32
|
+
method_option :headless, type: :boolean, default: true
|
|
33
33
|
def mp4(video_url)
|
|
34
34
|
params = {
|
|
35
35
|
video_url: video_url,
|
data/lib/vidload/mp2t/api.rb
CHANGED
|
@@ -52,8 +52,8 @@ module Vidload
|
|
|
52
52
|
self
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
def
|
|
56
|
-
@kwargs[:
|
|
55
|
+
def is_headless?(headless)
|
|
56
|
+
@kwargs[:headless] = headless
|
|
57
57
|
self
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -120,7 +120,7 @@ module Vidload
|
|
|
120
120
|
# main func to be called in your own scripts defined under web/
|
|
121
121
|
def download_video(video_starter_callbacks: [])
|
|
122
122
|
Playwright.create(playwright_cli_executable_path: @kwargs[:playwright_cli_path]) do |playwright|
|
|
123
|
-
browser = playwright.chromium.launch(headless:
|
|
123
|
+
browser = playwright.chromium.launch(headless: @kwargs[:headless])
|
|
124
124
|
page = browser.new_page
|
|
125
125
|
|
|
126
126
|
manage_video_download(page, *video_starter_callbacks)
|
|
@@ -162,14 +162,15 @@ module Vidload
|
|
|
162
162
|
navigate_to_url(@kwargs[:video_url], page)
|
|
163
163
|
video_starter_callbacks.each do |callback|
|
|
164
164
|
res = callback.call(page)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
@kwargs[:
|
|
168
|
-
@kwargs[:video_name] = "#{@kwargs[:author_name]}_#{@kwargs[:video_name]}"
|
|
165
|
+
if !@kwargs[:video_name] && res[:video_name]
|
|
166
|
+
@kwargs[:video_name] = res[:video_name]
|
|
167
|
+
@kwargs[:video_name] = LuckyCase.dash_case(@kwargs[:video_name].gsub(/[^[:alnum:] ]/, ''))
|
|
169
168
|
end
|
|
169
|
+
next unless !@kwargs[:author_name] && res[:author_name]
|
|
170
170
|
|
|
171
|
-
@kwargs[:
|
|
171
|
+
@kwargs[:author_name] = res[:author_name]
|
|
172
172
|
@kwargs[:author_name] = LuckyCase.dash_case(@kwargs[:author_name].gsub(/[^[:alnum:] ]/, ''))
|
|
173
|
+
@kwargs[:video_name] = "#{@kwargs[:author_name]}_#{@kwargs[:video_name]}"
|
|
173
174
|
end
|
|
174
175
|
end
|
|
175
176
|
|
data/lib/vidload/mp4/api.rb
CHANGED
|
@@ -42,8 +42,8 @@ module Vidload
|
|
|
42
42
|
self
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def
|
|
46
|
-
@kwargs[:
|
|
45
|
+
def is_headless?(headless)
|
|
46
|
+
@kwargs[:headless] = headless
|
|
47
47
|
self
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -74,7 +74,7 @@ module Vidload
|
|
|
74
74
|
# main func to be called in your own scripts defined under web/
|
|
75
75
|
def download_video
|
|
76
76
|
Playwright.create(playwright_cli_executable_path: @kwargs[:playwright_cli_path]) do |playwright|
|
|
77
|
-
browser = playwright.chromium.launch(headless:
|
|
77
|
+
browser = playwright.chromium.launch(headless: @kwargs[:headless])
|
|
78
78
|
page = browser.new_page
|
|
79
79
|
|
|
80
80
|
manage_video_download(page)
|
data/lib/vidload/version.rb
CHANGED