viddl-rb 0.63 → 0.64
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.
- data/plugins/youtube.rb +5 -4
- metadata +3 -3
data/plugins/youtube.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
class Youtube < PluginBase
|
|
2
3
|
#this will be called by the main app to check whether this plugin is responsible for the url passed
|
|
3
4
|
def self.matches_provider?(url)
|
|
@@ -9,7 +10,7 @@ class Youtube < PluginBase
|
|
|
9
10
|
#http://www.youtube.com/watch?v=9WEP5nCxkEY&videos=jKY836_WMhE&playnext_from=TL&playnext=1
|
|
10
11
|
#http://www.youtube.com/watch?v=Tk78sr5JMIU&videos=jKY836_WMhE
|
|
11
12
|
|
|
12
|
-
playlist_ID = url[/p=(\w{16})&?/,1]
|
|
13
|
+
playlist_ID = url[/(?:list=PL|p=)(\w{16})&?/,1]
|
|
13
14
|
puts "[YOUTUBE] Playlist ID: #{playlist_ID}"
|
|
14
15
|
url_array = Array.new
|
|
15
16
|
video_info = Nokogiri::HTML(open("http://gdata.youtube.com/feeds/api/playlists/#{playlist_ID}?v=2"))
|
|
@@ -24,16 +25,16 @@ class Youtube < PluginBase
|
|
|
24
25
|
|
|
25
26
|
def self.get_urls_and_filenames(url)
|
|
26
27
|
return_values = []
|
|
27
|
-
if url.include?("view_play_list")
|
|
28
|
+
if url.include?("view_play_list") || url.include?("playlist?list=")
|
|
28
29
|
puts "[YOUTUBE] playlist found! analyzing..."
|
|
29
30
|
files = self.parse_playlist(url)
|
|
30
31
|
puts "[YOUTUBE] Starting playlist download"
|
|
31
32
|
files.each do |file|
|
|
32
33
|
puts "[YOUTUBE] Downloading next movie on the playlist (#{file})"
|
|
33
|
-
return_values << self.grab_single_url_filename(
|
|
34
|
+
return_values << self.grab_single_url_filename(file)
|
|
34
35
|
end
|
|
35
36
|
else
|
|
36
|
-
|
|
37
|
+
return_values << self.grab_single_url_filename(url)
|
|
37
38
|
end
|
|
38
39
|
return_values
|
|
39
40
|
end
|
metadata
CHANGED