mechanizer 1.11 → 1.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef9ac4cda832d55e693e46c28e9dd569cad29e096545338ea364bee468f7f02f
4
- data.tar.gz: b58af71643298b06fb45ee3cbb2aaa2df3abc2579826e42c6dc197d739aa8943
3
+ metadata.gz: bf5e0126c5a9c8e0dbf5eeb4a99e2c0f241ce95348abbdd0b70ce646aefe8063
4
+ data.tar.gz: 1fdd68e34f4abec9a7f97eb1fd1b71b74bdee20c4915c0157ca013110e67dc94
5
5
  SHA512:
6
- metadata.gz: e3034c83bdbb741c0a3f65ec798edf4daf7eff600a233ae6bc301e241ee85b774538c7725e51893375e390e9c17c120683dca1b22986aa1dcf237e6eb19b7901
7
- data.tar.gz: d8ca61e01ce5c34fbb906aea820e16d947f79ebcf75bc64cddfc7bf1fe9dbaa744438cb507e9551eceda67f724e9ebb256b3285a481228b2f6b6f3ce5cb84312
6
+ metadata.gz: 5848e452bd1054800b47265699979c87d6dd44300d9f4614dd9f4181933365149e9e6e05906ba19f044db155098e600a81d7842b4996a1d2722da2d32bc271c5
7
+ data.tar.gz: 8061245ddedef9f9cc718808a541797f271ae45f12d944e86792e12f9c5cf97306cbfaa1d87f97d5c5f194ccdaa306854528a7dfb77cb138e14e6edc82a21a31
data/README.md CHANGED
@@ -58,20 +58,20 @@ noko_hash = noko.scrape(args)
58
58
  ```
59
59
  err_msg = noko_hash[:err_msg]
60
60
  page = noko_hash[:page]
61
- texts_and_hrefs = noko_hash[:texts_and_hrefs]
61
+ texts_and_paths = noko_hash[:texts_and_paths]
62
62
  ```
63
63
 
64
- ### 4. Example Texts & Hrefs:
64
+ ### 4. Example Texts & paths:
65
65
 
66
66
  ```
67
- texts_and_hrefs = [
68
- {:text=>"english 5 675 000+ articles", :href=>"//en.wikipedia.org/"},
69
- {:text=>"日本語 1 111 000+ 記事", :href=>"//ja.wikipedia.org/"},
70
- {:text=>"español 1 427 000+ artículos", :href=>"//es.wikipedia.org/"},
71
- {:text=>"deutsch 2 195 000+ artikel", :href=>"//de.wikipedia.org/"},
72
- {:text=>"русский 1 481 000+ статей", :href=>"//ru.wikipedia.org/"},
73
- {:text=>"français 1 997 000+ articles", :href=>"//fr.wikipedia.org/"},
74
- {:text=>"italiano 1 446 000+ voci", :href=>"//it.wikipedia.org/"}
67
+ texts_and_paths = [
68
+ {:text=>"english 5 675 000+ articles", :path=>"//en.wikipedia.org/"},
69
+ {:text=>"日本語 1 111 000+ 記事", :path=>"//ja.wikipedia.org/"},
70
+ {:text=>"español 1 427 000+ artículos", :path=>"//es.wikipedia.org/"},
71
+ {:text=>"deutsch 2 195 000+ artikel", :path=>"//de.wikipedia.org/"},
72
+ {:text=>"русский 1 481 000+ статей", :path=>"//ru.wikipedia.org/"},
73
+ {:text=>"français 1 997 000+ articles", :path=>"//fr.wikipedia.org/"},
74
+ {:text=>"italiano 1 446 000+ voci", :path=>"//it.wikipedia.org/"}
75
75
  ]
76
76
  ```
77
77
 
data/Rakefile CHANGED
@@ -16,8 +16,8 @@ task :console do
16
16
  require "active_support/all"
17
17
  ARGV.clear
18
18
 
19
- noko_page_hash = run_mechanizer
20
- binding.pry
19
+ # noko_page_hash = run_mechanizer
20
+ # binding.pry
21
21
 
22
22
  IRB.start
23
23
  end
@@ -31,7 +31,7 @@ def run_mechanizer
31
31
 
32
32
  err_msg = noko_hash[:err_msg]
33
33
  page = noko_hash[:page]
34
- texts_and_hrefs = noko_hash[:texts_and_hrefs]
34
+ texts_and_paths = noko_hash[:texts_and_paths]
35
35
 
36
36
  other_projects = page.css('.other-project')&.text
37
37
  other_projects = other_projects.split("\n").reject(&:blank?)
@@ -18,7 +18,7 @@ module Mechanizer
18
18
  def scrape(args)
19
19
  @timeout = args.fetch(:timeout, 60)
20
20
  url = args.fetch(:url)
21
- noko_hash = { url: url, err_msg: nil, texts_and_hrefs: {}, page: nil }
21
+ noko_hash = { url: url, err_msg: nil, texts_and_paths: {}, page: nil }
22
22
  noko_hash = start_noko(noko_hash)
23
23
  noko_hash = extract_links(noko_hash)
24
24
  noko_hash
@@ -27,10 +27,10 @@ module Mechanizer
27
27
  def extract_links(noko_hash)
28
28
  links = noko_hash[:page]&.links
29
29
  unless noko_hash[:err_msg].present? || !links.present?
30
- noko_hash[:texts_and_hrefs] = links.map do |link|
30
+ noko_hash[:texts_and_paths] = links.map do |link|
31
31
  text = link.text&.downcase&.gsub(/\s+/, ' ')&.strip
32
- href = link&.href&.downcase&.strip
33
- text_and_href = {text: text, href: href}
32
+ path = link&.href&.downcase&.strip
33
+ text_and_path = {text: text, path: path}
34
34
  end
35
35
  end
36
36
  noko_hash
@@ -1,3 +1,3 @@
1
1
  module Mechanizer
2
- VERSION = "1.11"
2
+ VERSION = "1.12"
3
3
  end
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.required_ruby_version = '~> 2.5.1'
34
34
  spec.add_dependency 'activesupport', '~> 5.2'
35
35
  spec.add_dependency 'utf8_sanitizer', '~> 2.16'
36
- spec.add_dependency 'crm_formatter', '~> 2.62'
36
+ spec.add_dependency 'crm_formatter', '~> 2.64'
37
37
  spec.add_dependency 'mechanize', '~> 2.7', '>= 2.7.6'
38
38
 
39
39
  # spec.add_dependency "activesupport-inflector", ['~> 0.1.0']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mechanizer
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.11'
4
+ version: '1.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Booth
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.62'
47
+ version: '2.64'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.62'
54
+ version: '2.64'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mechanize
57
57
  requirement: !ruby/object:Gem::Requirement