social_media_parser 0.1.1 → 0.1.2
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 +4 -4
- data/Gemfile +2 -0
- data/README.md +8 -3
- data/lib/social_media_parser/link.rb +1 -0
- data/lib/social_media_parser/provider/base.rb +1 -0
- data/lib/social_media_parser/provider/youtube.rb +1 -1
- data/lib/social_media_parser/version.rb +1 -1
- data/spec/social_media_parser/provider/youtube_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81e1743fef080d76703d8f0ac2bbc1bc8a89d7da
|
4
|
+
data.tar.gz: 18e4525c15ccb56b71b6a72392d6588756e070ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 568853ad7b2cb1998b5662ee302065e41b5fe2bdd70ce55e2d34d6388a7e158cb566a462ff96f6063651b0467e85dc4ee2547bd5f3802d78d4102781a66766aa
|
7
|
+
data.tar.gz: b61fc4e3a7090d05ecc9b2008b39c6b5ee0a240136272710e8901747a37d0a7f33ca455d055a1c84d81d5c8e9f97192b521811e46cb9a7c7862dfaa3416470e6
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
Parse social media attributes from url or construct url from attributes.
|
4
4
|
|
5
|
-
[](https://codeclimate.com/github/mynewsdesk/social_media_parser)
|
6
5
|
[](https://semaphoreapp.com/mynewsdesk/social_media_parser)
|
6
|
+
[](https://codeclimate.com/github/mynewsdesk/social_media_parser)
|
7
|
+
[](https://codeclimate.com/github/mynewsdesk/social_media_parser)
|
7
8
|
|
8
9
|
## Installation
|
9
10
|
|
@@ -37,7 +38,7 @@ parser.url
|
|
37
38
|
=> "https://www.facebook.com/teamcoco"
|
38
39
|
```
|
39
40
|
|
40
|
-
`SocialMediaParser
|
41
|
+
`SocialMediaParser.parse` accepts either a url string or a hash, that accepts
|
41
42
|
|
42
43
|
```ruby
|
43
44
|
{
|
@@ -63,4 +64,8 @@ link.url
|
|
63
64
|
=> "http://www.ruby-lang.org/en/"
|
64
65
|
```
|
65
66
|
|
66
|
-
The `url` method will always return a clean url, prepending http schema if needed and validating the top domain, using public_suffix.
|
67
|
+
The `url` method will always return a clean url, prepending http schema if needed and validating the top domain, using [public_suffix](https://github.com/weppos/publicsuffix-ruby).
|
68
|
+
|
69
|
+
## Requirements
|
70
|
+
|
71
|
+
Ruby > 1.9
|
@@ -3,7 +3,7 @@ require 'social_media_parser/provider/base'
|
|
3
3
|
module SocialMediaParser
|
4
4
|
module Provider
|
5
5
|
class Youtube < Base
|
6
|
-
URL_REGEX = /(?:(?:http|https):\/\/)?(?:www.)?youtube\.com\/(?:user
|
6
|
+
URL_REGEX = /(?:(?:http|https):\/\/)?(?:www.)?youtube\.com\/(?!channel|playlist)(?:user\/|)([\w\-\.]{1,})/i
|
7
7
|
|
8
8
|
def provider
|
9
9
|
'youtube'
|
@@ -47,8 +47,8 @@ describe SocialMediaParser do
|
|
47
47
|
expect(parser.username).to eq "collegehumor"
|
48
48
|
end
|
49
49
|
|
50
|
-
it "parses username from url
|
51
|
-
parser = described_class.parse "https://www.youtube.com/
|
50
|
+
it "parses username from shortcut url" do
|
51
|
+
parser = described_class.parse "https://www.youtube.com/collegehumor"
|
52
52
|
expect(parser.username).to eq "collegehumor"
|
53
53
|
end
|
54
54
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_media_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Nordin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-10-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: public_suffix
|