network_profile 0.2.0 → 0.3.0

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: 7617b43af0544fe036d6891c054523c2737976a4affd5149dff99b9ffec79d31
4
- data.tar.gz: d33e58df2c9fb4af37e3867e421cb7fdef3a054f234a2d86fa196d9b61bed831
3
+ metadata.gz: e68f15ab6289719cc178f3c5ed19929ee1aeb9c4696df0e81d4796eaff5df54a
4
+ data.tar.gz: a7fe6b19cf46bbf92a926cb2209e207e27c79f39fee3b528fac6e4fcc60b5078
5
5
  SHA512:
6
- metadata.gz: 6f9b80fc70a71c2f16487c6c4bb4e7e7d25dcd94cd723b020b18d8317c61906f730da76d0cdda1ffac01a253669dc7ade1116b05da2508eb367c691a4588636c
7
- data.tar.gz: eaf8d8b3dbf76c8d0f5e0f9c297824ad13d01b6946e2d8f1455f7184cb78ad9230683b83d9812ae814a15391b98b3896485d17a37da7dd84877a9e921f14fe25
6
+ metadata.gz: fd35d91176939e964ff5f0c4cc674dd92c0110952885af131283f301721f92eef1b82e4e9b749223b2dc7d9cc93fb22481cc97342981fba45579a71b44116a4a
7
+ data.tar.gz: c9c815db05afaf507dbb46a46c52088214f087c83b962899a06a185e0e4abccf0e232e3c93db7b06fedc81f1605e9d1f72150eea7f7ff7c262da500b4505d634
data/Gemfile CHANGED
@@ -8,3 +8,6 @@ gem "pry"
8
8
  gem "rspec", ">= 3.5"
9
9
  gem "vcr"
10
10
  gem "webmock"
11
+ gem 'rbs'
12
+
13
+ gem "rexml", "~> 3.2"
@@ -1,16 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- network_profile (0.2.0)
4
+ network_profile (0.3.0)
5
5
  activesupport (>= 5.0.0)
6
6
  nokogiri
7
7
  rdf-microdata
8
+ rexml
8
9
  typhoeus
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- activesupport (6.0.3.3)
14
+ activesupport (6.0.3.4)
14
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
16
  i18n (>= 0.7, < 2)
16
17
  minitest (~> 5.1)
@@ -42,6 +43,7 @@ GEM
42
43
  method_source (~> 1.0)
43
44
  public_suffix (4.0.6)
44
45
  rake (12.3.3)
46
+ rbs (0.14.0)
45
47
  rdf (3.1.6)
46
48
  hamster (~> 3.0)
47
49
  link_header (~> 0.0, >= 0.0.8)
@@ -52,6 +54,7 @@ GEM
52
54
  rdf-xsd (~> 3.1)
53
55
  rdf-xsd (3.1.0)
54
56
  rdf (~> 3.1)
57
+ rexml (3.2.4)
55
58
  rspec (3.9.0)
56
59
  rspec-core (~> 3.9.0)
57
60
  rspec-expectations (~> 3.9.0)
@@ -75,7 +78,7 @@ GEM
75
78
  addressable (>= 2.3.6)
76
79
  crack (>= 0.3.2)
77
80
  hashdiff (>= 0.4.0, < 2.0.0)
78
- zeitwerk (2.4.0)
81
+ zeitwerk (2.4.1)
79
82
 
80
83
  PLATFORMS
81
84
  ruby
@@ -84,6 +87,8 @@ DEPENDENCIES
84
87
  network_profile!
85
88
  pry
86
89
  rake (~> 12.0)
90
+ rbs
91
+ rexml (~> 3.2)
87
92
  rspec (>= 3.5)
88
93
  vcr
89
94
  webmock
@@ -6,14 +6,14 @@ require 'active_support/core_ext/module/attribute_accessors'
6
6
  module NetworkProfile
7
7
  class Error < StandardError; end
8
8
 
9
- mattr_accessor :headers, :github_api_key
9
+ mattr_accessor :headers, :github_api_key, :proxy, :proxy_user_pass
10
10
 
11
11
  self.headers = {
12
- 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
13
- 'Accept-Language' => 'de,en-US;q=0.7,en;q=0.3',
14
- 'Referer' => 'https://www.google.com',
15
- 'DNT' => '1',
16
- 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:73.0) Gecko/20100101 Firefox/73.0',
12
+ "Accept"=>"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
13
+ "Accept-Language"=>"de",
14
+ "User-Agent"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36",
15
+ "Referer" => "https://www.google.com",
16
+ "Cache-Control"=>"max-age=0"
17
17
  }
18
18
  self.github_api_key = nil
19
19
 
@@ -77,7 +77,15 @@ module NetworkProfile
77
77
  private
78
78
 
79
79
  def response
80
- @response ||= Typhoeus.get(@link, headers: NetworkProfile.headers, followlocation: true)
80
+ options = {
81
+ headers: NetworkProfile.headers,
82
+ followlocation: true
83
+ }
84
+ if NetworkProfile.proxy
85
+ options[:proxy] = NetworkProfile.proxy
86
+ options[:proxyuserpwd] = NetworkProfile.proxy_user_pass if NetworkProfile.proxy_user_pass.present?
87
+ end
88
+ @response ||= Typhoeus.get(@link, options)
81
89
  end
82
90
 
83
91
  def doc
@@ -1,3 +1,3 @@
1
1
  module NetworkProfile
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency "rdf-microdata"
29
29
  spec.add_dependency "activesupport", ">= 5.0.0"
30
30
  spec.add_dependency "nokogiri"
31
+ spec.add_dependency "rexml"
31
32
  end
@@ -0,0 +1,26 @@
1
+
2
+ type parse_response = { site_icon: string?, link: string, title: string?, text: string?, image: string?, :type => string? }
3
+
4
+ module NetworkProfile
5
+ def self.github_api_key: () -> string?
6
+
7
+ def self.github_api_key=: (string obj) -> string
8
+
9
+ def self.headers: () -> untyped
10
+
11
+ def self.headers=: (untyped obj) -> untyped
12
+
13
+ def self.parse: (string link, ?include_fallback_custom: bool) -> parse_response?
14
+
15
+ public
16
+
17
+ def github_api_key: () -> string
18
+
19
+ def github_api_key=: (string obj) -> string
20
+
21
+ def headers: () -> untyped
22
+
23
+ def headers=: (untyped obj) -> untyped
24
+ end
25
+
26
+ NetworkProfile::VERSION: String
@@ -0,0 +1,25 @@
1
+ class NetworkProfile::Extractor
2
+ def self.call: (string string) -> Array[parse_response]
3
+
4
+ public
5
+
6
+ def extracted_links!: () -> Array[parse_response]
7
+
8
+ def links: () -> Array[string]
9
+
10
+ def mapped_string: () -> Array[string]
11
+
12
+ private
13
+
14
+ def initialize: (string string) -> untyped
15
+ end
16
+
17
+ NetworkProfile::Extractor::AUTO_LINK_RE: Regexp
18
+
19
+ NetworkProfile::Extractor::BRACKETS: Hash
20
+
21
+ NetworkProfile::Extractor::HOST_PART: Regexp
22
+
23
+ NetworkProfile::Extractor::TLD: Regexp
24
+
25
+ NetworkProfile::Extractor::WORD_PATTERN: String
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: network_profile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Wienert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-08 00:00:00.000000000 Z
11
+ date: 2020-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rexml
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Extract profile metadata from various social-media-profiles, such as
70
84
  Twitter, XING, Github, Stackoverflow or generic og-metatags.
71
85
  email:
@@ -103,6 +117,8 @@ files:
103
117
  - lib/network_profile/extractors/xing_profile.rb
104
118
  - lib/network_profile/version.rb
105
119
  - network_profile.gemspec
120
+ - sig/network_profile.rbs
121
+ - sig/network_profile_extractor.rbs
106
122
  homepage: https://github.com/pludoni/network_profile
107
123
  licenses:
108
124
  - MIT
@@ -124,8 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
140
  - !ruby/object:Gem::Version
125
141
  version: '0'
126
142
  requirements: []
127
- rubyforge_project:
128
- rubygems_version: 2.7.6
143
+ rubygems_version: 3.2.0.rc.1
129
144
  signing_key:
130
145
  specification_version: 4
131
146
  summary: Extract profile metadata from various social-media-profiles