video_thumb 0.1 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f8e8986ae87d879cd7525849c2150559328c63d
4
- data.tar.gz: 1c32ed0cc3621675af1ec422be77b27a182f5682
3
+ metadata.gz: d576325c7980fa1da3e546bd093d28b7d8c7c0e6
4
+ data.tar.gz: d67b18be0b8ad0febca7119caf93f48f30e51fdc
5
5
  SHA512:
6
- metadata.gz: 17006a8c20939a5fc298c1fd4179bd212ab810878040e336936d3a27817b69623140d1631153c6f0290b7cff34bb22df962b8cc1c61ffabd983dd747bfd56417
7
- data.tar.gz: a2e4da6fee449ea5e72860f80911c4e53a9a713f0a2bd4111e245b8d7a96e7974a2fbaf3ed0cefa44333da79f3ec6792e3866f444a3dd8967535a33b8764fbe7
6
+ metadata.gz: e073e6f3ace827aa22e68c0cdaa25feaa3eb599a0794e510c2ffd4677b8cd90dc89aa7f080f39faae23cf5fe1443dc63a20b6c43fd2ad94585230122439ef8c0
7
+ data.tar.gz: e00de6a244dfec76e199d71c12a50b648e911fc58484cdac29c23cc2fae9c9e1eaad23cf1dc533891c23df41492aa108da1e91c74664221c858a9a7730ecfa51
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- # Youtube and Vimeo thumbnails
1
+ # Youtube, Vimeo and İzlesene thumbnails
2
+ [![Gem Version](https://badge.fury.io/rb/video_thumb.svg)](http://badge.fury.io/rb/video_thumb)
2
3
 
3
- Get the thumbnails from Youtube and Vimeo videos for Ruby.
4
+ Get the thumbnails from Youtube, Vimeo and İzlesene videos for Ruby.
4
5
 
5
6
  And it may support more video hoster with your [contributions](#contributing).
6
7
 
@@ -25,15 +26,26 @@ or install the gem on terminal.
25
26
  **url**
26
27
 
27
28
  > Youtube or Vimeo video link
29
+ >
28
30
  > http://www.youtube.com/watch?v=iEPTlhBmwRg
31
+ >
29
32
  > or
33
+ >
30
34
  > http://vimeo.com/101419884
35
+ >
36
+ > or
37
+ >
38
+ > http://www.izlesene.com/video/feder-goodbye-feat-lyse/7886121
31
39
 
32
- **size**
40
+ **size** (not compatible with izlesene)
33
41
  > **default** *= large*
42
+ >
34
43
  > **small** *(Youtube: 120x90, Vimeo: 100x75)*
44
+ >
35
45
  > **medium** *(Youtube: 320x180, Vimeo: 200x150)*
46
+ >
36
47
  > **large** *(Youtube: 640x480, Vimeo: 640xauto)*
48
+ >
37
49
  > **max** *(Youtube: original, Vimeo: 640xauto)*
38
50
 
39
51
 
@@ -41,7 +53,7 @@ or install the gem on terminal.
41
53
  ## Usage
42
54
 
43
55
  ```ruby
44
- require 'video_thumb'
56
+ require 'video_thumb' # if you're not use Rails 4
45
57
  VideoThumb::get("http://vimeo.com/101419884")
46
58
  # returns large thumbnail from Vimeo video
47
59
  # http://i.vimeocdn.com/video/483188148_640.jpg
@@ -49,27 +61,20 @@ VideoThumb::get("http://vimeo.com/101419884")
49
61
  VideoThumb::get("http://www.youtube.com/watch?v=iEPTlhBmwRg", "medium")
50
62
  # returns medium thumbnail from Youtube video
51
63
  # https://img.youtube.com/vi/iEPTlhBmwRg/mqdefault.jpg
52
- ```
53
-
54
64
 
55
- **Rails 4**
56
- ```ruby
57
- VideoThumb::get("http://vimeo.com/101419884")
65
+ VideoThumb::get("http://www.izlesene.com/video/feder-goodbye-feat-lyse/7886121")
58
66
  # returns large thumbnail from Vimeo video
59
- # http://i.vimeocdn.com/video/483188148_640.jpg
60
-
61
- VideoThumb::get("http://www.youtube.com/watch?v=iEPTlhBmwRg", "medium")
62
- # returns medium thumbnail from Youtube video
63
- # https://img.youtube.com/vi/iEPTlhBmwRg/mqdefault.jpg
67
+ # http://i2.imgiz.com/rshots/7886/feder-goodbye-feat-lyse_7886121-8807_1200x630.jpg
64
68
  ```
65
69
 
66
70
  ## Dependencies
67
71
  - open-uri
68
72
  - json
73
+ - nokogiri
69
74
 
70
75
 
71
- ## Contributing
72
76
  <a name="contributing"></a>
77
+ ## Contributing
73
78
  1. Fork it ( https://github.com/tgezginis/video_thumb/fork )
74
79
  2. Create your feature branch (`git checkout -b my-new-feature`)
75
80
  3. Commit your changes (`git commit -am 'Add some feature'`)
@@ -1,3 +1,3 @@
1
1
  module VideoThumb
2
- VERSION = "0.1"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/video_thumb.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'video_thumb/version'
2
2
 
3
+ require 'nokogiri'
3
4
  require 'open-uri'
4
5
  require 'json'
5
6
 
@@ -44,15 +45,20 @@ module VideoThumb
44
45
  return image
45
46
  end
46
47
  elsif url.include? 'vimeo'
47
- regex = /^http:\/\/(?:.*?)\.?(vimeo)\.com\/(watch\?[^#]*v=(\w+)|(\d+)).*$/
48
+ regex = /^http:\/\/(?:.*?)\.?(vimeo)\.com\/(\d+).*$/
48
49
  url.gsub(regex) do
49
50
  vimeo_video_id = $2
50
51
  vimeo_video_json_url = 'http://vimeo.com/api/v2/video/%s.json' % vimeo_video_id
51
52
  image = JSON.parse(open(vimeo_video_json_url).read).first[vimeo_size] rescue nil
52
53
  return image
53
54
  end
55
+ elsif url.include? 'izlesene'
56
+ image = Nokogiri::HTML(open(url)).css("meta[property='og:image']").at_css('meta[property="og:image"]')['content']
57
+ return image
54
58
  else
55
59
  return false
56
60
  end
61
+ # http://www.youtube.com/watch?v=tjExIGFO6Zo
62
+ # http://www.izlesene.com/video/iyi-gelecek/7842972
57
63
  end
58
64
  end
data/video_thumb.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = VideoThumb::VERSION
9
9
  spec.authors = ["Tolga Gezginiş"]
10
10
  spec.email = ["tolga@gezginis.com"]
11
- spec.summary = %q{Youtube and Vimeo thumbnails}
12
- spec.description = %q{Get the thumbnails from Youtube and Vimeo videos}
11
+ spec.summary = %q{Youtube, Vimeo and İzlesene thumbnails}
12
+ spec.description = %q{Get the thumbnails from Youtube, Vimeo and İzlesene videos}
13
13
  spec.homepage = "https://github.com/tgezginis/video_thumb"
14
14
  spec.license = "MIT"
15
15
 
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency "json"
22
+ spec.add_runtime_dependency "nokogiri"
22
23
  spec.add_development_dependency "bundler", "~> 1.7"
23
24
  spec.add_development_dependency "rake", "~> 10.0"
24
25
  spec.add_development_dependency "minitest"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: video_thumb
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tolga Gezginiş
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-19 00:00:00.000000000 Z
11
+ date: 2014-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +80,7 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
- description: Get the thumbnails from Youtube and Vimeo videos
83
+ description: Get the thumbnails from Youtube, Vimeo and İzlesene videos
70
84
  email:
71
85
  - tolga@gezginis.com
72
86
  executables: []
@@ -105,6 +119,6 @@ rubyforge_project:
105
119
  rubygems_version: 2.4.3
106
120
  signing_key:
107
121
  specification_version: 4
108
- summary: Youtube and Vimeo thumbnails
122
+ summary: Youtube, Vimeo and İzlesene thumbnails
109
123
  test_files:
110
124
  - test/video_thumb_test.rb