turl 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +24 -0
- data/lib/turl/normalizer.rb +3 -0
- data/lib/turl/version.rb +1 -1
- data/turl.gemspec +1 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1619dd678fef5c989ef065a0d5dd34a7d05815eecc761605b4792c9074e78eb
|
4
|
+
data.tar.gz: 63f3d0b79a9b9905cff0c5033083b92186084d4780a6c8c12a5395241e66d0d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d29736b477e7e4297f2655939c665c42400a481313c40f7a60ad342b7c6b67e6c671dd211b356aeed48351d9648ed141948f9ca332577753adfa7232e6a3f00
|
7
|
+
data.tar.gz: b58a79b7df40e1ab49f40e0b1dffa7be9c5108840877fdf7b9608385009b119bed9de76750dd6b91c109d1bc861304cfcbe9320d60bb28b13b4e528fabab664e
|
data/LICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
2
|
+
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
4
|
+
distribute this software, either in source code form or as a compiled
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
6
|
+
means.
|
7
|
+
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
9
|
+
of this software dedicate any and all copyright interest in the
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
11
|
+
of the public at large and to the detriment of our heirs and
|
12
|
+
successors. We intend this dedication to be an overt act of
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
14
|
+
software under copyright law.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
For more information, please refer to <https://unlicense.org>
|
data/lib/turl/normalizer.rb
CHANGED
@@ -21,10 +21,13 @@ module Turl
|
|
21
21
|
return ret.normalized_url if ret
|
22
22
|
|
23
23
|
parsed = URI.parse(url)
|
24
|
+
query = parsed.query && URI.decode_www_form(parsed.query).to_h
|
24
25
|
case
|
25
26
|
when parsed.host == 'htn.to'
|
26
27
|
resp = head(parsed)
|
27
28
|
normalize_internal(resp['x-redirect-to'] || url, path: path)
|
29
|
+
when parsed.host == 'b.hatena.ne.jp' && query.dig('url')
|
30
|
+
normalize_internal(query['url'], path: path)
|
28
31
|
else
|
29
32
|
resp = head(parsed)
|
30
33
|
if resp.is_a?(Net::HTTPRedirection) && resp['location']
|
data/lib/turl/version.rb
CHANGED
data/turl.gemspec
CHANGED
@@ -9,6 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.summary = %q{}
|
10
10
|
spec.description = %q{}
|
11
11
|
spec.homepage = "https://github.com/pocke/turl"
|
12
|
+
spec.license = 'Unlicense'
|
12
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
14
|
|
14
15
|
spec.metadata["homepage_uri"] = spec.homepage
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masataka Pocke Kuwabara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter
|
@@ -119,6 +119,7 @@ extra_rdoc_files: []
|
|
119
119
|
files:
|
120
120
|
- ".gitignore"
|
121
121
|
- Gemfile
|
122
|
+
- LICENSE
|
122
123
|
- README.md
|
123
124
|
- Rakefile
|
124
125
|
- bin/console
|
@@ -141,7 +142,8 @@ files:
|
|
141
142
|
- lib/turl/web.rb
|
142
143
|
- turl.gemspec
|
143
144
|
homepage: https://github.com/pocke/turl
|
144
|
-
licenses:
|
145
|
+
licenses:
|
146
|
+
- Unlicense
|
145
147
|
metadata:
|
146
148
|
homepage_uri: https://github.com/pocke/turl
|
147
149
|
source_code_uri: https://github.com/pocke/turl
|
@@ -160,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
162
|
- !ruby/object:Gem::Version
|
161
163
|
version: '0'
|
162
164
|
requirements: []
|
163
|
-
rubygems_version: 3.2
|
165
|
+
rubygems_version: 3.1.2
|
164
166
|
signing_key:
|
165
167
|
specification_version: 4
|
166
168
|
summary: ''
|