film_snob 0.5.0 → 0.6.0
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 +7 -0
- data/README.md +2 -1
- data/lib/film_snob/url_to_video.rb +2 -2
- data/lib/film_snob/version.rb +1 -1
- data/lib/film_snob/video_sites/soundcloud.rb +25 -0
- data/lib/film_snob/video_sites/youtube.rb +2 -1
- data/spec/cassettes/README.md +14 -0
- data/spec/film_snob/video_sites/coub_spec.rb +12 -0
- data/spec/film_snob/video_sites/dailymotion_spec.rb +46 -0
- data/spec/film_snob/video_sites/funny_or_die_spec.rb +13 -0
- data/spec/film_snob/video_sites/hulu_spec.rb +12 -0
- data/spec/film_snob/video_sites/instagram_spec.rb +37 -0
- data/spec/film_snob/video_sites/rutube_spec.rb +15 -0
- data/spec/film_snob/video_sites/soundcloud_spec.rb +77 -0
- data/spec/film_snob/video_sites/vimeo_spec.rb +60 -0
- data/spec/film_snob/video_sites/vine_spec.rb +12 -0
- data/spec/film_snob/video_sites/youtube_spec.rb +89 -0
- data/spec/film_snob_spec.rb +0 -256
- metadata +30 -41
- data/spec/cassettes/coub/.keep +0 -0
- data/spec/cassettes/dailymotion/.keep +0 -0
- data/spec/cassettes/funnyordie/.keep +0 -0
- data/spec/cassettes/hulu/.keep +0 -0
- data/spec/cassettes/instagram/.keep +0 -0
- data/spec/cassettes/vimeo/.keep +0 -0
- data/spec/cassettes/youtube/.keep +0 -0
- data/spec/youtube_spec.rb +0 -34
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0d25623cb6482f4fa057640866d3d67f3e3790e9
|
4
|
+
data.tar.gz: d8a94293134c774be9b5d03f5cbf7700495e839c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4e2b470cb53907fc13a45d7c92585665d94bb57768fa174007b174cfdb8b2f8c20c0a5bed91ff76c1be36015dc5fcb4e10f5d073bc2f25f517786d8d8994d31d
|
7
|
+
data.tar.gz: 2969e632372c1e9b11a43654f3df7c08c799415292d01691253de28a5e598c971a1f629f0317f7e9d4df42b26650e3b7d2786989c1b41a7f7607371220cf923f
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ film.html #=> "<iframe src=\"//player.vimeo.com/video/64683454\" width=\"720\"
|
|
42
42
|
|
43
43
|
film_snob uses the oembed protocol to get html for embed codes. These options assume some knowledge of the endpoint's API. The above vimeo example works because they [have an extensively documented API](http://developer.vimeo.com/apis/oembed) which allows tons of configuration. The other two don't seem to have any documentation or configuration at all.
|
44
44
|
|
45
|
-
## Supported
|
45
|
+
## Supported Sites
|
46
46
|
|
47
47
|
* YouTube
|
48
48
|
* Vimeo
|
@@ -53,6 +53,7 @@ film_snob uses the oembed protocol to get html for embed codes. These options as
|
|
53
53
|
* Dailymotion
|
54
54
|
* Vine
|
55
55
|
* Rutube
|
56
|
+
* Soundcloud
|
56
57
|
|
57
58
|
The same methods work with all of these providers.
|
58
59
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
Dir
|
2
|
-
require
|
1
|
+
Dir[File.join(File.dirname(__FILE__), "video_sites", "*.rb")].each do |file|
|
2
|
+
require file
|
3
3
|
end
|
4
4
|
|
5
5
|
class FilmSnob
|
data/lib/film_snob/version.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
require "film_snob/video_site"
|
2
|
+
|
3
|
+
class FilmSnob
|
4
|
+
class Soundcloud < VideoSite
|
5
|
+
def initialize(url, options = {})
|
6
|
+
super(url, options.merge(format: :json))
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.valid_url_patterns
|
10
|
+
[
|
11
|
+
%r{https?://soundcloud.com/([^/]+/[^?]+)},
|
12
|
+
%r{https?://m.soundcloud.com/([^/]+/[^?]+)}
|
13
|
+
]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.oembed_endpoint
|
17
|
+
"https://soundcloud.com/oembed"
|
18
|
+
end
|
19
|
+
|
20
|
+
def clean_url
|
21
|
+
@clean_url ||= "https://soundcloud.com/#{id}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -8,7 +8,8 @@ class FilmSnob
|
|
8
8
|
https?://(?:(?:www|m).)?youtube.com/watch\?
|
9
9
|
(?:feature=[\w\.]+&)?v=([\w\d\-_]+)
|
10
10
|
}x,
|
11
|
-
%r{https?://(?:(?:www|m).)?youtu.be/([\w\d\-_]+)}
|
11
|
+
%r{https?://(?:(?:www|m).)?youtu.be/([\w\d\-_]+)},
|
12
|
+
%r{https?://(?:(?:www|m).)?youtube.com/v/([\w\d\-_]+)}
|
12
13
|
]
|
13
14
|
end
|
14
15
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# What is this folder?
|
2
|
+
|
3
|
+
When running the tests, film snob will make a bunch of web requests to the
|
4
|
+
various supported oembed endpoints. film snob uses [vcr][] to save the responses
|
5
|
+
from those requests in this folder, so it doesn't need to make those requests
|
6
|
+
more than once on any given machine; on the second run it will notice it has a
|
7
|
+
cassette (really just a big yml file) and read that instead of going out to the
|
8
|
+
web again.
|
9
|
+
|
10
|
+
[vcr]: https://github.com/vcr/vcr
|
11
|
+
|
12
|
+
If tests suddenly start failing, it might mean that an example video has been
|
13
|
+
deleted. In that case, I guess we'll just swap out for a different video.
|
14
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
describe FilmSnob::Coub do
|
2
|
+
it "should parse coub URLs" do
|
3
|
+
film = FilmSnob.new("http://coub.com/view/rcd14cm")
|
4
|
+
expect(film.id).to eq "rcd14cm"
|
5
|
+
expect(film.site).to eq :coub
|
6
|
+
VCR.use_cassette "coub/voodoo_people" do
|
7
|
+
expect(film.title).to eq "voodoo people"
|
8
|
+
expect { film.html }.not_to raise_error
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
describe FilmSnob::Dailymotion do
|
2
|
+
it "should parse https dailymotion URLs" do
|
3
|
+
url = "https://www.dailymotion.com/video/xf02xp_uffie-difficult_music"
|
4
|
+
snob = FilmSnob.new(url)
|
5
|
+
expect(snob.id).to eq "xf02xp_uffie-difficult_music"
|
6
|
+
expect(snob.site).to eq :dailymotion
|
7
|
+
VCR.use_cassette("dailymotion/music") do
|
8
|
+
expect(snob.title).to eq "Uffie - Difficult"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should parse http dailymotion URLs" do
|
13
|
+
url = "http://www.dailymotion.com/video/xf02xp_uffie-difficult_music"
|
14
|
+
snob = FilmSnob.new(url)
|
15
|
+
expect(snob.id).to eq "xf02xp_uffie-difficult_music"
|
16
|
+
expect(snob.site).to eq :dailymotion
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should parse mobile dailymotion URLs" do
|
20
|
+
url = "http://touch.dailymotion.com/video/xf02xp_uffie-difficult_music"
|
21
|
+
clean = "https://www.dailymotion.com/video/xf02xp_uffie-difficult_music"
|
22
|
+
snob = FilmSnob.new(url)
|
23
|
+
expect(snob.id).to eq "xf02xp_uffie-difficult_music"
|
24
|
+
expect(snob.site).to eq :dailymotion
|
25
|
+
expect(snob.clean_url).to eq clean
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should allow oembed configuration" do
|
29
|
+
snob = FilmSnob.new(
|
30
|
+
"http://www.dailymotion.com/video/xf02xp_uffie-difficult_music",
|
31
|
+
maxwidth: 400
|
32
|
+
)
|
33
|
+
VCR.use_cassette("dailymotion/music1") do
|
34
|
+
expect(snob.html).to match(/width="400"/)
|
35
|
+
end
|
36
|
+
|
37
|
+
snob2 = FilmSnob.new(
|
38
|
+
"http://www.dailymotion.com/video/xf02xp_uffie-difficult_music",
|
39
|
+
maxwidth: 500
|
40
|
+
)
|
41
|
+
VCR.use_cassette("dailymotion/music500") do
|
42
|
+
expect(snob2.html).to match(/width="500"/)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
describe FilmSnob::FunnyOrDie do
|
2
|
+
it "should parse funny or die URLs" do
|
3
|
+
film = FilmSnob.new("http://www.funnyordie.com/videos/8db066d2e0/" \
|
4
|
+
"the-live-read-of-space-jam-with-blake-griffin")
|
5
|
+
expect(film.id).to eq "8db066d2e0"
|
6
|
+
expect(film.site).to eq :funnyordie
|
7
|
+
VCR.use_cassette "funnyordie/space jam" do
|
8
|
+
expect(film.title).to eq "The Live Read of Space Jam with Blake Griffin"
|
9
|
+
expect { film.html }.not_to raise_error
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
describe FilmSnob::Hulu do
|
2
|
+
it "should parse hulu URLs" do
|
3
|
+
snob = FilmSnob.new("http://www.hulu.com/watch/285095")
|
4
|
+
expect(snob.id).to eq "285095"
|
5
|
+
expect(snob.site).to eq :hulu
|
6
|
+
VCR.use_cassette("hulu/harmon") do
|
7
|
+
expect(snob.title).to eq "Remedial Chaos Theory (Community)"
|
8
|
+
expect { snob.html }.not_to raise_error
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
describe FilmSnob::Instagram do
|
2
|
+
it "should parse normal instagram URLs" do
|
3
|
+
film = FilmSnob.new("http://instagram.com/p/oBkLq7hnDP/")
|
4
|
+
expect(film.id).to eq "oBkLq7hnDP"
|
5
|
+
expect(film.site).to eq :instagram
|
6
|
+
VCR.use_cassette "instagram/sphynx cat" do
|
7
|
+
expect(film.title).to match "Very stupid package!"
|
8
|
+
expect { film.html }.not_to raise_error
|
9
|
+
end
|
10
|
+
end
|
11
|
+
it "should handle https urls" do
|
12
|
+
film = FilmSnob.new("https://instagram.com/p/otxnbOocqJ/")
|
13
|
+
expect(film).to be_embeddable
|
14
|
+
expect(film.site).to eq :instagram
|
15
|
+
expect(film.id).to eq "otxnbOocqJ"
|
16
|
+
end
|
17
|
+
it "should handle instagr.am urls" do
|
18
|
+
film = FilmSnob.new("http://instagr.am/p/otxnbOocqJ/")
|
19
|
+
expect(film).to be_embeddable
|
20
|
+
expect(film.site).to eq :instagram
|
21
|
+
expect(film.id).to eq "otxnbOocqJ"
|
22
|
+
end
|
23
|
+
it "should handle https instagr.am urls" do
|
24
|
+
film = FilmSnob.new("https://instagr.am/p/otxnbOocqJ/")
|
25
|
+
expect(film).to be_embeddable
|
26
|
+
expect(film.site).to eq :instagram
|
27
|
+
expect(film.id).to eq "otxnbOocqJ"
|
28
|
+
end
|
29
|
+
it "should raise error when the URL is not embeddable" do
|
30
|
+
film = FilmSnob.new("http://instagram.com/p/nothinghere/")
|
31
|
+
VCR.use_cassette "instagram/nothing" do
|
32
|
+
expect { film.html }.to raise_error FilmSnob::NotEmbeddableError
|
33
|
+
expect { film.title }.to raise_error FilmSnob::NotEmbeddableError
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
|
3
|
+
describe FilmSnob::Rutube do
|
4
|
+
it "should parse rutube URLs" do
|
5
|
+
url = "http://rutube.ru/video/586afc0f5c652439a2dca8b34d19a086/"
|
6
|
+
film = FilmSnob.new(url)
|
7
|
+
expect(film.id).to eq "586afc0f5c652439a2dca8b34d19a086"
|
8
|
+
expect(film.site).to eq :rutube
|
9
|
+
VCR.use_cassette "rutube/rabbit_eat_raspberry" do
|
10
|
+
expect(film.title).to eq "Кролик ест малину"
|
11
|
+
expect { film.html }.not_to raise_error
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,77 @@
|
|
1
|
+
describe FilmSnob::Soundcloud do
|
2
|
+
|
3
|
+
it "should parse normal Soundcloud URLs" do
|
4
|
+
snob = FilmSnob.new(
|
5
|
+
"https://soundcloud.com/theweeknd/the-weeknd-king-of-the-fall"
|
6
|
+
)
|
7
|
+
expect(snob).to be_embeddable
|
8
|
+
expect(snob.id).to eq "theweeknd/the-weeknd-king-of-the-fall"
|
9
|
+
expect(snob.site).to eq :soundcloud
|
10
|
+
VCR.use_cassette("soundcloud/theweeknd") do
|
11
|
+
expect(snob.title).to eq "The Weeknd - King Of The Fall by The Weeknd"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should parse http url patterns" do
|
16
|
+
snob = FilmSnob.new(
|
17
|
+
"http://soundcloud.com/theweeknd/the-weeknd-king-of-the-fall"
|
18
|
+
)
|
19
|
+
expect(snob).to be_embeddable
|
20
|
+
expect(snob.id).to eq "theweeknd/the-weeknd-king-of-the-fall"
|
21
|
+
expect(snob.site).to eq :soundcloud
|
22
|
+
VCR.use_cassette("soundcloud/theweeknd-http") do
|
23
|
+
expect(snob.title).to eq "The Weeknd - King Of The Fall by The Weeknd"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should parse mobile URL patterns" do
|
28
|
+
snob = FilmSnob.new(
|
29
|
+
"https://m.soundcloud.com/theweeknd/the-weeknd-king-of-the-fall"
|
30
|
+
)
|
31
|
+
expect(snob).to be_embeddable
|
32
|
+
expect(snob.id).to eq "theweeknd/the-weeknd-king-of-the-fall"
|
33
|
+
expect(snob.site).to eq :soundcloud
|
34
|
+
VCR.use_cassette("soundcloud/theweeknd-mobile") do
|
35
|
+
expect(snob.title).to eq "The Weeknd - King Of The Fall by The Weeknd"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should not parse a page that does not contain an embedded song" do
|
40
|
+
snob = FilmSnob.new("https://soundcloud.com/david_rees")
|
41
|
+
expect(snob).to_not be_embeddable
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should parse an ID from an extended URI" do
|
45
|
+
snob = FilmSnob.new(
|
46
|
+
"https://soundcloud.com/coxncrendor/youtube-rewind?utm_source=feedburner"
|
47
|
+
)
|
48
|
+
expect(snob).to be_embeddable
|
49
|
+
expect(snob.id).to eq "coxncrendor/youtube-rewind"
|
50
|
+
end
|
51
|
+
|
52
|
+
context "with oembed configuration" do
|
53
|
+
|
54
|
+
it "should allow user to set the iframe width" do
|
55
|
+
snob = FilmSnob.new(
|
56
|
+
"https://soundcloud.com/theweeknd/the-weeknd-king-of-the-fall",
|
57
|
+
maxwidth: 500
|
58
|
+
)
|
59
|
+
VCR.use_cassette("soundcloud/maxwidth") do
|
60
|
+
expect(snob.html).to match(/width="500"/)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should allow user to set autoplay" do
|
65
|
+
snob = FilmSnob.new(
|
66
|
+
"https://soundcloud.com/theweeknd/the-weeknd-king-of-the-fall",
|
67
|
+
auto_play: true
|
68
|
+
)
|
69
|
+
VCR.use_cassette("soundcloud/autoplay") do
|
70
|
+
expect(snob.html).to match(/auto_play=true/)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
describe FilmSnob::Vimeo do
|
2
|
+
it "should parse https vimeo URLs" do
|
3
|
+
snob = FilmSnob.new("https://vimeo.com/16010689")
|
4
|
+
expect(snob.id).to eq "16010689"
|
5
|
+
expect(snob.site).to eq :vimeo
|
6
|
+
VCR.use_cassette("vimeo/stephen") do
|
7
|
+
expect(snob.title).to eq "Days Like Today"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should parse http vimeo URLs" do
|
12
|
+
snob = FilmSnob.new("http://vimeo.com/16010689")
|
13
|
+
expect(snob.id).to eq "16010689"
|
14
|
+
expect(snob.site).to eq :vimeo
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should parse mobile vimeo URLs" do
|
18
|
+
snob = FilmSnob.new("http://vimeo.com/m/16010689")
|
19
|
+
expect(snob.id).to eq "16010689"
|
20
|
+
expect(snob.site).to eq :vimeo
|
21
|
+
expect(snob.clean_url).to eq "https://vimeo.com/16010689"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should parse staff picks vimeo URLs" do
|
25
|
+
snob = FilmSnob.new("http://vimeo.com/channels/staffpicks/58511112")
|
26
|
+
expect(snob.id).to eq "58511112"
|
27
|
+
expect(snob.site).to eq :vimeo
|
28
|
+
expect(snob.clean_url).to eq "https://vimeo.com/58511112"
|
29
|
+
VCR.use_cassette("vimeo/staff") do
|
30
|
+
expect(snob.title).to eq "DANGER ISLAND"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should parse couchmode vimeo URLs" do
|
35
|
+
url = "https://vimeo.com/couchmode/staffpicks/sort:date/91157088"
|
36
|
+
snob = FilmSnob.new(url)
|
37
|
+
expect(snob.id).to eq "91157088"
|
38
|
+
expect(snob.site).to eq :vimeo
|
39
|
+
expect(snob.clean_url).to eq "https://vimeo.com/91157088"
|
40
|
+
|
41
|
+
url2 = "https://vimeo.com/couchmode/watchlater/sort:date/51020067"
|
42
|
+
snob2 = FilmSnob.new(url2)
|
43
|
+
expect(snob2.id).to eq "51020067"
|
44
|
+
expect(snob2.site).to eq :vimeo
|
45
|
+
expect(snob2.clean_url).to eq "https://vimeo.com/51020067"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should allow oembed configuration" do
|
49
|
+
snob = FilmSnob.new("http://vimeo.com/31158841", width: 400)
|
50
|
+
VCR.use_cassette("vimeo/murmuration") do
|
51
|
+
expect(snob.html).to match(/width="400"/)
|
52
|
+
end
|
53
|
+
|
54
|
+
snob2 = FilmSnob.new("http://vimeo.com/31158841", width: 500)
|
55
|
+
VCR.use_cassette("vimeo/murmuration2") do
|
56
|
+
expect(snob2.html).to match(/width="500"/)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
describe FilmSnob::Vine do
|
2
|
+
it "should parse URLs" do
|
3
|
+
film = FilmSnob.new("https://vine.co/v/1")
|
4
|
+
expect(film.id).to eq "1"
|
5
|
+
expect(film.site).to eq :vine
|
6
|
+
VCR.use_cassette "vine/dom hofman" do
|
7
|
+
expect(film.title).to eq "Dom Hofmann's post on Vine"
|
8
|
+
expect { film.html }.not_to raise_error
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
describe FilmSnob::YouTube do
|
2
|
+
it "should parse normal YouTube URLs" do
|
3
|
+
snob = FilmSnob.new("https://www.youtube.com/watch?v=7q5Ltr0qc8c")
|
4
|
+
expect(snob).to be_embeddable
|
5
|
+
expect(snob.id).to eq "7q5Ltr0qc8c"
|
6
|
+
expect(snob.site).to eq :youtube
|
7
|
+
VCR.use_cassette("youtube/billy") do
|
8
|
+
expect(snob.title).to eq "Billy on the Street: Amateur Speed Sketching!"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should parse YouTube URLs with dashes" do
|
13
|
+
snob = FilmSnob.new("https://www.youtube.com/watch?v=xa-KBqOFgDQ")
|
14
|
+
expect(snob).to be_embeddable
|
15
|
+
expect(snob.id).to eq "xa-KBqOFgDQ"
|
16
|
+
expect(snob.site).to eq :youtube
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should parse YouTube URLs with underscores" do
|
20
|
+
# first video I could find with an underscore
|
21
|
+
snob = FilmSnob.new("https://www.youtube.com/watch?v=HPR3PB_VGVs")
|
22
|
+
expect(snob).to be_embeddable
|
23
|
+
expect(snob.id).to eq "HPR3PB_VGVs"
|
24
|
+
expect(snob.site).to eq :youtube
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should parse mobile YouTube URLs" do
|
28
|
+
url = "https://m.youtube.com/watch?v=6dyeFalOjw0&feature=youtu.be"
|
29
|
+
snob = FilmSnob.new(url)
|
30
|
+
expect(snob.id).to eq "6dyeFalOjw0"
|
31
|
+
expect(snob.site).to eq :youtube
|
32
|
+
expect(snob.clean_url).to eq "https://www.youtube.com/watch?v=6dyeFalOjw0"
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should parse short YouTube URLs" do
|
36
|
+
snob = FilmSnob.new("http://youtu.be/1Ee4bfu_t3c")
|
37
|
+
expect(snob.id).to eq "1Ee4bfu_t3c"
|
38
|
+
expect(snob.site).to eq :youtube
|
39
|
+
expect(snob.clean_url).to eq "https://www.youtube.com/watch?v=1Ee4bfu_t3c"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should raise a not embeddable error for a missing video URL" do
|
43
|
+
VCR.use_cassette("youtube/missing video") do
|
44
|
+
snob = FilmSnob.new("https://youtube.com/watch?v=malformedid")
|
45
|
+
expect { snob.title }.to raise_error(FilmSnob::NotEmbeddableError)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it "may not be embeddable" do
|
50
|
+
VCR.use_cassette("youtube/bad_youtube_url") do
|
51
|
+
snob = FilmSnob.new("http://youtube.com/watch?v=malformedid")
|
52
|
+
expect { snob.html }.to raise_error(FilmSnob::NotEmbeddableError)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it "can handle junked up URLs" do
|
57
|
+
VCR.use_cassette("youtube/pete") do
|
58
|
+
url = "http://www.youtube.com/watch?feature=youtube_gdata&v=fq-xGD_thXo"
|
59
|
+
title = "Pete Meets Olympic Freestyle Skier Torin Yater-Wallace"
|
60
|
+
film = FilmSnob.new(url)
|
61
|
+
expect(film).to be_embeddable
|
62
|
+
expect(film.id).to eq "fq-xGD_thXo"
|
63
|
+
expect { film.html }.to_not raise_error
|
64
|
+
expect(film.title).to eq title
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
it "can handle even more junked up URLs" do
|
69
|
+
VCR.use_cassette("youtube/dilla") do
|
70
|
+
url = "http://www.youtube.com/watch?feature=youtu.be&v=lC0JFXw_6kQ"
|
71
|
+
title = "BINKBEATS Beats Unraveled #6: J. Dilla Live Mixtape"
|
72
|
+
film = FilmSnob.new(url)
|
73
|
+
|
74
|
+
expect(film).to be_embeddable
|
75
|
+
expect(film.id).to eq "lC0JFXw_6kQ"
|
76
|
+
expect { film.html }.to_not raise_error
|
77
|
+
expect(film.title).to eq title
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# I forget where I even saw this URL. I think in my RSS reader.
|
82
|
+
it "should parse direct embed URLs" do
|
83
|
+
snob = FilmSnob.new("https://www.youtube.com/v/sLSFOCyNC8Q")
|
84
|
+
expect(snob.id).to eq "sLSFOCyNC8Q"
|
85
|
+
expect(snob.site).to eq :youtube
|
86
|
+
expect(snob.clean_url).to eq "https://www.youtube.com/watch?v=sLSFOCyNC8Q"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
data/spec/film_snob_spec.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# Encoding: utf-8
|
2
|
-
|
3
1
|
describe FilmSnob do
|
4
2
|
describe "not supported URLs" do
|
5
3
|
it "should handle non-supported URLs gracefully" do
|
@@ -13,259 +11,5 @@ describe FilmSnob do
|
|
13
11
|
expect { snob.id }.to raise_error(FilmSnob::NotSupportedURLError)
|
14
12
|
end
|
15
13
|
end
|
16
|
-
|
17
|
-
describe "YouTube URLs" do
|
18
|
-
it "should parse normal YouTube URLs" do
|
19
|
-
snob = FilmSnob.new("https://www.youtube.com/watch?v=7q5Ltr0qc8c")
|
20
|
-
expect(snob).to be_embeddable
|
21
|
-
expect(snob.id).to eq "7q5Ltr0qc8c"
|
22
|
-
expect(snob.site).to eq :youtube
|
23
|
-
VCR.use_cassette("youtube/billy") do
|
24
|
-
expect(snob.title).to eq "Billy on the Street: Amateur Speed Sketching!"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should parse YouTube URLs with dashes" do
|
29
|
-
snob = FilmSnob.new("https://www.youtube.com/watch?v=xa-KBqOFgDQ")
|
30
|
-
expect(snob).to be_embeddable
|
31
|
-
expect(snob.id).to eq "xa-KBqOFgDQ"
|
32
|
-
expect(snob.site).to eq :youtube
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should parse YouTube URLs with underscores" do
|
36
|
-
# first video I could find with an underscore
|
37
|
-
snob = FilmSnob.new("https://www.youtube.com/watch?v=HPR3PB_VGVs")
|
38
|
-
expect(snob).to be_embeddable
|
39
|
-
expect(snob.id).to eq "HPR3PB_VGVs"
|
40
|
-
expect(snob.site).to eq :youtube
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should parse mobile YouTube URLs" do
|
44
|
-
url = "https://m.youtube.com/watch?v=6dyeFalOjw0&feature=youtu.be"
|
45
|
-
snob = FilmSnob.new(url)
|
46
|
-
expect(snob.id).to eq "6dyeFalOjw0"
|
47
|
-
expect(snob.site).to eq :youtube
|
48
|
-
expect(snob.clean_url).to eq "https://www.youtube.com/watch?v=6dyeFalOjw0"
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should parse short YouTube URLs" do
|
52
|
-
snob = FilmSnob.new("http://youtu.be/1Ee4bfu_t3c")
|
53
|
-
expect(snob.id).to eq "1Ee4bfu_t3c"
|
54
|
-
expect(snob.site).to eq :youtube
|
55
|
-
expect(snob.clean_url).to eq "https://www.youtube.com/watch?v=1Ee4bfu_t3c"
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should raise a not embeddable error for a missing video URL" do
|
59
|
-
VCR.use_cassette("youtube/missing video") do
|
60
|
-
snob = FilmSnob.new("https://youtube.com/watch?v=malformedid")
|
61
|
-
expect { snob.title }.to raise_error(FilmSnob::NotEmbeddableError)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe "vimeo URLs" do
|
67
|
-
it "should parse https vimeo URLs" do
|
68
|
-
snob = FilmSnob.new("https://vimeo.com/16010689")
|
69
|
-
expect(snob.id).to eq "16010689"
|
70
|
-
expect(snob.site).to eq :vimeo
|
71
|
-
VCR.use_cassette("vimeo/stephen") do
|
72
|
-
expect(snob.title).to eq "Days Like Today"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should parse http vimeo URLs" do
|
77
|
-
snob = FilmSnob.new("http://vimeo.com/16010689")
|
78
|
-
expect(snob.id).to eq "16010689"
|
79
|
-
expect(snob.site).to eq :vimeo
|
80
|
-
end
|
81
|
-
|
82
|
-
it "should parse mobile vimeo URLs" do
|
83
|
-
snob = FilmSnob.new("http://vimeo.com/m/16010689")
|
84
|
-
expect(snob.id).to eq "16010689"
|
85
|
-
expect(snob.site).to eq :vimeo
|
86
|
-
expect(snob.clean_url).to eq "https://vimeo.com/16010689"
|
87
|
-
end
|
88
|
-
|
89
|
-
it "should parse staff picks vimeo URLs" do
|
90
|
-
snob = FilmSnob.new("http://vimeo.com/channels/staffpicks/58511112")
|
91
|
-
expect(snob.id).to eq "58511112"
|
92
|
-
expect(snob.site).to eq :vimeo
|
93
|
-
expect(snob.clean_url).to eq "https://vimeo.com/58511112"
|
94
|
-
VCR.use_cassette("vimeo/staff") do
|
95
|
-
expect(snob.title).to eq "DANGER ISLAND"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
it "should parse couchmode vimeo URLs" do
|
100
|
-
url = "https://vimeo.com/couchmode/staffpicks/sort:date/91157088"
|
101
|
-
snob = FilmSnob.new(url)
|
102
|
-
expect(snob.id).to eq "91157088"
|
103
|
-
expect(snob.site).to eq :vimeo
|
104
|
-
expect(snob.clean_url).to eq "https://vimeo.com/91157088"
|
105
|
-
|
106
|
-
url2 = "https://vimeo.com/couchmode/watchlater/sort:date/51020067"
|
107
|
-
snob2 = FilmSnob.new(url2)
|
108
|
-
expect(snob2.id).to eq "51020067"
|
109
|
-
expect(snob2.site).to eq :vimeo
|
110
|
-
expect(snob2.clean_url).to eq "https://vimeo.com/51020067"
|
111
|
-
end
|
112
|
-
|
113
|
-
it "should allow oembed configuration" do
|
114
|
-
snob = FilmSnob.new("http://vimeo.com/31158841", width: 400)
|
115
|
-
VCR.use_cassette("vimeo/murmuration") do
|
116
|
-
expect(snob.html).to match(/width="400"/)
|
117
|
-
end
|
118
|
-
|
119
|
-
snob2 = FilmSnob.new("http://vimeo.com/31158841", width: 500)
|
120
|
-
VCR.use_cassette("vimeo/murmuration2") do
|
121
|
-
expect(snob2.html).to match(/width="500"/)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
describe "dailymotion URLs" do
|
127
|
-
it "should parse https dailymotion URLs" do
|
128
|
-
url = "https://www.dailymotion.com/video/xf02xp_uffie-difficult_music"
|
129
|
-
snob = FilmSnob.new(url)
|
130
|
-
expect(snob.id).to eq "xf02xp_uffie-difficult_music"
|
131
|
-
expect(snob.site).to eq :dailymotion
|
132
|
-
VCR.use_cassette("dailymotion/music") do
|
133
|
-
expect(snob.title).to eq "Uffie - Difficult"
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
it "should parse http dailymotion URLs" do
|
138
|
-
url = "http://www.dailymotion.com/video/xf02xp_uffie-difficult_music"
|
139
|
-
snob = FilmSnob.new(url)
|
140
|
-
expect(snob.id).to eq "xf02xp_uffie-difficult_music"
|
141
|
-
expect(snob.site).to eq :dailymotion
|
142
|
-
end
|
143
|
-
|
144
|
-
it "should parse mobile dailymotion URLs" do
|
145
|
-
url = "http://touch.dailymotion.com/video/xf02xp_uffie-difficult_music"
|
146
|
-
clean = "https://www.dailymotion.com/video/xf02xp_uffie-difficult_music"
|
147
|
-
snob = FilmSnob.new(url)
|
148
|
-
expect(snob.id).to eq "xf02xp_uffie-difficult_music"
|
149
|
-
expect(snob.site).to eq :dailymotion
|
150
|
-
expect(snob.clean_url).to eq clean
|
151
|
-
end
|
152
|
-
|
153
|
-
it "should allow oembed configuration" do
|
154
|
-
snob = FilmSnob.new(
|
155
|
-
"http://www.dailymotion.com/video/xf02xp_uffie-difficult_music",
|
156
|
-
maxwidth: 400
|
157
|
-
)
|
158
|
-
VCR.use_cassette("dailymotion/music1") do
|
159
|
-
expect(snob.html).to match(/width="400"/)
|
160
|
-
end
|
161
|
-
|
162
|
-
snob2 = FilmSnob.new(
|
163
|
-
"http://www.dailymotion.com/video/xf02xp_uffie-difficult_music",
|
164
|
-
maxwidth: 500
|
165
|
-
)
|
166
|
-
VCR.use_cassette("dailymotion/music500") do
|
167
|
-
expect(snob2.html).to match(/width="500"/)
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
describe "hulu URLs" do
|
173
|
-
it "should parse hulu URLs" do
|
174
|
-
snob = FilmSnob.new("http://www.hulu.com/watch/285095")
|
175
|
-
expect(snob.id).to eq "285095"
|
176
|
-
expect(snob.site).to eq :hulu
|
177
|
-
VCR.use_cassette("hulu/harmon") do
|
178
|
-
expect(snob.title).to eq "Remedial Chaos Theory (Community)"
|
179
|
-
expect { snob.html }.not_to raise_error
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
describe "funny or die URLs" do
|
185
|
-
it "should parse funny or die URLs" do
|
186
|
-
film = FilmSnob.new("http://www.funnyordie.com/videos/8db066d2e0/" \
|
187
|
-
"the-live-read-of-space-jam-with-blake-griffin")
|
188
|
-
expect(film.id).to eq "8db066d2e0"
|
189
|
-
expect(film.site).to eq :funnyordie
|
190
|
-
VCR.use_cassette "funnyordie/space jam" do
|
191
|
-
expect(film.title).to eq "The Live Read of Space Jam with Blake Griffin"
|
192
|
-
expect { film.html }.not_to raise_error
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
describe "instagram URLs" do
|
198
|
-
it "should parse normal instagram URLs" do
|
199
|
-
film = FilmSnob.new("http://instagram.com/p/oBkLq7hnDP/")
|
200
|
-
expect(film.id).to eq "oBkLq7hnDP"
|
201
|
-
expect(film.site).to eq :instagram
|
202
|
-
VCR.use_cassette "instagram/sphynx cat" do
|
203
|
-
expect(film.title).to match "Very stupid package!"
|
204
|
-
expect { film.html }.not_to raise_error
|
205
|
-
end
|
206
|
-
end
|
207
|
-
it "should handle https urls" do
|
208
|
-
film = FilmSnob.new("https://instagram.com/p/otxnbOocqJ/")
|
209
|
-
expect(film).to be_embeddable
|
210
|
-
expect(film.site).to eq :instagram
|
211
|
-
expect(film.id).to eq "otxnbOocqJ"
|
212
|
-
end
|
213
|
-
it "should handle instagr.am urls" do
|
214
|
-
film = FilmSnob.new("http://instagr.am/p/otxnbOocqJ/")
|
215
|
-
expect(film).to be_embeddable
|
216
|
-
expect(film.site).to eq :instagram
|
217
|
-
expect(film.id).to eq "otxnbOocqJ"
|
218
|
-
end
|
219
|
-
it "should handle https instagr.am urls" do
|
220
|
-
film = FilmSnob.new("https://instagr.am/p/otxnbOocqJ/")
|
221
|
-
expect(film).to be_embeddable
|
222
|
-
expect(film.site).to eq :instagram
|
223
|
-
expect(film.id).to eq "otxnbOocqJ"
|
224
|
-
end
|
225
|
-
it "should raise error when the URL is not embeddable" do
|
226
|
-
film = FilmSnob.new("http://instagram.com/p/nothinghere/")
|
227
|
-
VCR.use_cassette "instagram/nothing" do
|
228
|
-
expect { film.html }.to raise_error FilmSnob::NotEmbeddableError
|
229
|
-
expect { film.title }.to raise_error FilmSnob::NotEmbeddableError
|
230
|
-
end
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
describe "coub URLs" do
|
235
|
-
it "should parse coub URLs" do
|
236
|
-
film = FilmSnob.new("http://coub.com/view/rcd14cm")
|
237
|
-
expect(film.id).to eq "rcd14cm"
|
238
|
-
expect(film.site).to eq :coub
|
239
|
-
VCR.use_cassette "coub/voodoo_people" do
|
240
|
-
expect(film.title).to eq "voodoo people"
|
241
|
-
expect { film.html }.not_to raise_error
|
242
|
-
end
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
describe "Vine" do
|
247
|
-
it "should parse URLs" do
|
248
|
-
film = FilmSnob.new("https://vine.co/v/1")
|
249
|
-
expect(film.id).to eq "1"
|
250
|
-
expect(film.site).to eq :vine
|
251
|
-
VCR.use_cassette "vine/dom hofman" do
|
252
|
-
expect(film.title).to eq "Dom Hofmann's post on Vine"
|
253
|
-
expect { film.html }.not_to raise_error
|
254
|
-
end
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
describe "rutube URLs" do
|
259
|
-
it "should parse rutube URLs" do
|
260
|
-
url = "http://rutube.ru/video/586afc0f5c652439a2dca8b34d19a086/"
|
261
|
-
film = FilmSnob.new(url)
|
262
|
-
expect(film.id).to eq "586afc0f5c652439a2dca8b34d19a086"
|
263
|
-
expect(film.site).to eq :rutube
|
264
|
-
VCR.use_cassette "rutube/rabbit_eat_raspberry" do
|
265
|
-
expect(film.title).to eq "Кролик ест малину"
|
266
|
-
expect { film.html }.not_to raise_error
|
267
|
-
end
|
268
|
-
end
|
269
|
-
end
|
270
14
|
end
|
271
15
|
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: film_snob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Max Jacobson
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-14 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: webmock
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -78,7 +69,6 @@ dependencies:
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: vcr
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - ~>
|
84
74
|
- !ruby/object:Gem::Version
|
@@ -86,7 +76,6 @@ dependencies:
|
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - ~>
|
92
81
|
- !ruby/object:Gem::Version
|
@@ -94,7 +83,6 @@ dependencies:
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: pry
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ~>
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,7 +90,6 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ~>
|
108
95
|
- !ruby/object:Gem::Version
|
@@ -110,7 +97,6 @@ dependencies:
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: rubocop
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ~>
|
116
102
|
- !ruby/object:Gem::Version
|
@@ -118,7 +104,6 @@ dependencies:
|
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ~>
|
124
109
|
- !ruby/object:Gem::Version
|
@@ -126,7 +111,6 @@ dependencies:
|
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: codeclimate-test-reporter
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
115
|
- - ~>
|
132
116
|
- !ruby/object:Gem::Version
|
@@ -134,7 +118,6 @@ dependencies:
|
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
122
|
- - ~>
|
140
123
|
- !ruby/object:Gem::Version
|
@@ -168,54 +151,60 @@ files:
|
|
168
151
|
- lib/film_snob/video_sites/hulu.rb
|
169
152
|
- lib/film_snob/video_sites/instagram.rb
|
170
153
|
- lib/film_snob/video_sites/rutube.rb
|
154
|
+
- lib/film_snob/video_sites/soundcloud.rb
|
171
155
|
- lib/film_snob/video_sites/vimeo.rb
|
172
156
|
- lib/film_snob/video_sites/vine.rb
|
173
157
|
- lib/film_snob/video_sites/youtube.rb
|
174
|
-
- spec/cassettes/
|
175
|
-
- spec/cassettes/dailymotion/.keep
|
176
|
-
- spec/cassettes/funnyordie/.keep
|
177
|
-
- spec/cassettes/hulu/.keep
|
178
|
-
- spec/cassettes/instagram/.keep
|
179
|
-
- spec/cassettes/vimeo/.keep
|
180
|
-
- spec/cassettes/youtube/.keep
|
158
|
+
- spec/cassettes/README.md
|
181
159
|
- spec/deprecated_spec.rb
|
160
|
+
- spec/film_snob/video_sites/coub_spec.rb
|
161
|
+
- spec/film_snob/video_sites/dailymotion_spec.rb
|
162
|
+
- spec/film_snob/video_sites/funny_or_die_spec.rb
|
163
|
+
- spec/film_snob/video_sites/hulu_spec.rb
|
164
|
+
- spec/film_snob/video_sites/instagram_spec.rb
|
165
|
+
- spec/film_snob/video_sites/rutube_spec.rb
|
166
|
+
- spec/film_snob/video_sites/soundcloud_spec.rb
|
167
|
+
- spec/film_snob/video_sites/vimeo_spec.rb
|
168
|
+
- spec/film_snob/video_sites/vine_spec.rb
|
169
|
+
- spec/film_snob/video_sites/youtube_spec.rb
|
182
170
|
- spec/film_snob_spec.rb
|
183
171
|
- spec/spec_helper.rb
|
184
|
-
- spec/youtube_spec.rb
|
185
172
|
homepage: https://github.com/maxjacobson/film_snob
|
186
173
|
licenses:
|
187
174
|
- MIT
|
175
|
+
metadata: {}
|
188
176
|
post_install_message:
|
189
177
|
rdoc_options: []
|
190
178
|
require_paths:
|
191
179
|
- lib
|
192
180
|
required_ruby_version: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
181
|
requirements:
|
195
|
-
- -
|
182
|
+
- - '>='
|
196
183
|
- !ruby/object:Gem::Version
|
197
184
|
version: 1.9.3
|
198
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
|
-
none: false
|
200
186
|
requirements:
|
201
|
-
- -
|
187
|
+
- - '>='
|
202
188
|
- !ruby/object:Gem::Version
|
203
189
|
version: '0'
|
204
190
|
requirements: []
|
205
191
|
rubyforge_project:
|
206
|
-
rubygems_version:
|
192
|
+
rubygems_version: 2.4.1
|
207
193
|
signing_key:
|
208
|
-
specification_version:
|
194
|
+
specification_version: 4
|
209
195
|
summary: Fetch embed codes for videos
|
210
196
|
test_files:
|
211
|
-
- spec/cassettes/
|
212
|
-
- spec/cassettes/dailymotion/.keep
|
213
|
-
- spec/cassettes/funnyordie/.keep
|
214
|
-
- spec/cassettes/hulu/.keep
|
215
|
-
- spec/cassettes/instagram/.keep
|
216
|
-
- spec/cassettes/vimeo/.keep
|
217
|
-
- spec/cassettes/youtube/.keep
|
197
|
+
- spec/cassettes/README.md
|
218
198
|
- spec/deprecated_spec.rb
|
199
|
+
- spec/film_snob/video_sites/coub_spec.rb
|
200
|
+
- spec/film_snob/video_sites/dailymotion_spec.rb
|
201
|
+
- spec/film_snob/video_sites/funny_or_die_spec.rb
|
202
|
+
- spec/film_snob/video_sites/hulu_spec.rb
|
203
|
+
- spec/film_snob/video_sites/instagram_spec.rb
|
204
|
+
- spec/film_snob/video_sites/rutube_spec.rb
|
205
|
+
- spec/film_snob/video_sites/soundcloud_spec.rb
|
206
|
+
- spec/film_snob/video_sites/vimeo_spec.rb
|
207
|
+
- spec/film_snob/video_sites/vine_spec.rb
|
208
|
+
- spec/film_snob/video_sites/youtube_spec.rb
|
219
209
|
- spec/film_snob_spec.rb
|
220
210
|
- spec/spec_helper.rb
|
221
|
-
- spec/youtube_spec.rb
|
data/spec/cassettes/coub/.keep
DELETED
File without changes
|
File without changes
|
File without changes
|
data/spec/cassettes/hulu/.keep
DELETED
File without changes
|
File without changes
|
data/spec/cassettes/vimeo/.keep
DELETED
File without changes
|
File without changes
|
data/spec/youtube_spec.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
describe FilmSnob::YouTube do
|
2
|
-
it "may not be embeddable" do
|
3
|
-
VCR.use_cassette("youtube/bad_youtube_url") do
|
4
|
-
snob = FilmSnob.new("http://youtube.com/watch?v=malformedid")
|
5
|
-
expect { snob.html }.to raise_error(FilmSnob::NotEmbeddableError)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
it "can handle junked up URLs" do
|
10
|
-
VCR.use_cassette("youtube/pete") do
|
11
|
-
url = "http://www.youtube.com/watch?feature=youtube_gdata&v=fq-xGD_thXo"
|
12
|
-
title = "Pete Meets Olympic Freestyle Skier Torin Yater-Wallace"
|
13
|
-
film = FilmSnob.new(url)
|
14
|
-
expect(film).to be_embeddable
|
15
|
-
expect(film.id).to eq "fq-xGD_thXo"
|
16
|
-
expect { film.html }.to_not raise_error
|
17
|
-
expect(film.title).to eq title
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
it "can handle even more junked up URLs" do
|
22
|
-
VCR.use_cassette("youtube/dilla") do
|
23
|
-
url = "http://www.youtube.com/watch?feature=youtu.be&v=lC0JFXw_6kQ"
|
24
|
-
title = "BINKBEATS Beats Unraveled #6: J. Dilla Live Mixtape"
|
25
|
-
film = FilmSnob.new(url)
|
26
|
-
|
27
|
-
expect(film).to be_embeddable
|
28
|
-
expect(film.id).to eq "lC0JFXw_6kQ"
|
29
|
-
expect { film.html }.to_not raise_error
|
30
|
-
expect(film.title).to eq title
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|