vidload 0.3.4 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4ec46038fec427696fc8d8e1f86c84f3df2d0ea39663a3a39daf5dfcafcd2c5
4
- data.tar.gz: f519d1682b9fb02c9eaf123b9cc68850bf120234b84281cb9fd175dc1c40ba07
3
+ metadata.gz: e6a6c2e597c0e649db09f64a00bc131646351ee75e5ced8b03802802e3144e7f
4
+ data.tar.gz: 825c9e372c6387480eb8bf29aeba03c97c68206ae068ff2d3bf9471cb96ab41b
5
5
  SHA512:
6
- metadata.gz: a4f75f282726d7c831bd716c6b7bcdb9fd892832350a8fb8d84b5a0c93801bf347fa6e3aaaccfb6fccc5d5733130083cf82c3a6b90609ff23b28e763751f855d
7
- data.tar.gz: aaf65273085bff9ad12b516c6a264c96b07f1246c989b01a479583a402d6a1097d169c51596a324147003a4f0a52b876ac7625ec532bd682699a03d5a5d40d0d
6
+ metadata.gz: 54182e718b7c6fc260a80d35be61465ee56d5b03d692fcdca24f4e428513387bf1768f083c4a2f4bd4c33b5abd11b947a4df2ab9577252211f9665a293a97db5
7
+ data.tar.gz: e0cd61e5ea71c05553519b9b81612c0ed9ccf6d7f79a022a536671745cdd9f2279b12a93d20e04ca53961f144d52dbc8891abb3bc82dc154d95691802012c538
data/lib/vidload/cli.rb CHANGED
@@ -8,6 +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 :non_headless, type: :boolean, default: false
11
12
  method_option :hls_url, type: :string, required: true
12
13
  method_option :master_playlist_name, type: :string, required: true
13
14
  method_option :playwright_cli_path, type: :string, required: true
@@ -27,6 +28,7 @@ module Vidload
27
28
  method_option :video_name, type: :string, required: false
28
29
  method_option :video_hub_url, type: :string, required: true
29
30
  method_option :playwright_cli_path, type: :string, required: true
31
+ method_option :non_headless, type: :boolean, default: false
30
32
  def mp4(video_url)
31
33
  params = {
32
34
  video_url: video_url,
@@ -46,6 +46,16 @@ module Vidload
46
46
  self
47
47
  end
48
48
 
49
+ def with_output_dir(output_dir)
50
+ @kwargs[:output_dir] = output_dir
51
+ self
52
+ end
53
+
54
+ def non_headless?(non_headless)
55
+ @kwargs[:non_headless] = non_headless
56
+ self
57
+ end
58
+
49
59
  def with_hls_url(hls_url)
50
60
  @kwargs[:hls_url] = hls_url
51
61
  self
@@ -76,11 +86,6 @@ module Vidload
76
86
  self
77
87
  end
78
88
 
79
- def with_output_dir(output_dir)
80
- @kwargs[:output_dir] = output_dir
81
- self
82
- end
83
-
84
89
  def build
85
90
  REQUIRED_ARGS.each do |required_arg|
86
91
  raise ArgumentError, "#{required_arg} must be provided" unless @kwargs[required_arg]
@@ -110,7 +115,7 @@ module Vidload
110
115
  # main func to be called in your own scripts defined under web/
111
116
  def download_video(video_starter_callbacks: [])
112
117
  Playwright.create(playwright_cli_executable_path: @kwargs[:playwright_cli_path]) do |playwright|
113
- browser = playwright.chromium.launch(headless: false)
118
+ browser = playwright.chromium.launch(headless: !@kwargs[:non_headless])
114
119
  page = browser.new_page
115
120
 
116
121
  manage_video_download(page, *video_starter_callbacks)
@@ -22,13 +22,13 @@ module Vidload
22
22
  self
23
23
  end
24
24
 
25
- def with_video_name(video_name)
26
- @kwargs[:video_name] = video_name
25
+ def with_video_url(video_url)
26
+ @kwargs[:video_url] = video_url
27
27
  self
28
28
  end
29
29
 
30
- def with_video_url(video_url)
31
- @kwargs[:video_url] = video_url
30
+ def with_video_name(video_name)
31
+ @kwargs[:video_name] = video_name
32
32
  self
33
33
  end
34
34
 
@@ -42,6 +42,11 @@ module Vidload
42
42
  self
43
43
  end
44
44
 
45
+ def non_headless?(non_headless)
46
+ @kwargs[:non_headless] = non_headless
47
+ self
48
+ end
49
+
45
50
  def build
46
51
  REQUIRED_ARGS.each do |required_arg|
47
52
  raise ArgumentError, "#{required_arg} must be provided" unless @kwargs[required_arg]
@@ -69,7 +74,7 @@ module Vidload
69
74
  # main func to be called in your own scripts defined under web/
70
75
  def download_video
71
76
  Playwright.create(playwright_cli_executable_path: @kwargs[:playwright_cli_path]) do |playwright|
72
- browser = playwright.chromium.launch
77
+ browser = playwright.chromium.launch(headless: !@kwargs[:non_headless])
73
78
  page = browser.new_page
74
79
 
75
80
  manage_video_download(page)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vidload
4
- VERSION = '0.3.4'
4
+ VERSION = '0.4.0'
5
5
  end
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.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patacode <pata.codegineer@gmail.com>