linkser 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Eduardo Casanova Cuesta
1
+ Copyright (c) 2012 Universidad Politécnica de Madrid
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.textile CHANGED
@@ -4,18 +4,17 @@ Linkser is a link parser for Ruby. It gets an URI, tries to dereference it and r
4
4
 
5
5
  h2. Installation
6
6
 
7
- #TODO
7
+ Add to your Gemfile @gem 'linkser'@ and @bundle update@
8
8
 
9
- h2. Using Mailboxer.
10
9
 
11
- #TODO
10
+ h2. Using Linkser
12
11
 
13
- h2. License
12
+ bc.. l = Linkser.parse 'https://github.com/ging/linkser'
13
+ l.title #=> "linkser"
14
+ l.description #=> "linkser - Linkser is a link parser for Ruby. It gets an URI, tries to dereference it and returns the relevant information about the resource."
14
15
 
15
- Copyright (c) 2011 Universidad Politécnica de Madrid
16
+ y = Linkser.parse 'http://youtube.com/someyoutubevideo'
17
+ y.title #=> the title of the video
18
+ y.images #=> the thumbnails of the video
19
+ y.resource.url #=> the url of the video
16
20
 
17
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -60,7 +60,8 @@ module Linkser
60
60
  nokogiri.css('img').each do |img|
61
61
  break if images.length >= max_images
62
62
  img_src = img.get_attribute("src")
63
- img_src = complete_url img_src, url
63
+ next unless img_src
64
+ img_src = complete_url img_src, last_url
64
65
  img_uri = URI.parse(img_src)
65
66
  img_ext = File.extname(img_uri.path)
66
67
  img_name = File.basename(img_uri.path,img_ext)
@@ -97,9 +98,10 @@ module Linkser
97
98
 
98
99
  def complete_url src, url
99
100
  uri = URI.parse(url)
100
- base_url = "http://" + uri.host + (uri.port!=80 ? ":" + uri.port.to_s : "")
101
- relative_url = "http://" + uri.host + (uri.port!=80 ? ":" + uri.port.to_s : "") + uri.path
102
- if src.index("http://")==0
101
+ scheme = "#{uri.scheme}://"
102
+ base_url = scheme + uri.host + (uri.port!=80 ? ":" + uri.port.to_s : "")
103
+ relative_url = scheme + uri.host + (uri.port!=80 ? ":" + uri.port.to_s : "") + uri.path
104
+ if src.index(scheme)==0
103
105
  src
104
106
  elsif src.index("/")==0
105
107
  base_url + src
@@ -1,3 +1,3 @@
1
1
  module Linkser
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linkser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-23 00:00:00.000000000Z
12
+ date: 2012-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &87415540 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *87415540
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: nokogiri
27
- requirement: &87415290 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 1.4.0
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *87415290
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.4.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rmagick
38
- requirement: &87415040 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: 2.13.1
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *87415040
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.13.1
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: ruby-imagespec
49
- requirement: &87414810 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: 0.2.0
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *87414810
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.2.0
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: ging-opengraph
60
- requirement: &87414580 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
@@ -65,10 +85,15 @@ dependencies:
65
85
  version: 0.0.4
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *87414580
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.0.4
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: rspec
71
- requirement: &87414340 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ! '>='
@@ -76,7 +101,12 @@ dependencies:
76
101
  version: 2.7.0
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *87414340
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 2.7.0
80
110
  description: Linkser is a link parser for Ruby. It gets an URI, tries to dereference
81
111
  it and returns the relevant information about the resource.
82
112
  email:
@@ -121,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
151
  version: '0'
122
152
  requirements: []
123
153
  rubyforge_project:
124
- rubygems_version: 1.8.12
154
+ rubygems_version: 1.8.24
125
155
  signing_key:
126
156
  specification_version: 3
127
157
  summary: A link parser for Ruby