url_expander 0.1.2 → 0.1.3

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.
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = url_expander
2
2
 
3
- The idea is simple, One expander to expand them all. I've been working on an analytical tool for twitter.com and i wanted a way to expand all the shortened urls. Url_expander is a good start, it covers 34 services. I tried to make it as simple as possible to extend & add new services.
3
+ The idea is simple, One expander to expand them all. I've been working on an analytical tool for twitter.com and i wanted a way to expand all the shortened urls. Url_expander is a good start, it covers (13,231 bit.ly domains + 28 different services). I tried to make it as simple as possible to extend & add new services.
4
4
 
5
5
  == Install
6
6
 
@@ -34,11 +34,11 @@ Require and Use
34
34
 
35
35
  * bit.ly and bitly domains(13,231 domains as of July 19-2011)
36
36
  UrlExpander::Client.expand("http://bit.ly/qpshuI")
37
- UrlExpander::Client.expand("http://4sq.com/pQkuZk")
38
- UrlExpander::Client.expand("http://fxn.ws/pBewvL")
39
- UrlExpander::Client.expand("http://tcrn.ch/oe50JN")
37
+ UrlExpander::Client.expand("http://4sq.com/pQkuZk")
38
+ UrlExpander::Client.expand("http://fxn.ws/pBewvL")
39
+ UrlExpander::Client.expand("http://tcrn.ch/oe50JN")
40
40
  UrlExpander::Client.expand("http://nyti.ms/dzy2b7")
41
- ....
41
+ ....
42
42
 
43
43
  * j.mp
44
44
  UrlExpander::Client.expand("http://j.mp/qpshuI")
@@ -103,7 +103,12 @@ Require and Use
103
103
  UrlExpander::Client.expand("http://shorl.com/nigekohalenu")
104
104
  * simurl.com
105
105
  UrlExpander::Client.expand("http://simurl.com/fendaz")
106
-
106
+ * fb.me
107
+ UrlExpander::Client.expand("http://fb.me/KLfffqy3")
108
+ * itun.es
109
+ UrlExpander::Client.expand("http://itun.es/igG8XL")
110
+ * ur1.ca
111
+ UrlExpander::Client.expand("http://ur1.ca/4qcly")
107
112
 
108
113
 
109
114
  == Adding a new service
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -0,0 +1,41 @@
1
+ module UrlExpander
2
+ module Expanders
3
+
4
+ #
5
+ # Expand dld.bz URLS
6
+ # Usage:
7
+ # UrlExpander::Client.expand("http://dld.bz/ahsJ2")
8
+ #
9
+ class Dldbz < UrlExpander::Expanders::API
10
+ # NOTICE: We ignored the / before the key
11
+ PATTERN = %r'(http://dld\.bz/([\w/]+))'
12
+
13
+ attr_reader :parent_klass, :short_url
14
+
15
+ def initialize(short_url, options={})
16
+ @parent_klass = self
17
+ @short_url = short_url
18
+ fetch_url
19
+ end
20
+
21
+ class Request
22
+ include HTTParty
23
+ base_uri 'dld.bz'
24
+ format :json
25
+ end
26
+
27
+
28
+ private
29
+
30
+ def fetch_url
31
+ data = JSON.parse Request.get("/api/expand?url=#{@short_url}").response.body
32
+ if(data.include?("data"))
33
+ @long_url = data["data"]["long_url"]
34
+ else
35
+ error = data["error"]
36
+ raise UrlExpander::Error.new(error["message"],error["code"])
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,23 @@
1
+ module UrlExpander
2
+ module Expanders
3
+ #
4
+ # Expand su.pr URLS
5
+ # Usage:
6
+ # UrlExpander::Client.expand("http://su.pr/Ad5dk1")
7
+ #
8
+ class Supr < UrlExpander::Expanders::Basic
9
+ PATTERN = %r'(http://su\.pr(/[\w/]+))'
10
+ attr_reader :parent_klass
11
+
12
+ def initialize(short_url="", options={})
13
+ @parent_klass = self
14
+ super(short_url, options)
15
+ end
16
+
17
+ class Request
18
+ include HTTParty
19
+ base_uri 'http://su.pr'
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ module UrlExpander
2
+ module Expanders
3
+ #
4
+ # Expand t11.me URLS
5
+ # Usage:
6
+ # UrlExpander::Client.expand("http://t11.me/YZI-Y6")
7
+ #
8
+ class T11me < UrlExpander::Expanders::Basic
9
+ PATTERN = %r'(http://t11\.me(/[\w-/]+))'
10
+ attr_reader :parent_klass
11
+
12
+ def initialize(short_url="", options={})
13
+ @parent_klass = self
14
+ super(short_url, options)
15
+ end
16
+
17
+ def fetch_url(path)
18
+ super("/shortlink#{path}")
19
+ end
20
+
21
+ class Request
22
+ include HTTParty
23
+ base_uri 'http://tap11.com'
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -10,7 +10,7 @@ module UrlExpander
10
10
  autoload :Tinyurl, 'basic/tinyurl'
11
11
  autoload :Twurlnl, 'basic/twurlnl'
12
12
  autoload :Shrtst, 'basic/shrtst'
13
- autoload :Snipurl, 'basic/Snipurl'
13
+ autoload :Snipurl, 'basic/snipurl'
14
14
  autoload :Adjix, 'basic/adjix'
15
15
  autoload :Youtube, 'basic/youtube'
16
16
  autoload :Tinycc, 'basic/tinycc'
@@ -28,7 +28,8 @@ module UrlExpander
28
28
  autoload :Itunes, 'basic/itunes'
29
29
  autoload :Fbme, 'basic/fbme'
30
30
  autoload :Ur1ca, 'basic/ur1ca'
31
-
31
+ autoload :Supr, 'basic/supr'
32
+ autoload :T11me, 'basic/t11me'
32
33
 
33
34
  # Using API
34
35
  autoload :Bitly, 'api/bitly'
@@ -40,6 +41,9 @@ module UrlExpander
40
41
  autoload :Googl, 'api/googl'
41
42
  autoload :Decenturl, 'api/decenturl'
42
43
  autoload :Xrlus, 'api/xrlus'
44
+ autoload :Dldbz, 'api/dldbz'
45
+
46
+
43
47
 
44
48
  # Using Scrapper
45
49
  autoload :Qsrli, 'scrape/qsrli'
@@ -1,4 +1,4 @@
1
- require 'Hpricot'
1
+ require 'hpricot'
2
2
 
3
3
  module UrlExpander
4
4
  module Expanders
data/url_expander.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{url_expander}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Moski}]
12
- s.date = %q{2011-07-19}
11
+ s.authors = ["Moski"]
12
+ s.date = %q{2011-07-22}
13
13
  s.description = %q{Expand short urls from shortning services shuch as bitly and tinyurl}
14
14
  s.email = %q{abushaikh@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "lib/url_expander/expanders/api/budurl.rb",
33
33
  "lib/url_expander/expanders/api/cligs.rb",
34
34
  "lib/url_expander/expanders/api/decenturl.rb",
35
+ "lib/url_expander/expanders/api/dldbz.rb",
35
36
  "lib/url_expander/expanders/api/googl.rb",
36
37
  "lib/url_expander/expanders/api/isgd.rb",
37
38
  "lib/url_expander/expanders/api/xrlus.rb",
@@ -49,6 +50,8 @@ Gem::Specification.new do |s|
49
50
  "lib/url_expander/expanders/basic/owly.rb",
50
51
  "lib/url_expander/expanders/basic/shrtst.rb",
51
52
  "lib/url_expander/expanders/basic/snipurl.rb",
53
+ "lib/url_expander/expanders/basic/supr.rb",
54
+ "lib/url_expander/expanders/basic/t11me.rb",
52
55
  "lib/url_expander/expanders/basic/tco.rb",
53
56
  "lib/url_expander/expanders/basic/tighturl.rb",
54
57
  "lib/url_expander/expanders/basic/tinycc.rb",
@@ -67,9 +70,9 @@ Gem::Specification.new do |s|
67
70
  "url_expander.gemspec"
68
71
  ]
69
72
  s.homepage = %q{http://github.com/moski/url_expander}
70
- s.licenses = [%q{MIT}]
71
- s.require_paths = [%q{lib}]
72
- s.rubygems_version = %q{1.8.5}
73
+ s.licenses = ["MIT"]
74
+ s.require_paths = ["lib"]
75
+ s.rubygems_version = %q{1.6.2}
73
76
  s.summary = %q{Expand short url from different services}
74
77
 
75
78
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url_expander
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 29
4
5
  prerelease:
5
- version: 0.1.2
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 3
10
+ version: 0.1.3
6
11
  platform: ruby
7
12
  authors:
8
13
  - Moski
@@ -10,84 +15,112 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-07-19 00:00:00 Z
18
+ date: 2011-07-22 00:00:00 +03:00
19
+ default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
- name: httparty
22
+ prerelease: false
23
+ type: :runtime
17
24
  requirement: &id001 !ruby/object:Gem::Requirement
18
25
  none: false
19
26
  requirements:
20
27
  - - ">="
21
28
  - !ruby/object:Gem::Version
29
+ hash: 5
30
+ segments:
31
+ - 0
32
+ - 6
33
+ - 1
22
34
  version: 0.6.1
23
- type: :runtime
24
- prerelease: false
35
+ name: httparty
25
36
  version_requirements: *id001
26
37
  - !ruby/object:Gem::Dependency
27
- name: json
38
+ prerelease: false
39
+ type: :runtime
28
40
  requirement: &id002 !ruby/object:Gem::Requirement
29
41
  none: false
30
42
  requirements:
31
43
  - - ">="
32
44
  - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
33
48
  version: "0"
34
- type: :runtime
35
- prerelease: false
49
+ name: json
36
50
  version_requirements: *id002
37
51
  - !ruby/object:Gem::Dependency
38
- name: hpricot
52
+ prerelease: false
53
+ type: :runtime
39
54
  requirement: &id003 !ruby/object:Gem::Requirement
40
55
  none: false
41
56
  requirements:
42
57
  - - ">="
43
58
  - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
44
62
  version: "0"
45
- type: :runtime
46
- prerelease: false
63
+ name: hpricot
47
64
  version_requirements: *id003
48
65
  - !ruby/object:Gem::Dependency
49
- name: shoulda
66
+ prerelease: false
67
+ type: :development
50
68
  requirement: &id004 !ruby/object:Gem::Requirement
51
69
  none: false
52
70
  requirements:
53
71
  - - ">="
54
72
  - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
55
76
  version: "0"
56
- type: :development
57
- prerelease: false
77
+ name: shoulda
58
78
  version_requirements: *id004
59
79
  - !ruby/object:Gem::Dependency
60
- name: bundler
80
+ prerelease: false
81
+ type: :development
61
82
  requirement: &id005 !ruby/object:Gem::Requirement
62
83
  none: false
63
84
  requirements:
64
85
  - - ~>
65
86
  - !ruby/object:Gem::Version
87
+ hash: 23
88
+ segments:
89
+ - 1
90
+ - 0
91
+ - 0
66
92
  version: 1.0.0
67
- type: :development
68
- prerelease: false
93
+ name: bundler
69
94
  version_requirements: *id005
70
95
  - !ruby/object:Gem::Dependency
71
- name: jeweler
96
+ prerelease: false
97
+ type: :development
72
98
  requirement: &id006 !ruby/object:Gem::Requirement
73
99
  none: false
74
100
  requirements:
75
101
  - - ~>
76
102
  - !ruby/object:Gem::Version
103
+ hash: 7
104
+ segments:
105
+ - 1
106
+ - 6
107
+ - 4
77
108
  version: 1.6.4
78
- type: :development
79
- prerelease: false
109
+ name: jeweler
80
110
  version_requirements: *id006
81
111
  - !ruby/object:Gem::Dependency
82
- name: rcov
112
+ prerelease: false
113
+ type: :development
83
114
  requirement: &id007 !ruby/object:Gem::Requirement
84
115
  none: false
85
116
  requirements:
86
117
  - - ">="
87
118
  - !ruby/object:Gem::Version
119
+ hash: 3
120
+ segments:
121
+ - 0
88
122
  version: "0"
89
- type: :development
90
- prerelease: false
123
+ name: rcov
91
124
  version_requirements: *id007
92
125
  description: Expand short urls from shortning services shuch as bitly and tinyurl
93
126
  email: abushaikh@gmail.com
@@ -114,6 +147,7 @@ files:
114
147
  - lib/url_expander/expanders/api/budurl.rb
115
148
  - lib/url_expander/expanders/api/cligs.rb
116
149
  - lib/url_expander/expanders/api/decenturl.rb
150
+ - lib/url_expander/expanders/api/dldbz.rb
117
151
  - lib/url_expander/expanders/api/googl.rb
118
152
  - lib/url_expander/expanders/api/isgd.rb
119
153
  - lib/url_expander/expanders/api/xrlus.rb
@@ -131,6 +165,8 @@ files:
131
165
  - lib/url_expander/expanders/basic/owly.rb
132
166
  - lib/url_expander/expanders/basic/shrtst.rb
133
167
  - lib/url_expander/expanders/basic/snipurl.rb
168
+ - lib/url_expander/expanders/basic/supr.rb
169
+ - lib/url_expander/expanders/basic/t11me.rb
134
170
  - lib/url_expander/expanders/basic/tco.rb
135
171
  - lib/url_expander/expanders/basic/tighturl.rb
136
172
  - lib/url_expander/expanders/basic/tinycc.rb
@@ -147,6 +183,7 @@ files:
147
183
  - test/helper.rb
148
184
  - test/test_url_expander.rb
149
185
  - url_expander.gemspec
186
+ has_rdoc: true
150
187
  homepage: http://github.com/moski/url_expander
151
188
  licenses:
152
189
  - MIT
@@ -160,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
197
  requirements:
161
198
  - - ">="
162
199
  - !ruby/object:Gem::Version
163
- hash: 802013931067991244
200
+ hash: 3
164
201
  segments:
165
202
  - 0
166
203
  version: "0"
@@ -169,11 +206,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
206
  requirements:
170
207
  - - ">="
171
208
  - !ruby/object:Gem::Version
209
+ hash: 3
210
+ segments:
211
+ - 0
172
212
  version: "0"
173
213
  requirements: []
174
214
 
175
215
  rubyforge_project:
176
- rubygems_version: 1.8.5
216
+ rubygems_version: 1.6.2
177
217
  signing_key:
178
218
  specification_version: 3
179
219
  summary: Expand short url from different services