acts_as_unvlogable 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +2 -0
- data/.travis.yml +19 -0
- data/Gemfile +4 -9
- data/README.markdown +5 -29
- data/Rakefile +1 -1
- data/acts_as_unvlogable.gemspec +10 -8
- data/lib/acts_as_unvlogable.rb +63 -37
- data/lib/acts_as_unvlogable/flickr.rb +3 -487
- data/lib/acts_as_unvlogable/string_extend.rb +0 -1
- data/lib/acts_as_unvlogable/version.rb +1 -1
- data/lib/acts_as_unvlogable/vg_11870.rb +7 -18
- data/lib/acts_as_unvlogable/vg_blip.rb +4 -9
- data/lib/acts_as_unvlogable/vg_collegehumor.rb +8 -20
- data/lib/acts_as_unvlogable/vg_dailymotion.rb +3 -7
- data/lib/acts_as_unvlogable/vg_dalealplay.rb +7 -10
- data/lib/acts_as_unvlogable/vg_flickr.rb +2 -16
- data/lib/acts_as_unvlogable/vg_metacafe.rb +2 -21
- data/lib/acts_as_unvlogable/vg_myspace.rb +6 -12
- data/lib/acts_as_unvlogable/vg_pleer.rb +38 -0
- data/lib/acts_as_unvlogable/vg_rutube.rb +7 -51
- data/lib/acts_as_unvlogable/vg_ted.rb +8 -16
- data/lib/acts_as_unvlogable/vg_vimeo.rb +14 -22
- data/lib/acts_as_unvlogable/vg_wistia.rb +49 -0
- data/lib/acts_as_unvlogable/vg_youtu.rb +11 -0
- data/lib/acts_as_unvlogable/vg_youtube.rb +11 -22
- data/spec/acts_as_unvlogable_spec.rb +363 -0
- data/spec/spec_helper.rb +4 -0
- metadata +106 -108
- data/lib/acts_as_unvlogable/vg_marca.rb +0 -48
- data/lib/acts_as_unvlogable/vg_mtvmusic.rb +0 -65
- data/lib/acts_as_unvlogable/vg_qik.rb +0 -66
- data/test/acts_as_unvlogable_test.rb +0 -392
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,108 +1,115 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_unvlogable
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
version: 1.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
6
|
+
authors:
|
7
|
+
- Manuel Muñoz
|
14
8
|
- Fernando Blat
|
15
9
|
- Alberto Romero
|
16
10
|
autorequire:
|
17
11
|
bindir: bin
|
18
12
|
cert_chain: []
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :development
|
25
23
|
prerelease: false
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.3'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rake
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
29
33
|
- - ">="
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
|
32
|
-
segments:
|
33
|
-
- 0
|
34
|
-
version: "0"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
35
36
|
type: :development
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: ruby-debug
|
39
37
|
prerelease: false
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rspec
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
43
47
|
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
version: "0"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
49
50
|
type: :development
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: xml-simple
|
53
51
|
prerelease: false
|
54
|
-
|
55
|
-
|
56
|
-
requirements:
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
57
54
|
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: nokogiri
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
63
64
|
type: :runtime
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: youtube_it
|
67
65
|
prerelease: false
|
68
|
-
|
69
|
-
|
70
|
-
requirements:
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
71
68
|
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: xml-simple
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
77
78
|
type: :runtime
|
78
|
-
version_requirements: *id004
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
name: hpricot
|
81
79
|
prerelease: false
|
82
|
-
|
83
|
-
|
84
|
-
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: youtube_it
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
85
89
|
- - ">="
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
version: "0"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
91
92
|
type: :runtime
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
-
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
description: An easy way to include external video services in a rails app. This gem
|
100
|
+
provides you wrappers for the most common video services, such as Youtube, Vimeo,
|
101
|
+
Flickr, and so on...
|
102
|
+
email:
|
103
|
+
- mamuso@mamuso.net
|
96
104
|
- ferblape@gmail.com
|
97
105
|
- denegro@gmail.com
|
98
106
|
executables: []
|
99
|
-
|
100
107
|
extensions: []
|
101
|
-
|
102
108
|
extra_rdoc_files: []
|
103
|
-
|
104
|
-
|
105
|
-
- .gitignore
|
109
|
+
files:
|
110
|
+
- ".coveralls.yml"
|
111
|
+
- ".gitignore"
|
112
|
+
- ".travis.yml"
|
106
113
|
- Gemfile
|
107
114
|
- MIT-LICENSE
|
108
115
|
- README.markdown
|
@@ -120,50 +127,41 @@ files:
|
|
120
127
|
- lib/acts_as_unvlogable/vg_dailymotion.rb
|
121
128
|
- lib/acts_as_unvlogable/vg_dalealplay.rb
|
122
129
|
- lib/acts_as_unvlogable/vg_flickr.rb
|
123
|
-
- lib/acts_as_unvlogable/vg_marca.rb
|
124
130
|
- lib/acts_as_unvlogable/vg_metacafe.rb
|
125
|
-
- lib/acts_as_unvlogable/vg_mtvmusic.rb
|
126
131
|
- lib/acts_as_unvlogable/vg_myspace.rb
|
127
|
-
- lib/acts_as_unvlogable/
|
132
|
+
- lib/acts_as_unvlogable/vg_pleer.rb
|
128
133
|
- lib/acts_as_unvlogable/vg_rutube.rb
|
129
134
|
- lib/acts_as_unvlogable/vg_ted.rb
|
130
135
|
- lib/acts_as_unvlogable/vg_vimeo.rb
|
136
|
+
- lib/acts_as_unvlogable/vg_wistia.rb
|
137
|
+
- lib/acts_as_unvlogable/vg_youtu.rb
|
131
138
|
- lib/acts_as_unvlogable/vg_youtube.rb
|
132
|
-
-
|
139
|
+
- spec/acts_as_unvlogable_spec.rb
|
140
|
+
- spec/spec_helper.rb
|
133
141
|
- unvlogable_sample.yml
|
134
|
-
|
135
|
-
homepage: ""
|
142
|
+
homepage: https://github.com/mamuso/acts_as_unvlogable
|
136
143
|
licenses: []
|
137
|
-
|
144
|
+
metadata: {}
|
138
145
|
post_install_message:
|
139
146
|
rdoc_options: []
|
140
|
-
|
141
|
-
require_paths:
|
147
|
+
require_paths:
|
142
148
|
- lib
|
143
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
-
|
145
|
-
requirements:
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
146
151
|
- - ">="
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
version: "0"
|
152
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
|
-
requirements:
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
155
156
|
- - ">="
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
|
158
|
-
segments:
|
159
|
-
- 0
|
160
|
-
version: "0"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
161
159
|
requirements: []
|
162
|
-
|
163
160
|
rubyforge_project: acts_as_unvlogable
|
164
|
-
rubygems_version:
|
161
|
+
rubygems_version: 2.2.2
|
165
162
|
signing_key:
|
166
|
-
specification_version:
|
163
|
+
specification_version: 4
|
167
164
|
summary: An easy way to include external video services in a rails app
|
168
|
-
test_files:
|
169
|
-
|
165
|
+
test_files:
|
166
|
+
- spec/acts_as_unvlogable_spec.rb
|
167
|
+
- spec/spec_helper.rb
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# ----------------------------------------------
|
2
|
-
# Class for Marca.tv (www.marca.tv)
|
3
|
-
# http://www.marca.com/tv/?v=DN23wG8c1Rj
|
4
|
-
# ----------------------------------------------
|
5
|
-
|
6
|
-
|
7
|
-
class VgMarca
|
8
|
-
|
9
|
-
def initialize(url=nil, options={})
|
10
|
-
@url = url
|
11
|
-
@video_id = @url.query_param('v')
|
12
|
-
res = Net::HTTP.get(URI.parse("http://estaticos.marca.com/consolamultimedia/marcaTV/elementos/#{@video_id[0,1]}/#{@video_id[1,1]}/#{@video_id[2,100]}.xml"))
|
13
|
-
@feed = REXML::Document.new(res)
|
14
|
-
end
|
15
|
-
|
16
|
-
def title
|
17
|
-
REXML::XPath.first( @feed, "//titulo" )[0].to_s
|
18
|
-
end
|
19
|
-
|
20
|
-
def thumbnail
|
21
|
-
REXML::XPath.first( @feed, "//foto" )[0].to_s
|
22
|
-
end
|
23
|
-
|
24
|
-
def duration
|
25
|
-
nil
|
26
|
-
end
|
27
|
-
|
28
|
-
def embed_url
|
29
|
-
"http://www.marca.com/componentes/flash/embed.swf?ba=0&cvol=1&bt=1&lg=1&vID=#{@video_id}&ba=1"
|
30
|
-
end
|
31
|
-
|
32
|
-
def embed_html(width=425, height=344, options={})
|
33
|
-
"<embed width='#{width}' height='#{height}' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' allowfullscreen='true' quality='high' src='#{embed_url}'/>"
|
34
|
-
end
|
35
|
-
|
36
|
-
def flv
|
37
|
-
REXML::XPath.first(@feed, "//media")[0].to_s
|
38
|
-
end
|
39
|
-
|
40
|
-
def download_url
|
41
|
-
nil
|
42
|
-
end
|
43
|
-
|
44
|
-
def service
|
45
|
-
"Marca.tv"
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# ----------------------------------------------
|
2
|
-
# Class for MTV Music (www.mtvmusic.com)
|
3
|
-
# http://www.mtvmusic.com/astley_rick/videos/55086/never_gonna_give_you_up.jhtml
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# quite ugly, we know :(
|
7
|
-
# ----------------------------------------------
|
8
|
-
|
9
|
-
|
10
|
-
class VgMtvmusic
|
11
|
-
|
12
|
-
def initialize(url=nil, options={})
|
13
|
-
@url = url
|
14
|
-
@video_id = @url.query_param('id') || URI.parse(@url).path.split("/")[3]
|
15
|
-
@feed = nil
|
16
|
-
|
17
|
-
# veeeeeery ugly
|
18
|
-
page = Hpricot(open(url))
|
19
|
-
searchterms = page.search("//title").first.inner_html.split("Music Video")
|
20
|
-
res = Net::HTTP.get(URI.parse("http://api.mtvnservices.com/1/video/search/?term=#{searchterms[0].gsub(' ', '%20')}"))
|
21
|
-
search = REXML::Document.new(res)
|
22
|
-
entries = search.elements.to_a("//entry")
|
23
|
-
entries.each do |entry|
|
24
|
-
if REXML::XPath.first(entry, "media:content" ).attributes['url'] == "http://media.mtvnservices.com/mgid:uma:video:api.mtvnservices.com:#{@video_id}"
|
25
|
-
@feed = entry
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def title
|
31
|
-
REXML::XPath.first(@feed, "//entry/title")[0].to_s
|
32
|
-
end
|
33
|
-
|
34
|
-
def thumbnail
|
35
|
-
REXML::XPath.first(@feed, "//media:thumbnail").attributes['url']
|
36
|
-
end
|
37
|
-
|
38
|
-
def duration
|
39
|
-
nil
|
40
|
-
end
|
41
|
-
|
42
|
-
def embed_url
|
43
|
-
REXML::XPath.first(@feed, "//media:content[@type='application/x-shockwave-flash']").attributes['url']
|
44
|
-
end
|
45
|
-
|
46
|
-
def embed_html(width=425, height=344, options={})
|
47
|
-
"<embed src='#{embed_url}' width='#{width}' height='#{height}' type='application/x-shockwave-flash' flashVars='dist=http://www.mtvmusic.com' allowFullScreen='true' AllowScriptAccess='never'></embed>"
|
48
|
-
end
|
49
|
-
|
50
|
-
# this method fails depending on country restrictions
|
51
|
-
def flv
|
52
|
-
res = Net::HTTP.get(URI.parse("http://api-media.mtvnservices.com/player/embed/includes/mediaGen.jhtml?uri=mgid:uma:video:api.mtvnservices.com:#{@video_id}&vid=#{@video_id}&ref=#{CGI::escape "{ref}"}"))
|
53
|
-
search = REXML::Document.new(res)
|
54
|
-
REXML::XPath.first(search, "//rendition/src")[0]
|
55
|
-
end
|
56
|
-
|
57
|
-
def download_url
|
58
|
-
nil
|
59
|
-
end
|
60
|
-
|
61
|
-
def service
|
62
|
-
"MTV Music"
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
# ----------------------------------------------
|
2
|
-
# Class for Qik (qik.com)
|
3
|
-
# http://qik.com/video/340982
|
4
|
-
# ----------------------------------------------
|
5
|
-
|
6
|
-
|
7
|
-
class VgQik
|
8
|
-
|
9
|
-
def initialize(url=nil, options={})
|
10
|
-
@url = url
|
11
|
-
@video_id = parse_url(url)
|
12
|
-
@page = Hpricot(open("http://qik.com/video/#{@video_id}"))
|
13
|
-
emb = @page.search('//input[@value^="<object"]').first.attributes['value']
|
14
|
-
tx = Hpricot(emb)
|
15
|
-
@feed_url = CGI::parse(tx.search('//embed').first.attributes['flashvars'].to_s)["rssURL"].to_s
|
16
|
-
res = Net::HTTP.get(URI::parse(@feed_url))
|
17
|
-
@feed = REXML::Document.new(res)
|
18
|
-
end
|
19
|
-
|
20
|
-
def title
|
21
|
-
REXML::XPath.first(@feed, "//item/title")[0].to_s
|
22
|
-
end
|
23
|
-
|
24
|
-
def thumbnail
|
25
|
-
REXML::XPath.first(@feed, "//item/media:thumbnail").attributes['url']
|
26
|
-
end
|
27
|
-
|
28
|
-
def embed_url
|
29
|
-
"http://qik.com/swfs/qikPlayer4.swf?rssURL=#{@feed_url}&autoPlay=false"
|
30
|
-
end
|
31
|
-
|
32
|
-
def embed_html(width=425, height=344, options={})
|
33
|
-
"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='#{width}' height='#{height}' id='qikPlayer' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='allowFullScreen' value='true' /><param name='movie' value='#{embed_url}' /><param name='quality' value='high' /><param name='bgcolor' value='#333333' /><embed src='#{embed_url}' quality='high' bgcolor='#333333' width='#{width}' height='#{height}' name='qikPlayer' align='middle' allowScriptAccess='sameDomain' allowFullScreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/></object>"
|
34
|
-
end
|
35
|
-
|
36
|
-
def flv
|
37
|
-
REXML::XPath.first(@feed, "//item/media:content[@type='video/x-flv']").attributes['url']
|
38
|
-
end
|
39
|
-
|
40
|
-
def download_url
|
41
|
-
nil
|
42
|
-
end
|
43
|
-
|
44
|
-
def duration
|
45
|
-
nil
|
46
|
-
end
|
47
|
-
|
48
|
-
def service
|
49
|
-
"Qik"
|
50
|
-
end
|
51
|
-
|
52
|
-
protected
|
53
|
-
|
54
|
-
def parse_url(url)
|
55
|
-
video_id = nil
|
56
|
-
if url.split('#').size > 1
|
57
|
-
pieces = url.split(/#|=/)
|
58
|
-
hash = Hash[*pieces]
|
59
|
-
video_id = hash['v']
|
60
|
-
else
|
61
|
-
video_id = url.split("/")[4]
|
62
|
-
end
|
63
|
-
video_id
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|