vore 0.2.5-x86_64-darwin → 0.2.8-x86_64-darwin

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: 677dfdb96b772683aaed9ef988f34783d0383c4293930dee4720fa366c78bf49
4
- data.tar.gz: 9a96d48d28172191687eaba5bab0790989249b8c410e0b69e7ccebb286fb7723
3
+ metadata.gz: a4f96c051f27e8fd481213db0cf06e2c5bc02a61c159b820f0753796a378335a
4
+ data.tar.gz: 17219abae1846d6c2b48b8ceb92d3bdb7a3510c4a1d49b85eecdc1a81457c735
5
5
  SHA512:
6
- metadata.gz: 951140392a08c8599842ef135229a97bc87b7c47adb27793b07e8d48cc45b59a2cb0a80825e4722aee33d2ebc4206070ac862390ba4e7cc18719bd05992b1b03
7
- data.tar.gz: 327a8aa155f4d39c3b32dd136105539d12997ae18814bf5f2251d8e948a6ec1d16e52e420409c5860c406a27c4327f418d35a95069b09aad7613c253474e8c2d
6
+ metadata.gz: f73a3769ad439820018ced158e109871efcf74537c142240e6bb991dbd04cb32286d78393f3194f68ad4cb3f3f49b8a3962e27bc9f9cded1ec5ca5880d9d3573
7
+ data.tar.gz: 969e0c30ecce701f23ab32207a84599d18d986b82862cd2910069a6ec6a330ad5b62baf53c5483ae2c7ec7d11860cb3746841fd74216a4029b9dbcd4169ade69
data/exe/vore-spider CHANGED
Binary file
data/lib/vore/crawler.rb CHANGED
@@ -8,6 +8,8 @@ module Vore
8
8
  PLATFORM = [:cpu, :os].map { |m| Gem::Platform.local.send(m) }.join("-")
9
9
  FILE_SEPERATOR = PLATFORM.include?("windows") ? File::ALT_SEPARATOR : File::SEPARATOR
10
10
 
11
+ attr_reader :output_dir
12
+
11
13
  # Creates a crawler
12
14
  # denylist: Sets a denylist filter, allows a regexp, string or array of either to be matched.
13
15
  def initialize(denylist: /a^/, sanitization_config: Vole::Configuration::DEFAULT_SANITIZATION_CONFIG)
@@ -26,16 +28,10 @@ module Vore
26
28
  end
27
29
 
28
30
  def scrape_each_page(website, &block)
29
- output_dir = "#{@parent_output_dir}/#{website.gsub(/[^a-zA-Z0-9]/, "_").squeeze("_")}"
31
+ @output_dir = "#{@parent_output_dir}/#{website.gsub(/[^a-zA-Z0-9]/, "_").squeeze("_")}"
30
32
  Vore.logger.info("Vore started crawling #{website}, outputting to #{output_dir}")
31
33
 
32
- output = %x(#{@executable} \
33
- --user-agent #{user_agent} \
34
- --delay 3500 \
35
- --url #{website} \
36
- download \
37
- -t \
38
- #{output_dir})
34
+ output = run_command(website, @output_dir)
39
35
 
40
36
  Vore.logger.info("Vore finished crawling #{website}: #{output}")
41
37
 
@@ -51,6 +47,7 @@ module Vore
51
47
  results[:pages_visited] += 1
52
48
 
53
49
  html_file = File.read(path).force_encoding("UTF-8")
50
+ rewritten_html_file = ""
54
51
 
55
52
  if html_file.empty?
56
53
  results[:pages_unprocessed] += 1
@@ -58,7 +55,13 @@ module Vore
58
55
  next
59
56
  end
60
57
 
61
- rewritten_html_file = @selma.rewrite(html_file)
58
+ begin
59
+ rewritten_html_file = @selma.rewrite(html_file)
60
+ rescue StandardError => e
61
+ Vore.logger.warn("Error rewriting #{path}: #{e}")
62
+ results[:pages_unprocessed] += 1
63
+ next
64
+ end
62
65
 
63
66
  # drops the first 3 parts of the path, which are "tmp", "vore", and the site name
64
67
  url_path = path.split(FILE_SEPERATOR)[3..].join("/")
@@ -83,6 +86,16 @@ module Vore
83
86
  # crawl_site(site)
84
87
  # end
85
88
 
89
+ def run_command(website, output_dir)
90
+ %x(#{@executable} \
91
+ --user-agent #{user_agent} \
92
+ --delay 3500 \
93
+ --url #{website} \
94
+ download \
95
+ -t \
96
+ #{output_dir})
97
+ end
98
+
86
99
  def user_agent
87
100
  "'Mozilla/5.0 (compatible; Vore/#{Vore::VERSION}; +https://github.com/gjtorikian/vore)'"
88
101
  end
@@ -20,7 +20,6 @@ module Vole
20
20
 
21
21
  def handle_element(element)
22
22
  if element.tag_name == "pre" ||
23
- element.tag_name == "code" ||
24
23
  element.tag_name == "form" ||
25
24
  element.tag_name == "style" ||
26
25
  element.tag_name == "noscript" ||
data/lib/vore/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vore
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.8"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.8
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - Garen J. Torikian