viddl-rb 0.4.8 → 0.4.9

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.
Files changed (2) hide show
  1. data/plugins/youtube.rb +5 -1
  2. metadata +4 -4
@@ -1,7 +1,7 @@
1
1
  class Youtube < PluginBase
2
2
  #this will be called by the main app to check weather this plugin is responsible for the url passed
3
3
  def self.matches_provider?(url)
4
- url.include?("youtube.com")
4
+ url.include?("youtube.com") || url.include?("youtu.be")
5
5
  end
6
6
 
7
7
  def self.parse_playlist(url)
@@ -42,6 +42,10 @@ class Youtube < PluginBase
42
42
  #the youtube video ID looks like this: [...]v=abc5a5_afe5agae6g&[...], we only want the ID (the \w in the brackets)
43
43
  #addition: might also look like this /v/abc5-a5afe5agae6g
44
44
  # alternative: video_id = url[/v[\/=]([\w-]*)&?/, 1]
45
+ # First get the redirect
46
+ if url.include?("youtu.be")
47
+ url = open(url).base_uri.to_s
48
+ end
45
49
  video_id = url[/(v|embed)[\/=]([^\/\?\&]*)/,2]
46
50
  if video_id.nil?
47
51
  puts "no video id found."
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viddl-rb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 8
10
- version: 0.4.8
9
+ - 9
10
+ version: 0.4.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marc Seeger
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-11 00:00:00 Z
18
+ date: 2011-11-19 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: nokogiri