film_snob 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "vcr", "~> 2.9"
26
26
  spec.add_development_dependency "pry", "~> 0.9"
27
27
 
28
- spec.add_runtime_dependency "httparty", "~> 0.13"
29
-
30
28
  spec.required_ruby_version = '>= 1.9.3'
31
29
  end
@@ -28,7 +28,7 @@ class FilmSnob
28
28
  if watchable?
29
29
  @video
30
30
  else
31
- raise NotSupportedURLError.new("#{url} is not a supported URL")
31
+ raise NotSupportedURLError, "#{url} is not a supported URL"
32
32
  end
33
33
  end
34
34
 
@@ -16,5 +16,6 @@ class FilmSnob
16
16
  def self.oembed_endpoint
17
17
  'http://coub.com/api/oembed.json'
18
18
  end
19
+
19
20
  end
20
21
  end
@@ -1,3 +1,3 @@
1
1
  class FilmSnob
2
- VERSION = "0.3.8"
2
+ VERSION = "0.3.9"
3
3
  end
@@ -1,8 +1,8 @@
1
- require 'httparty'
1
+ require 'net/http'
2
+ require 'json'
2
3
 
3
4
  class FilmSnob
4
5
  class VideoSite
5
-
6
6
  attr_reader :url, :options
7
7
 
8
8
  def initialize(url, options)
@@ -26,16 +26,38 @@ class FilmSnob
26
26
  ''
27
27
  end
28
28
 
29
+ def self.http
30
+ Net::HTTP.new(uri.host, uri.port).tap do |uri|
31
+ uri.use_ssl = use_ssl?
32
+ end
33
+ end
34
+
35
+ def self.use_ssl?
36
+ 'https' == uri.scheme
37
+ end
38
+
29
39
  def title
30
- oembed['title']
40
+ lookup :title
31
41
  end
32
42
 
33
43
  def html
34
- oembed['html'] || (raise NotEmbeddableError.new("#{clean_url} is not embeddable"))
44
+ lookup :html
35
45
  end
36
46
 
37
47
  private
38
48
 
49
+ def not_embeddable!
50
+ raise NotEmbeddableError, "#{clean_url} is not embeddable"
51
+ end
52
+
53
+ def self.uri
54
+ URI.parse(oembed_endpoint)
55
+ end
56
+
57
+ def lookup(attribute)
58
+ oembed[attribute.to_s] || not_embeddable!
59
+ end
60
+
39
61
  def matching_pattern
40
62
  self.class.valid_url_patterns.find do |pattern|
41
63
  pattern.match(url)
@@ -43,10 +65,23 @@ class FilmSnob
43
65
  end
44
66
 
45
67
  def oembed
46
- @oembed ||= HTTParty.get(
47
- self.class.oembed_endpoint,
48
- query: { url: clean_url }.merge(options)
49
- )
68
+ @oembed ||= JSON.parse response.body
69
+ rescue
70
+ @oembed = {}
71
+ end
72
+
73
+ def response
74
+ self.class.http.request get
75
+ end
76
+
77
+ def get
78
+ Net::HTTP::Get.new uri.request_uri
79
+ end
80
+
81
+ def uri
82
+ URI(self.class.oembed_endpoint).tap do |uri|
83
+ uri.query = URI.encode_www_form({ url: clean_url }.merge(options))
84
+ end
50
85
  end
51
86
 
52
87
  end
@@ -6,36 +6,44 @@ http_interactions:
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - www.youtube.com
10
18
  response:
11
19
  status:
12
20
  code: 404
13
21
  message: Not Found
14
22
  headers:
15
23
  Date:
16
- - Tue, 15 Apr 2014 02:52:18 GMT
24
+ - Fri, 06 Jun 2014 03:02:54 GMT
17
25
  Server:
18
26
  - gwiseguy/2.0
19
- X-Content-Type-Options:
20
- - nosniff
21
27
  P3p:
22
28
  - CP="This is not a P3P policy! See http://support.google.com/accounts/bin/answer.py?answer=151657&hl=en
23
29
  for more info."
30
+ Content-Type:
31
+ - text/html; charset=utf-8
32
+ Cache-Control:
33
+ - no-cache
24
34
  X-Frame-Options:
25
35
  - ALLOWALL
26
36
  Expires:
27
37
  - Tue, 27 Apr 1971 19:44:06 EST
28
38
  X-Xss-Protection:
29
39
  - 1; mode=block; report=https://www.google.com/appserve/security-bugs/log/youtube
30
- Cache-Control:
31
- - no-cache
32
- Content-Type:
33
- - text/html; charset=utf-8
40
+ X-Content-Type-Options:
41
+ - nosniff
34
42
  Content-Length:
35
43
  - '9'
36
44
  body:
37
- encoding: US-ASCII
45
+ encoding: UTF-8
38
46
  string: Not Found
39
47
  http_version:
40
- recorded_at: Tue, 15 Apr 2014 02:52:19 GMT
41
- recorded_with: VCR 2.9.0
48
+ recorded_at: Fri, 06 Jun 2014 03:02:54 GMT
49
+ recorded_with: VCR 2.9.2
@@ -6,16 +6,26 @@ http_interactions:
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - www.youtube.com
10
18
  response:
11
19
  status:
12
20
  code: 200
13
21
  message: OK
14
22
  headers:
15
23
  Date:
16
- - Tue, 15 Apr 2014 02:52:15 GMT
24
+ - Fri, 06 Jun 2014 02:59:55 GMT
17
25
  Server:
18
26
  - gwiseguy/2.0
27
+ Cache-Control:
28
+ - no-cache
19
29
  X-Frame-Options:
20
30
  - ALLOWALL
21
31
  X-Xss-Protection:
@@ -24,25 +34,23 @@ http_interactions:
24
34
  - Tue, 27 Apr 1971 19:44:06 EST
25
35
  X-Content-Type-Options:
26
36
  - nosniff
37
+ Content-Type:
38
+ - application/json
27
39
  P3p:
28
40
  - CP="This is not a P3P policy! See http://support.google.com/accounts/bin/answer.py?answer=151657&hl=en
29
41
  for more info."
30
- Content-Type:
31
- - application/json
32
- Cache-Control:
33
- - no-cache
34
42
  Transfer-Encoding:
35
43
  - chunked
36
44
  body:
37
- encoding: US-ASCII
38
- string: ! '{"type": "video", "provider_url": "http:\/\/www.youtube.com\/", "thumbnail_url":
39
- "http:\/\/i1.ytimg.com\/vi\/7q5Ltr0qc8c\/hqdefault.jpg", "thumbnail_height":
40
- 360, "width": 480, "provider_name": "YouTube", "author_url": "http:\/\/www.youtube.com\/user\/billyonthestreettv",
41
- "title": "Billy on the Street: Amateur Speed Sketching!", "thumbnail_width":
42
- 480, "version": "1.0", "html": "\u003ciframe width=\"480\" height=\"270\"
45
+ encoding: UTF-8
46
+ string: '{"thumbnail_height": 360, "html": "\u003ciframe width=\"480\" height=\"270\"
43
47
  src=\"http:\/\/www.youtube.com\/embed\/7q5Ltr0qc8c?feature=oembed\" frameborder=\"0\"
44
- allowfullscreen\u003e\u003c\/iframe\u003e", "height": 270, "author_name":
45
- "billyonthestreettv"}'
48
+ allowfullscreen\u003e\u003c\/iframe\u003e", "title": "Billy on the Street:
49
+ Amateur Speed Sketching!", "height": 270, "provider_name": "YouTube", "author_url":
50
+ "http:\/\/www.youtube.com\/user\/billyonthestreettv", "type": "video", "author_name":
51
+ "billyonthestreettv", "thumbnail_url": "http:\/\/i1.ytimg.com\/vi\/7q5Ltr0qc8c\/hqdefault.jpg",
52
+ "provider_url": "http:\/\/www.youtube.com\/", "thumbnail_width": 480, "version":
53
+ "1.0", "width": 480}'
46
54
  http_version:
47
- recorded_at: Tue, 15 Apr 2014 02:52:17 GMT
48
- recorded_with: VCR 2.9.0
55
+ recorded_at: Fri, 06 Jun 2014 02:59:55 GMT
56
+ recorded_with: VCR 2.9.2
@@ -6,7 +6,15 @@ http_interactions:
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - www.hulu.com
10
18
  response:
11
19
  status:
12
20
  code: 200
@@ -22,22 +30,20 @@ http_interactions:
22
30
  - 200 OK
23
31
  X-Ua-Compatible:
24
32
  - IE=EmulateIE9; IE=EmulateIE7
25
- Accept-Ranges:
26
- - bytes
27
33
  Cache-Control:
28
- - max-age=3600
34
+ - max-age=1205
29
35
  Date:
30
- - Tue, 15 Apr 2014 02:52:16 GMT
36
+ - Fri, 06 Jun 2014 02:59:56 GMT
31
37
  Connection:
32
38
  - keep-alive
33
39
  body:
34
- encoding: US-ASCII
35
- string: ! '{"cache_age":3600,"type":"video","large_thumbnail_url":"http://ib.huluim.com/video/50172061?size=512x288&caller=h1o&img=i","height":296,"html":"<iframe
40
+ encoding: UTF-8
41
+ string: '{"thumbnail_height":80,"thumbnail_url":"http://ib.huluim.com/video/50172061?size=145x80&caller=h1o&img=i","type":"video","cache_age":3600,"title":"Remedial
42
+ Chaos Theory (Community)","width":512,"large_thumbnail_url":"http://ib.huluim.com/video/50172061?size=512x288&caller=h1o&img=i","large_thumbnail_width":512,"height":296,"embed_url":"http://www.hulu.com/embed.html?eid=CbtnRM8PBJsCfZpUy2V3Yg","html":"<iframe
36
43
  width=\"512\" height=\"296\" src=\"http://www.hulu.com/embed.html?eid=CbtnRM8PBJsCfZpUy2V3Yg\"
37
44
  frameborder=\"0\" scrolling=\"no\" webkitAllowFullScreen mozallowfullscreen
38
- allowfullscreen> </iframe>","large_thumbnail_width":512,"embed_url":"http://www.hulu.com/embed.html?eid=CbtnRM8PBJsCfZpUy2V3Yg","air_date":"Thu
39
- Oct 13 00:00:00 UTC 2011","large_thumbnail_height":288,"thumbnail_url":"http://ib.huluim.com/video/50172061?size=145x80&caller=h1o&img=i","author_name":"NBC","provider_name":"Hulu","title":"Remedial
40
- Chaos Theory (Community)","thumbnail_width":145,"provider_url":"http://www.hulu.com/","duration":1286.87,"version":"1.0","thumbnail_height":80,"width":512}'
45
+ allowfullscreen> </iframe>","version":"1.0","air_date":"Thu Oct 13 00:00:00
46
+ UTC 2011","large_thumbnail_height":288,"author_name":"NBC","provider_name":"Hulu","duration":1286.87,"thumbnail_width":145,"provider_url":"http://www.hulu.com/"}'
41
47
  http_version:
42
- recorded_at: Tue, 15 Apr 2014 02:52:18 GMT
43
- recorded_with: VCR 2.9.0
48
+ recorded_at: Fri, 06 Jun 2014 02:59:56 GMT
49
+ recorded_with: VCR 2.9.2
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=malformedid
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - www.youtube.com
18
+ response:
19
+ status:
20
+ code: 404
21
+ message: Not Found
22
+ headers:
23
+ Date:
24
+ - Fri, 06 Jun 2014 02:59:55 GMT
25
+ Server:
26
+ - gwiseguy/2.0
27
+ X-Xss-Protection:
28
+ - 1; mode=block; report=https://www.google.com/appserve/security-bugs/log/youtube
29
+ Expires:
30
+ - Tue, 27 Apr 1971 19:44:06 EST
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ X-Frame-Options:
34
+ - ALLOWALL
35
+ P3p:
36
+ - CP="This is not a P3P policy! See http://support.google.com/accounts/bin/answer.py?answer=151657&hl=en
37
+ for more info."
38
+ Cache-Control:
39
+ - no-cache
40
+ Content-Type:
41
+ - text/html; charset=utf-8
42
+ Content-Length:
43
+ - '9'
44
+ body:
45
+ encoding: UTF-8
46
+ string: Not Found
47
+ http_version:
48
+ recorded_at: Fri, 06 Jun 2014 02:59:55 GMT
49
+ recorded_with: VCR 2.9.2
@@ -6,7 +6,15 @@ http_interactions:
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - vimeo.com
10
18
  response:
11
19
  status:
12
20
  code: 200
@@ -15,9 +23,9 @@ http_interactions:
15
23
  Age:
16
24
  - '1'
17
25
  Date:
18
- - Tue, 15 Apr 2014 02:52:16 GMT
26
+ - Fri, 06 Jun 2014 02:59:55 GMT
19
27
  Expires:
20
- - Tue, 15 Apr 2014 02:53:16 GMT
28
+ - Fri, 06 Jun 2014 03:00:55 GMT
21
29
  Content-Length:
22
30
  - '793'
23
31
  Connection:
@@ -26,30 +34,30 @@ http_interactions:
26
34
  - 1.1 varnish
27
35
  - dnet-dca
28
36
  Etag:
29
- - ! '"e19e6eea37661a8e029d8f8e3b2116f3e97ea8f0"'
37
+ - '"5ffeebb02a34c4b0edaf908978ae3dc7a08a8994"'
30
38
  Server:
31
39
  - Apache
32
40
  Access-Control-Allow-Origin:
33
- - ! '*'
41
+ - "*"
34
42
  Access-Control-Allow-Headers:
35
43
  - X-Requested-With
36
44
  Last-Modified:
37
- - Tue, 15 Apr 2014 02:10:30 GMT
45
+ - Fri, 06 Jun 2014 02:09:21 GMT
38
46
  Vary:
39
47
  - Accept-Encoding
40
48
  Content-Type:
41
49
  - application/json
42
50
  X-Varnish:
43
- - '1677378251'
51
+ - '1670035520'
44
52
  X-Varnish-Cache:
45
53
  - '0'
46
54
  Nncoection:
47
55
  - close
48
56
  X-Vserver:
49
- - 10.90.128.197
57
+ - dfvimeowebproxy3
50
58
  body:
51
- encoding: US-ASCII
52
- string: ! '{"type":"video","version":"1.0","provider_name":"Vimeo","provider_url":"https:\/\/vimeo.com\/","title":"Murmuration","author_name":"Islands
59
+ encoding: UTF-8
60
+ string: '{"type":"video","version":"1.0","provider_name":"Vimeo","provider_url":"https:\/\/vimeo.com\/","title":"Murmuration","author_name":"Islands
53
61
  & Rivers","author_url":"http:\/\/vimeo.com\/islandsandrivers","is_plus":"1","html":"<iframe
54
62
  src=\"\/\/player.vimeo.com\/video\/31158841\" width=\"400\" height=\"300\"
55
63
  frameborder=\"0\" title=\"Murmuration\" webkitallowfullscreen mozallowfullscreen
@@ -57,5 +65,5 @@ http_interactions:
57
65
  Islands And Rivers\n\nFollow us @Islands_Rivers\n\nA chance encounter and
58
66
  shared moment with one of natures greatest and most fleeting phenomena.","thumbnail_url":"http:\/\/i.vimeocdn.com\/video\/448600816_295x166.jpg","thumbnail_width":295,"thumbnail_height":221,"video_id":31158841}'
59
67
  http_version:
60
- recorded_at: Tue, 15 Apr 2014 02:52:17 GMT
61
- recorded_with: VCR 2.9.0
68
+ recorded_at: Fri, 06 Jun 2014 02:59:55 GMT
69
+ recorded_with: VCR 2.9.2
@@ -6,7 +6,11 @@ http_interactions:
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
10
14
  response:
11
15
  status:
12
16
  code: 200
@@ -19,11 +23,11 @@ http_interactions:
19
23
  Access-Control-Allow-Headers:
20
24
  - X-Requested-With
21
25
  Expires:
22
- - Tue, 15 Apr 2014 02:52:58 GMT
26
+ - Fri, 06 Jun 2014 03:05:51 GMT
23
27
  Last-Modified:
24
- - Tue, 15 Apr 2014 02:10:30 GMT
28
+ - Fri, 06 Jun 2014 02:09:21 GMT
25
29
  Etag:
26
- - ! '"e19e6eea37661a8e029d8f8e3b2116f3e97ea8f0"'
30
+ - ! '"5ffeebb02a34c4b0edaf908978ae3dc7a08a8994"'
27
31
  Vary:
28
32
  - Accept-Encoding
29
33
  Content-Type:
@@ -31,19 +35,19 @@ http_interactions:
31
35
  Transfer-Encoding:
32
36
  - chunked
33
37
  Date:
34
- - Tue, 15 Apr 2014 02:52:16 GMT
38
+ - Fri, 06 Jun 2014 03:04:51 GMT
35
39
  X-Varnish:
36
- - 2146795868 2146790599
40
+ - '1671233141'
37
41
  Age:
38
- - '18'
42
+ - '0'
39
43
  Via:
40
44
  - 1.1 varnish
41
45
  X-Varnish-Cache:
42
- - '1'
46
+ - '0'
43
47
  Nncoection:
44
48
  - close
45
49
  X-Vserver:
46
- - 10.90.128.188
50
+ - dfvimeowebproxy3
47
51
  body:
48
52
  encoding: US-ASCII
49
53
  string: ! '{"type":"video","version":"1.0","provider_name":"Vimeo","provider_url":"https:\/\/vimeo.com\/","title":"Murmuration","author_name":"Islands
@@ -54,5 +58,5 @@ http_interactions:
54
58
  Islands And Rivers\n\nFollow us @Islands_Rivers\n\nA chance encounter and
55
59
  shared moment with one of natures greatest and most fleeting phenomena.","thumbnail_url":"http:\/\/i.vimeocdn.com\/video\/448600816_295x166.jpg","thumbnail_width":295,"thumbnail_height":221,"video_id":31158841}'
56
60
  http_version:
57
- recorded_at: Tue, 15 Apr 2014 02:52:17 GMT
58
- recorded_with: VCR 2.9.0
61
+ recorded_at: Fri, 06 Jun 2014 03:04:51 GMT
62
+ recorded_with: VCR 2.9.2
@@ -6,7 +6,15 @@ http_interactions:
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - www.funnyordie.com
10
18
  response:
11
19
  status:
12
20
  code: 200
@@ -29,22 +37,24 @@ http_interactions:
29
37
  Etag:
30
38
  - '"bf2b27d19328373c12ec3f1c5a813b56"'
31
39
  X-Request-Id:
32
- - 981b6969-3e49-462a-b4a8-37fd14702479
40
+ - 39767a34-cf4a-43e7-995a-ed12770d1dba
33
41
  X-Runtime:
34
- - '0.025448'
42
+ - '0.021698'
35
43
  X-Varnish:
36
- - '1732560026'
37
- - '318926149'
44
+ - '472126988'
45
+ - '472126989'
38
46
  Served-By:
39
- - prodweb2/prodweb1/278007-prodapp3
47
+ - prodweb1/prodweb1/278006-prodapp2
48
+ Vary:
49
+ - Accept-Encoding
40
50
  Expires:
41
- - Sat, 19 Apr 2014 03:15:41 GMT
51
+ - Fri, 06 Jun 2014 02:59:56 GMT
42
52
  Cache-Control:
43
53
  - max-age=0, no-cache, no-store
44
54
  Pragma:
45
55
  - no-cache
46
56
  Date:
47
- - Sat, 19 Apr 2014 03:15:41 GMT
57
+ - Fri, 06 Jun 2014 02:59:56 GMT
48
58
  Content-Length:
49
59
  - '1751'
50
60
  Connection:
@@ -54,5 +64,5 @@ http_interactions:
54
64
  string: |
55
65
  {"type":"video","version":"1.0","provider_name":"Funny or Die","provider_url":"http://www.funnyordie.com","author_name":"Seth Green","author_url":"http://www.funnyordie.com/seth_green","title":"The Live Read of Space Jam with Blake Griffin","html":"\u003Ciframe src=\"http://www.funnyordie.com/embed/8db066d2e0\" width=\"960\" height=\"580\" frameborder=\"0\" allowfullscreen webkitallowfullscreen mozallowfullscreen\u003E\u003C/iframe\u003E\u003Cdiv style=\"text-align:left;font-size:x-small;margin-top:0;width:960px;\"\u003E\u003Ca href=\"http://www.funnyordie.com/videos/8db066d2e0/the-live-read-of-space-jam-with-blake-griffin\" title=\"from Seth Green, Blake Griffin, DeAndre Jordan, Danielle Fishel, Paul Scheer, Nick Kroll, Ben Schwartz, Jerrod Carmichael, Noah Garfinkel, Brandon Johnson, Melissa Stetten, Shelby Fero, Jensen Karp, Ally Hord, Funny Or Die, Matt Sweeney, BoTown Sound, and Nate Maggio\"\u003EThe Live Read of Space Jam with Blake Griffin\u003C/a\u003E from \u003Ca href=\"http://www.funnyordie.com/seth_green\"\u003ESeth Green\u003C/a\u003E \u003Ciframe src=\"http://www.facebook.com/plugins/like.php?app_id=138711277798\u0026amp;href=http%3A%2F%2Fwww.funnyordie.com%2Fvideos%2F8db066d2e0%2Fthe-live-read-of-space-jam-with-blake-griffin\u0026amp;send=false\u0026amp;layout=button_count\u0026amp;width=150\u0026amp;show_faces=false\u0026amp;action=like\u0026amp;height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:90px; height:21px; vertical-align:middle;\" allowTransparency=\"true\"\u003E\u003C/iframe\u003E\n\u003C/div\u003E","width":960,"height":580,"thumbnail_width":464,"thumbnail_height":348,"thumbnail_url":"http://t.fod4.com/t/8db066d2e0/c480x270_58.jpg","duration":584.817}
56
66
  http_version:
57
- recorded_at: Sat, 19 Apr 2014 03:15:41 GMT
58
- recorded_with: VCR 2.9.0
67
+ recorded_at: Fri, 06 Jun 2014 02:59:56 GMT
68
+ recorded_with: VCR 2.9.2
@@ -6,47 +6,60 @@ http_interactions:
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - vimeo.com
10
18
  response:
11
19
  status:
12
20
  code: 200
13
21
  message: OK
14
22
  headers:
23
+ Age:
24
+ - '1'
25
+ Date:
26
+ - Fri, 06 Jun 2014 02:59:55 GMT
27
+ Expires:
28
+ - Fri, 06 Jun 2014 03:00:55 GMT
29
+ Connection:
30
+ - Keep-Alive
31
+ Via:
32
+ - 1.1 varnish
33
+ - dnet-dca
34
+ Etag:
35
+ - '"3ee9abac968dd90ff3d61a6c3ed1e6aac5a93a7d"'
15
36
  Server:
16
37
  - Apache
17
38
  Access-Control-Allow-Origin:
18
- - ! '*'
39
+ - "*"
19
40
  Access-Control-Allow-Headers:
20
41
  - X-Requested-With
21
- Expires:
22
- - Tue, 15 Apr 2014 02:53:16 GMT
23
42
  Last-Modified:
24
43
  - Sun, 13 Apr 2014 19:06:59 GMT
25
- Etag:
26
- - ! '"3ee9abac968dd90ff3d61a6c3ed1e6aac5a93a7d"'
27
44
  Vary:
28
45
  - Accept-Encoding
29
46
  Content-Type:
30
47
  - application/json
31
- Transfer-Encoding:
32
- - chunked
33
- Date:
34
- - Tue, 15 Apr 2014 02:52:16 GMT
48
+ Content-Length:
49
+ - '478'
50
+ Accept-Ranges:
51
+ - bytes
35
52
  X-Varnish:
36
- - '273732503'
37
- Age:
38
- - '0'
39
- Via:
40
- - 1.1 varnish
53
+ - '1817515816'
41
54
  X-Varnish-Cache:
42
55
  - '0'
43
56
  Cneonction:
44
57
  - close
45
58
  X-Vserver:
46
- - 10.90.128.147
59
+ - dfvimeowebproxy4
47
60
  body:
48
- encoding: US-ASCII
49
- string: ! '{"type":"video","version":"1.0","provider_name":"Vimeo","provider_url":"https:\/\/vimeo.com\/","title":"Days
61
+ encoding: UTF-8
62
+ string: '{"type":"video","version":"1.0","provider_name":"Vimeo","provider_url":"https:\/\/vimeo.com\/","title":"Days
50
63
  Like Today","author_name":"Stephen_Scott_Day","author_url":"http:\/\/vimeo.com\/stephenscottday","is_plus":"1","html":"<iframe
51
64
  src=\"\/\/player.vimeo.com\/video\/16010689\" width=\"1280\" height=\"720\"
52
65
  frameborder=\"0\" title=\"Days Like Today\" webkitallowfullscreen mozallowfullscreen
@@ -55,5 +68,5 @@ http_interactions:
55
68
  the whole thing, but if you do, lemme know. \n\nTuesday, October 19th, 2010.
56
69
  Somewhere between 3:40pm and 3:50pm. Alhambra, CA.","thumbnail_url":"http:\/\/i.vimeocdn.com\/video\/97388869_1280.jpg","thumbnail_width":1280,"thumbnail_height":720,"video_id":16010689}'
57
70
  http_version:
58
- recorded_at: Tue, 15 Apr 2014 02:52:17 GMT
59
- recorded_with: VCR 2.9.0
71
+ recorded_at: Fri, 06 Jun 2014 02:59:55 GMT
72
+ recorded_with: VCR 2.9.2
@@ -6,52 +6,50 @@ http_interactions:
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
- headers: {}
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - coub.com
10
18
  response:
11
19
  status:
12
20
  code: 200
13
21
  message: OK
14
22
  headers:
15
23
  Server:
16
- - Apache
17
- Access-Control-Allow-Origin:
18
- - ! '*'
19
- Access-Control-Allow-Headers:
20
- - X-Requested-With
21
- Expires:
22
- - Tue, 15 Apr 2014 02:53:16 GMT
23
- Last-Modified:
24
- - Sun, 13 Apr 2014 19:06:59 GMT
25
- Etag:
26
- - ! '"3ee9abac968dd90ff3d61a6c3ed1e6aac5a93a7d"'
27
- Vary:
28
- - Accept-Encoding
24
+ - nginx/1.4.4
25
+ Date:
26
+ - Fri, 06 Jun 2014 02:59:56 GMT
29
27
  Content-Type:
30
- - application/json
28
+ - application/json; charset=utf-8
31
29
  Transfer-Encoding:
32
30
  - chunked
33
- Date:
34
- - Tue, 15 Apr 2014 02:52:16 GMT
35
- X-Varnish:
36
- - '273732503'
37
- Age:
38
- - '0'
39
- Via:
40
- - 1.1 varnish
41
- X-Varnish-Cache:
42
- - '0'
43
- Cneonction:
44
- - close
45
- X-Vserver:
46
- - 10.90.128.147
31
+ Connection:
32
+ - keep-alive
33
+ Vary:
34
+ - Accept-Encoding
35
+ Status:
36
+ - 200 OK
37
+ X-Ua-Compatible:
38
+ - IE=Edge,chrome=1
39
+ Cache-Control:
40
+ - max-age=0, private, must-revalidate
41
+ X-Request-Id:
42
+ - 271c6fd4f094ad88c161efa47990e5e1
43
+ X-Runtime:
44
+ - '0.011259'
45
+ X-Rack-Cache:
46
+ - miss
47
47
  body:
48
- encoding: US-ASCII
49
- string: |
50
- {"type":"video","version":"1.0","width":942,"height":720,"title":"voodoo people","url":"http://coub.com/view/rcd14cm",
51
- "thumbnail_url":"http://cdn1.akamai.coub.com/coub/simple/cw_image/8007107badd/a0f3e90c986074ac81f30/med_1374583486_00033.jpg",
52
- "thumbnail_width":640,"thumbnail_height":488,"author_name":"Igor","author_url":"http://coub.com/coubcreator",
53
- "provider_name":"Coub","provider_url":"http://coub.com/",
54
- "html":"<iframesrc=\"http://coub.com/embed/rcd14cm\"allowfullscreen=\"true\"frameborder=\"0\"width=\"640\"height=\"489\"></iframe>"}
48
+ encoding: UTF-8
49
+ string: '{"type":"video","version":"1.0","width":"942","height":"720","title":"voodoo
50
+ people","url":"http://coub.com/view/rcd14cm","thumbnail_url":"http://cdn1.akamai.coub.com/coub/simple/cw_image/8007107badd/a0f3e90c986074ac81f30/med_1374583486_00033.jpg","thumbnail_width":"640","thumbnail_height":"488","author_name":"\u0418\u0433\u043e\u0440\u044c","author_url":"http://coub.com/coubcreator","provider_name":"Coub","provider_url":"http://coub.com/","html":"<iframe
51
+ src=\"http://coub.com/embed/rcd14cm\" allowfullscreen=\"true\" frameborder=\"0\"
52
+ width=\"640\" height=\"489\"></iframe>"}'
55
53
  http_version:
56
- recorded_at: Sun, 01 Jun 2014 02:52:17 GMT
57
- recorded_with: VCR 2.9.0
54
+ recorded_at: Fri, 06 Jun 2014 02:59:56 GMT
55
+ recorded_with: VCR 2.9.2
@@ -1,9 +1,7 @@
1
1
  require_relative 'spec_helper'
2
2
 
3
3
  describe FilmSnob do
4
-
5
4
  describe 'not supported URLs' do
6
-
7
5
  it 'should handle non-supported URLs gracefully' do
8
6
  snob = FilmSnob.new("http://hardscrabble.net")
9
7
  expect(snob).to_not be_watchable
@@ -14,15 +12,13 @@ describe FilmSnob do
14
12
  expect(snob).to_not be_watchable
15
13
  expect{snob.id}.to raise_error(FilmSnob::NotSupportedURLError)
16
14
  end
17
-
18
15
  end
19
16
 
20
17
  describe 'YouTube URLs' do
21
-
22
18
  it 'should parse normal YouTube URLs' do
23
19
  snob = FilmSnob.new("https://www.youtube.com/watch?v=7q5Ltr0qc8c")
24
20
  expect(snob).to be_watchable
25
- expect(snob.id).to eq "7q5Ltr0qc8c"
21
+ expect(snob.id).to eq '7q5Ltr0qc8c'
26
22
  expect(snob.site).to eq :youtube
27
23
  VCR.use_cassette('billy') do
28
24
  expect(snob.title).to eq 'Billy on the Street: Amateur Speed Sketching!'
@@ -32,7 +28,7 @@ describe FilmSnob do
32
28
  it 'should parse YouTube URLs with dashes' do
33
29
  snob = FilmSnob.new("https://www.youtube.com/watch?v=xa-KBqOFgDQ")
34
30
  expect(snob).to be_watchable
35
- expect(snob.id).to eq "xa-KBqOFgDQ"
31
+ expect(snob.id).to eq 'xa-KBqOFgDQ'
36
32
  expect(snob.site).to eq :youtube
37
33
  end
38
34
 
@@ -40,30 +36,36 @@ describe FilmSnob do
40
36
  # first video I could find with an underscore
41
37
  snob = FilmSnob.new("https://www.youtube.com/watch?v=HPR3PB_VGVs")
42
38
  expect(snob).to be_watchable
43
- expect(snob.id).to eq "HPR3PB_VGVs"
39
+ expect(snob.id).to eq 'HPR3PB_VGVs'
44
40
  expect(snob.site).to eq :youtube
45
41
  end
46
42
 
47
43
  it 'should parse mobile YouTube URLs' do
48
44
  snob = FilmSnob.new("https://m.youtube.com/watch?v=6dyeFalOjw0&feature=youtu.be")
49
- expect(snob.id).to eq "6dyeFalOjw0"
45
+ expect(snob.id).to eq '6dyeFalOjw0'
50
46
  expect(snob.site).to eq :youtube
51
- expect(snob.clean_url).to eq "https://www.youtube.com/watch?v=6dyeFalOjw0"
47
+ expect(snob.clean_url).to eq 'https://www.youtube.com/watch?v=6dyeFalOjw0'
52
48
  end
53
49
 
54
50
  it 'should parse short YouTube URLs' do
55
51
  snob = FilmSnob.new("http://youtu.be/1Ee4bfu_t3c")
56
- expect(snob.id).to eq "1Ee4bfu_t3c"
52
+ expect(snob.id).to eq '1Ee4bfu_t3c'
57
53
  expect(snob.site).to eq :youtube
58
- expect(snob.clean_url).to eq "https://www.youtube.com/watch?v=1Ee4bfu_t3c"
54
+ expect(snob.clean_url).to eq 'https://www.youtube.com/watch?v=1Ee4bfu_t3c'
59
55
  end
60
56
 
57
+ it 'should raise a not embeddable error for a missing video URL' do
58
+ VCR.use_cassette('missing video') do
59
+ snob = FilmSnob.new("https://youtube.com/watch?v=malformedid")
60
+ expect{snob.title}.to raise_error(FilmSnob::NotEmbeddableError)
61
+ end
62
+ end
61
63
  end
62
64
 
63
65
  describe 'vimeo URLs' do
64
66
  it 'should parse https vimeo URLs' do
65
67
  snob = FilmSnob.new("https://vimeo.com/16010689")
66
- expect(snob.id).to eq "16010689"
68
+ expect(snob.id).to eq '16010689'
67
69
  expect(snob.site).to eq :vimeo
68
70
  VCR.use_cassette('stephen') do
69
71
  expect(snob.title).to eq 'Days Like Today'
@@ -72,40 +74,40 @@ describe FilmSnob do
72
74
 
73
75
  it 'should parse http vimeo URLs' do
74
76
  snob = FilmSnob.new("http://vimeo.com/16010689")
75
- expect(snob.id).to eq "16010689"
77
+ expect(snob.id).to eq '16010689'
76
78
  expect(snob.site).to eq :vimeo
77
79
  end
78
80
 
79
81
  it 'should parse mobile vimeo URLs' do
80
82
  snob = FilmSnob.new("http://vimeo.com/m/16010689")
81
- expect(snob.id).to eq "16010689"
83
+ expect(snob.id).to eq '16010689'
82
84
  expect(snob.site).to eq :vimeo
83
- expect(snob.clean_url).to eq "https://vimeo.com/16010689"
85
+ expect(snob.clean_url).to eq 'https://vimeo.com/16010689'
84
86
  end
85
87
 
86
88
  it 'should parse couchmode vimeo URLs' do
87
89
  snob = FilmSnob.new("https://vimeo.com/couchmode/staffpicks/sort:date/91157088")
88
- expect(snob.id).to eq "91157088"
90
+ expect(snob.id).to eq '91157088'
89
91
  expect(snob.site).to eq :vimeo
90
92
  expect(snob.clean_url).to eq 'https://vimeo.com/91157088'
91
93
 
92
- snob2 = FilmSnob.new("https://vimeo.com/couchmode/watchlater/sort:date/51020067")
93
- expect(snob2.id).to eq "51020067"
94
+ snob2 = FilmSnob.new('https://vimeo.com/couchmode/watchlater/sort:date/51020067')
95
+ expect(snob2.id).to eq '51020067'
94
96
  expect(snob2.site).to eq :vimeo
95
97
  expect(snob2.clean_url).to eq 'https://vimeo.com/51020067'
96
98
  end
97
99
 
98
100
  it 'should allow oembed configuration' do
99
101
  snob = FilmSnob.new("http://vimeo.com/31158841", width: 400)
100
- VCR.use_cassette "murmuration" do
102
+ VCR.use_cassette 'murmuration' do
101
103
  expect(snob.html).to match %r{width="400"}
102
104
  end
103
- snob2 = FilmSnob.new("http://vimeo.com/31158841", width: 500)
104
- VCR.use_cassette "murmuration2" do
105
+
106
+ snob2 = FilmSnob.new('http://vimeo.com/31158841', width: 500)
107
+ VCR.use_cassette 'murmuration2' do
105
108
  expect(snob2.html).to match %r{width="500"}
106
109
  end
107
110
  end
108
-
109
111
  end
110
112
 
111
113
  describe 'hulu URLs' do
@@ -122,7 +124,7 @@ describe FilmSnob do
122
124
 
123
125
  describe 'funny or die URLs' do
124
126
  it 'should parse funny or die URLs' do
125
- film = FilmSnob.new("http://www.funnyordie.com/videos/8db066d2e0/the-live-read-of-space-jam-with-blake-griffin")
127
+ film = FilmSnob.new('http://www.funnyordie.com/videos/8db066d2e0/the-live-read-of-space-jam-with-blake-griffin')
126
128
  expect(film.id).to eq '8db066d2e0'
127
129
  expect(film.site).to eq :funnyordie
128
130
  VCR.use_cassette 'space jam' do
@@ -134,7 +136,7 @@ describe FilmSnob do
134
136
 
135
137
  describe 'coub URLs' do
136
138
  it 'should parse coub URLs' do
137
- film = FilmSnob.new("http://coub.com/view/rcd14cm")
139
+ film = FilmSnob.new('http://coub.com/view/rcd14cm')
138
140
  expect(film.id).to eq 'rcd14cm'
139
141
  expect(film.site).to eq :coub
140
142
  VCR.use_cassette 'voodoo_people' do
metadata CHANGED
@@ -1,113 +1,112 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: film_snob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Max Jacobson
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-06-01 00:00:00.000000000 Z
12
+ date: 2014-06-06 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - "~>"
19
+ - - ~>
18
20
  - !ruby/object:Gem::Version
19
21
  version: '1.6'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - "~>"
27
+ - - ~>
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.6'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rake
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - "~>"
35
+ - - ~>
32
36
  - !ruby/object:Gem::Version
33
37
  version: '10.3'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - "~>"
43
+ - - ~>
39
44
  - !ruby/object:Gem::Version
40
45
  version: '10.3'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rspec
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - "~>"
51
+ - - ~>
46
52
  - !ruby/object:Gem::Version
47
53
  version: 3.0.0.rc1
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - "~>"
59
+ - - ~>
53
60
  - !ruby/object:Gem::Version
54
61
  version: 3.0.0.rc1
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: webmock
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - "~>"
67
+ - - ~>
60
68
  - !ruby/object:Gem::Version
61
69
  version: '1.17'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - "~>"
75
+ - - ~>
67
76
  - !ruby/object:Gem::Version
68
77
  version: '1.17'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: vcr
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - "~>"
83
+ - - ~>
74
84
  - !ruby/object:Gem::Version
75
85
  version: '2.9'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - "~>"
91
+ - - ~>
81
92
  - !ruby/object:Gem::Version
82
93
  version: '2.9'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: pry
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - "~>"
99
+ - - ~>
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0.9'
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - "~>"
107
+ - - ~>
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0.9'
97
- - !ruby/object:Gem::Dependency
98
- name: httparty
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '0.13'
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0.13'
111
110
  description: Find information about URLs from video sites, such as the title and embed
112
111
  code of the video
113
112
  email:
@@ -116,9 +115,9 @@ executables: []
116
115
  extensions: []
117
116
  extra_rdoc_files: []
118
117
  files:
119
- - ".gitignore"
120
- - ".rspec"
121
- - ".travis.yml"
118
+ - .gitignore
119
+ - .rspec
120
+ - .travis.yml
122
121
  - Gemfile
123
122
  - LICENSE.txt
124
123
  - README.md
@@ -138,6 +137,7 @@ files:
138
137
  - spec/cassettes/bad_youtube_url.yml
139
138
  - spec/cassettes/billy.yml
140
139
  - spec/cassettes/harmon.yml
140
+ - spec/cassettes/missing_video.yml
141
141
  - spec/cassettes/murmuration.yml
142
142
  - spec/cassettes/murmuration2.yml
143
143
  - spec/cassettes/space_jam.yml
@@ -149,32 +149,34 @@ files:
149
149
  homepage: https://github.com/maxjacobson/film_snob
150
150
  licenses:
151
151
  - MIT
152
- metadata: {}
153
152
  post_install_message:
154
153
  rdoc_options: []
155
154
  require_paths:
156
155
  - lib
157
156
  required_ruby_version: !ruby/object:Gem::Requirement
157
+ none: false
158
158
  requirements:
159
- - - ">="
159
+ - - ! '>='
160
160
  - !ruby/object:Gem::Version
161
161
  version: 1.9.3
162
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
+ none: false
163
164
  requirements:
164
- - - ">="
165
+ - - ! '>='
165
166
  - !ruby/object:Gem::Version
166
167
  version: '0'
167
168
  requirements: []
168
169
  rubyforge_project:
169
- rubygems_version: 2.2.2
170
+ rubygems_version: 1.8.23.2
170
171
  signing_key:
171
- specification_version: 4
172
+ specification_version: 3
172
173
  summary: Fetch embed codes for videos
173
174
  test_files:
174
175
  - spec/cassettes/.keep
175
176
  - spec/cassettes/bad_youtube_url.yml
176
177
  - spec/cassettes/billy.yml
177
178
  - spec/cassettes/harmon.yml
179
+ - spec/cassettes/missing_video.yml
178
180
  - spec/cassettes/murmuration.yml
179
181
  - spec/cassettes/murmuration2.yml
180
182
  - spec/cassettes/space_jam.yml
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 7c1fbeb96d100f09f8e9a752b96362afcbc735fd
4
- data.tar.gz: 9171fdc77ef624937f52c47dc77281dd6ee3aa1b
5
- SHA512:
6
- metadata.gz: 8161280ebf1c10ce0dd94d88570ab8b2d3afa0e974b9aa7aeac1dad4d37c6f6f8e9ed68c937401800664befea46b6a913da7ec818481270836a9c749203a627b
7
- data.tar.gz: 2dae80380057c6bdeb2a68a7c1f2eb4e0cf44bc92a5f475431a08c440405201e01894ebe94028643e77dbf3716aaaed3ef87669e5d74bf4a7cf72e8bd7a91dbd