followers_number 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbb73c1ef939f3f45f0bf3fe87afacc6d61fdb16d052b87e52c8c8fc6b60543c
4
- data.tar.gz: 82dc3bd643ad49d50616b720698d03f3203894d3cd19c1f5b0905728c8e2bff1
3
+ metadata.gz: 9a91655cedea38e7fbb2c0a3e2c82b4b38156cf7a12c105dded623602e2c1066
4
+ data.tar.gz: ce848866f2547f355e3ff4816fb4256d329510c013f1194b50bed196bc77854f
5
5
  SHA512:
6
- metadata.gz: aec9513e251a49dc8bc0b92118ee8f9c7d002e032202c57a349b4e5360455aeaedd92f0b20a74c88640ce67b94afbc67ab6522f9cb988ac4782014532c855dcd
7
- data.tar.gz: fa1b4112f2016442aafb7f7d938f07f3fea85f4eb296a1c97923bd962eca0a896589d81e391a34fdd8b47a7da8636fd41434de2e66dbc8624270895cf85a3e03
6
+ metadata.gz: 89151c60a7cf5b6b4ea22078622d91814ce9e225f4d0a1e06b364eb12e4a7575beb53acba2015d8d92c88c77f8cade7b8874143e08824a741269c4468e9d8119
7
+ data.tar.gz: 80510d79d2ac4db3a065671ab5fc0cd4d883af39a767af7f787b9d9954bcd1881544e7996636e0af790a368c5379b8c773c0ba8cd5c05d420f253a4a8bab63db
@@ -2,7 +2,8 @@ module FollowersNumber
2
2
  class Parser
3
3
  MAPPING = {
4
4
  'twitter.com' => FollowersNumber::Parsers::Twitter,
5
- 'instagram.com' => FollowersNumber::Parsers::Instagram
5
+ 'instagram.com' => FollowersNumber::Parsers::Instagram,
6
+ 'youtube.com' => FollowersNumber::Parsers::Youtube
6
7
  }
7
8
 
8
9
  def self.call(profile_url, response)
@@ -0,0 +1,9 @@
1
+ module FollowersNumber
2
+ module Parsers
3
+ class Youtube
4
+ def self.parse(html)
5
+ html.css("span.subscribed").text.split("\xC2\xA0").join.to_i
6
+ end
7
+ end
8
+ end
9
+ end
@@ -2,7 +2,7 @@ module FollowersNumber
2
2
  class Validator
3
3
  class InvalidProfileURL < StandardError; end
4
4
 
5
- NETWORKS = %w[twitter.com instagram.com]
5
+ NETWORKS = %w[twitter.com instagram.com youtube.com]
6
6
 
7
7
  def self.validate!(profile_url)
8
8
  unless NETWORKS.include?(URI.parse(profile_url.to_s.downcase).host)
@@ -6,7 +6,7 @@ module FollowersNumber
6
6
  #
7
7
  # @return [String]
8
8
  def to_s
9
- "0.0.3"
9
+ "0.0.4"
10
10
  end
11
11
  end
12
12
  end
@@ -4,6 +4,7 @@ require 'json'
4
4
 
5
5
  require_relative 'followers_number/parsers/twitter'
6
6
  require_relative 'followers_number/parsers/instagram'
7
+ require_relative 'followers_number/parsers/youtube'
7
8
 
8
9
  require_relative 'followers_number/request'
9
10
  require_relative 'followers_number/validator'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: followers_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Dąbrowski
@@ -68,6 +68,7 @@ files:
68
68
  - lib/followers_number/parser.rb
69
69
  - lib/followers_number/parsers/instagram.rb
70
70
  - lib/followers_number/parsers/twitter.rb
71
+ - lib/followers_number/parsers/youtube.rb
71
72
  - lib/followers_number/request.rb
72
73
  - lib/followers_number/validator.rb
73
74
  - lib/followers_number/version.rb