Sha256: b076e7ab6b063b0322ae22c89b319f53cf64b9214d65802a1c42cf335ed91481
Contents?: true
Size: 549 Bytes
Versions: 1
Compression:
Stored size: 549 Bytes
Contents
require 'youtube_to_rss/version' require 'rest-client' require 'nokogiri' module YoutubeToRss class Error < StandardError; end class << self def convert(url) html = RestClient.get url doc = Nokogiri::HTML(html).text channel_id = doc.split('channel_id=').last.split('",').first # channel_id = doc.split('"rssUrl":"https://www.youtube.com/feeds/videos.xml?channel_id=').last.split('",').first base_url = 'https://www.youtube.com/feeds/videos.xml?' "#{base_url}channel_id=#{channel_id}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
youtube_to_rss-0.3.2 | lib/youtube_to_rss.rb |