youtube_to_rss 0.1.2 → 0.3.2

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: acfb64abebff5ecb60d9f673b4b4007a35c51dd08520c5c488df7d1bededbb4b
4
- data.tar.gz: 6cdb824bb620ecdc6d6db08ca5b3c51594d71419242dea826b50cd1e826ea14a
3
+ metadata.gz: 062342dedf498fc87c0eb8f4be2c9f8abcb48dc185863543308590d30a498def
4
+ data.tar.gz: 56b13e767b2f6876d6e5bd9ab7275d6f81c39e7baaba67f1cd07ccf1b0e52cba
5
5
  SHA512:
6
- metadata.gz: 4fce15488bf725b3a3421d592acd6a8ae51d07754d0598bfdfdcb6d44f0746d70f0507bc62e3435ddbd8c66b7c74fdd1cc8f8cf3973e3a4e39bf4ca3bfa4e6c5
7
- data.tar.gz: d62a678480caf16ec52917006405a28f25b200941e27e5ecf936248929ed4626106e43c36c0dc985b58778d9668a9c3c8b2a1c55d3d10460b861096ce62ccda5
6
+ metadata.gz: 9608c2e92441998096512a1a889f5ab98c4f6e769276f6be158da284ed506ca7e2c968f1bc8b174da63a3504ce418c593a653236ad63d187563a6a928a3e502e
7
+ data.tar.gz: 9d675de38f3b64eb023c920bc77b018b4598bd0a41d7973ec9ca5f32a876b648e527ba3c08210ba06ce14c8066242734a0e01941bb334f8ae2a68b7aebb0d1cd
data/Gemfile CHANGED
@@ -11,6 +11,7 @@ group :development, :test do
11
11
  gem 'pry'
12
12
  gem 'pry-doc'
13
13
  gem 'pry-rails'
14
+ gem 'pry-byebug'
14
15
  gem 'spring-commands-rspec'
15
16
  gem 'rspec-rails'
16
17
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- youtube_to_rss (0.1.1)
4
+ youtube_to_rss (0.3.1)
5
+ rest-client
5
6
 
6
7
  GEM
7
8
  remote: https://rubygems.org/
@@ -27,19 +28,29 @@ GEM
27
28
  zeitwerk (~> 2.3)
28
29
  ast (2.4.1)
29
30
  builder (3.2.4)
31
+ byebug (11.1.3)
30
32
  coderay (1.1.3)
31
33
  concurrent-ruby (1.1.7)
32
34
  crass (1.0.6)
33
35
  diff-lcs (1.4.4)
36
+ domain_name (0.5.20190701)
37
+ unf (>= 0.0.5, < 1.0.0)
34
38
  erubi (1.10.0)
39
+ http-accept (1.7.0)
40
+ http-cookie (1.0.5)
41
+ domain_name (~> 0.5)
35
42
  i18n (1.8.5)
36
43
  concurrent-ruby (~> 1.0)
37
44
  loofah (2.8.0)
38
45
  crass (~> 1.0.2)
39
46
  nokogiri (>= 1.5.9)
40
47
  method_source (1.0.0)
48
+ mime-types (3.4.1)
49
+ mime-types-data (~> 3.2015)
50
+ mime-types-data (3.2023.0218.1)
41
51
  mini_portile2 (2.4.0)
42
52
  minitest (5.14.2)
53
+ netrc (0.11.0)
43
54
  nokogiri (1.10.10)
44
55
  mini_portile2 (~> 2.4.0)
45
56
  parallel (1.20.1)
@@ -48,6 +59,9 @@ GEM
48
59
  pry (0.13.1)
49
60
  coderay (~> 1.1)
50
61
  method_source (~> 1.0)
62
+ pry-byebug (3.10.1)
63
+ byebug (~> 11.0)
64
+ pry (>= 0.13, < 0.15)
51
65
  pry-doc (1.1.0)
52
66
  pry (~> 0.11)
53
67
  yard (~> 0.9.11)
@@ -70,6 +84,11 @@ GEM
70
84
  rainbow (3.0.0)
71
85
  rake (12.3.3)
72
86
  regexp_parser (2.0.0)
87
+ rest-client (2.1.0)
88
+ http-accept (>= 1.7.0, < 2.0)
89
+ http-cookie (>= 1.0.2, < 2.0)
90
+ mime-types (>= 1.16, < 4.0)
91
+ netrc (~> 0.8)
73
92
  rexml (3.2.4)
74
93
  rspec (3.10.0)
75
94
  rspec-core (~> 3.10.0)
@@ -110,6 +129,9 @@ GEM
110
129
  thor (1.0.1)
111
130
  tzinfo (2.0.3)
112
131
  concurrent-ruby (~> 1.0)
132
+ unf (0.1.4)
133
+ unf_ext
134
+ unf_ext (0.0.8.2)
113
135
  unicode-display_width (1.7.0)
114
136
  yard (0.9.25)
115
137
  zeitwerk (2.4.2)
@@ -119,6 +141,7 @@ PLATFORMS
119
141
 
120
142
  DEPENDENCIES
121
143
  pry
144
+ pry-byebug
122
145
  pry-doc
123
146
  pry-rails
124
147
  rake (~> 12.0)
@@ -1,3 +1,3 @@
1
1
  module YoutubeToRss
2
- VERSION = "0.1.2"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -1,32 +1,19 @@
1
1
  require 'youtube_to_rss/version'
2
+ require 'rest-client'
3
+ require 'nokogiri'
2
4
 
3
5
  module YoutubeToRss
4
6
  class Error < StandardError; end
5
7
 
6
8
  class << self
7
9
  def convert(url)
8
- url = remove_query_strings(url)
10
+ html = RestClient.get url
11
+ doc = Nokogiri::HTML(html).text
12
+ channel_id = doc.split('channel_id=').last.split('",').first
13
+ # channel_id = doc.split('"rssUrl":"https://www.youtube.com/feeds/videos.xml?channel_id=').last.split('",').first
9
14
  base_url = 'https://www.youtube.com/feeds/videos.xml?'
10
15
 
11
- if url.include?('/channel/')
12
- "#{base_url}channel_id=#{extract_param(url, '/channel/')}"
13
- elsif url.include?('/c/')
14
- "#{base_url}channel_id=#{extract_param(url, '/c/')}"
15
- elsif url.include?('/user/')
16
- "#{base_url}user=#{extract_param(url, '/user/')}"
17
- else
18
- raise 'URL should have "channel" or "c" or "user" param.'
19
- end
20
- end
21
-
22
- private
23
-
24
- def extract_param(url, param)
25
- url.split(param).last
26
- end
27
-
28
- def remove_query_strings(url)
29
- url.split('?').first.split('&').first
16
+ "#{base_url}channel_id=#{channel_id}"
30
17
  end
31
18
  end
32
19
  end
@@ -15,6 +15,8 @@ Gem::Specification.new do |spec|
15
15
  spec.metadata["homepage_uri"] = spec.homepage
16
16
  spec.metadata["source_code_uri"] = "https://github.com/ccozkan/youtube_to_rss"
17
17
 
18
+ spec.add_dependency "rest-client"
19
+
18
20
  # Specify which files should be added to the gem when it is released.
19
21
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
22
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youtube_to_rss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - C Çağrı Özkan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-12 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2023-02-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rest-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: ''
14
28
  email:
15
29
  - ccozkan@gmail.com