url_scrubber 0.8.2 → 0.8.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.
- checksums.yaml +8 -8
- data/lib/url_scrubber/version.rb +1 -1
- data/lib/url_scrubber.rb +4 -2
- data/spec/url_scrubber_spec.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWNmYjEyOTYxNjVmMGI4Mjg5ODVjMzc1ZjQ3ZmMwODA1NmYxZTMwNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2Y4NzNkMWZkMWNlMjA4M2M2Y2QxZmQ0MWFmYTg0NzRlN2UxNmI3ZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGY3NmVkOTBmNjI5ZDUzYmEwZDE2OTcwZWU2ZDM2YTJjMzI2NzQwYzNhMzdm
|
10
|
+
MTIyNzUwNTY0M2Q3ODI0MzZlZWJhOGQ0M2Y4MzE0MWQ4ZjA4YjliZjIxZDdh
|
11
|
+
MTZkNTM3YjNiN2U0NWViMmNjZTViOTBlN2E5NGVkNjkzNTQyZDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmExM2U0NjY4YzM1ZmY3ZTU2MmU0ZTdiNmY5ZDU5YzQ5ZWI4MWM1YWUwNjM0
|
14
|
+
NmY2Y2Q5MDgwNWVjYWQ0Yzk5OTFmMWY3Nzg2MmYyZGExZWFkMzQ5NThmMjhm
|
15
|
+
YzQ4YTY3ZDdkYjgwZGZkMzM5Y2U0ODMwNWFiNzM3NzY4MmFhZjk=
|
data/lib/url_scrubber/version.rb
CHANGED
data/lib/url_scrubber.rb
CHANGED
@@ -22,7 +22,7 @@ module UrlScrubber
|
|
22
22
|
remove_www!(url)
|
23
23
|
remove_html_tags!(url)
|
24
24
|
url = drop_anchor!(special_cases(url))
|
25
|
-
url.
|
25
|
+
url.sub!(/,+$/, "") # remove one or more trailing commas at the end of the URL
|
26
26
|
url.gsub!(/\/+$/, '') # remove any trailing slashes (/) in the resulting URL
|
27
27
|
return url
|
28
28
|
end
|
@@ -198,7 +198,9 @@ module UrlScrubber
|
|
198
198
|
end
|
199
199
|
|
200
200
|
def self.sc_youtube(url)
|
201
|
-
|
201
|
+
# We need to allow the /user version of the URL due to how YouTube allows users to have their own URL
|
202
|
+
# which is not separate channel with it's own customUrl.
|
203
|
+
# url.sub!('youtube.com/user/', 'youtube.com/')
|
202
204
|
url.sub!('youtube.com/profile?user=', 'youtube.com/')
|
203
205
|
url
|
204
206
|
end
|
data/spec/url_scrubber_spec.rb
CHANGED
@@ -32,8 +32,8 @@ describe UrlScrubber do
|
|
32
32
|
|
33
33
|
|
34
34
|
describe 'with youtube urls' do
|
35
|
-
it 'should drop /user/ if it exists' do
|
36
|
-
UrlScrubber.scrub('http://youtube.com/user/absolutely').should eq('http://youtube.com/absolutely')
|
35
|
+
it 'should NOT drop /user/ if it exists' do
|
36
|
+
UrlScrubber.scrub('http://youtube.com/user/absolutely').should eq('http://youtube.com/user/absolutely')
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should handle /profile?user= urls' do
|
@@ -41,7 +41,7 @@ describe UrlScrubber do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'should not kick in for a non-youtube url' do
|
44
|
-
UrlScrubber.scrub('http://example.com/user
|
44
|
+
UrlScrubber.scrub('http://example.com/profile?user=absolutely').should_not eq('http://example.com/absolutely')
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: url_scrubber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin Langton
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-12-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.4.8
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: Clean up URLs.
|