url_scrubber 0.8.7 → 0.8.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/url_scrubber/version.rb +1 -1
- data/lib/url_scrubber.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTg0Y2U4MGIxODA2ODYyNDYzMDUyMGZjYmY4MWYwNTlmNGI3YjI3Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTM3YWVhMzFkMDc0ZDI0NTdlYjQyZmIyYmEwYWU5ZDI5YzQ3ZWY5Nw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDVmZDhjYjllZTNkOWIyNjIyMTIxMWIyYjAyZjAzM2M4NTRlMTA1MDczM2M0
|
10
|
+
MjJkMjJiOTYyZmNkNmMxODE2YmIxYjVkYmFmY2QwZDgxZjgyNGMwZGVhNjRi
|
11
|
+
NzdkNGM3YmFmZjFhOTFjNTI0YjZiMjlmNTc4YzcxOWZjZmI3YTI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjczOTUwYjQyNzI3MDVjOTQxNTVmMjhlMTkyZjNjNjQzYzgwOTMxYTA2YzBk
|
14
|
+
MzY1ODgzYjE1ZDFmYmNhNWQ2OWNlODhhNDc4ZDIyMDI4MTA5NTdkYjRiM2Q1
|
15
|
+
MGRkZjA3MGY1ZmU0MDdiNjk1MDM2YWQxNTIwMWJjZDcxN2YxZDc=
|
data/lib/url_scrubber/version.rb
CHANGED
data/lib/url_scrubber.rb
CHANGED
@@ -7,6 +7,7 @@ USER_AGENT = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebK
|
|
7
7
|
module UrlScrubber
|
8
8
|
|
9
9
|
def self.scrub(url)
|
10
|
+
return url if url.blank?
|
10
11
|
url = url.clone # don't modify the original argument
|
11
12
|
|
12
13
|
m = url.match(/(htt?ps?:\/\/\S*)/i)
|
@@ -285,6 +286,12 @@ module UrlScrubber
|
|
285
286
|
regex3 = /^(?<url>(https?:\/\/)((www|business)\.)?facebook\.com\/(?<uname>[^\?\/]*))($|\/$|\/(about|timeline|info|app_.*)?)/i
|
286
287
|
regex4 = /^(?<url>(https?:\/\/)((www|business)\.)?facebook\.com\/)(?<php>home.php\?([#!]+\/)*)(?<uname>.*)/i
|
287
288
|
|
289
|
+
# If the user gives us a path to a Post, "http://facebook.com/LoansByJanet/posts/1691075027771418"
|
290
|
+
# then drop the post part, "/posts/1691075027771418" to get the base url, "http://facebook.com/LoansByJanet/"
|
291
|
+
if mdata = /^(?<base_url>.+)\/posts\/(?<postid>[0-9]+).*$/.match(url)
|
292
|
+
url = mdata[:base_url]
|
293
|
+
end
|
294
|
+
|
288
295
|
if url.match("/media/albums") || url.match("/media/set")
|
289
296
|
# puts "media"
|
290
297
|
url = url.match('\&') ? url.split('&',2)[0] : url
|
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.8
|
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:
|
14
|
+
date: 2017-09-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|