vore 0.2.0-arm64-darwin → 0.2.2-arm64-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: 8d2efc3993d1d65cebb2a5576331bc20ece0520a49f59c0d7f995a179d2b7f4b
4
- data.tar.gz: 9bfa5dd808324b2d52b540937f2a3cd7562e453adf79ff3c982ac8fbab4e6339
3
+ metadata.gz: 61ddb28c73e9dcda499667e7440f3a185cefb14195304f74a84e9920e986535c
4
+ data.tar.gz: c1904fda0864dba3f2aa444430d66e7485b41b39d19592a20bd59a067125221e
5
5
  SHA512:
6
- metadata.gz: a1364b00820082923ac4ca1679564a4e2ee44d89f27539022a1551d7dafca7df93817c71581021ab67ebfb2e044fcc4799ff1abd8f412cdab88c73fc658d52df
7
- data.tar.gz: e95deb9ca83978c56bdd96211f806042f3c5907ffff9fcfb90dddc486b3b766f1c207a56fd484a1ee554ae3b26fb89fa7220e5cfa30434a23447bc08ee61bc8f
6
+ metadata.gz: 5015b25a45cb9bd7c36ad85319416f314bfe63f16daf3bd910ef082cba0eef2885656bc43372e2b4c5d02570931892063511b1a327f967b8045b0e0c306c995d
7
+ data.tar.gz: 7ee0bd863322612f060491237bae1253d2cc57682dac9d4a58a25eaf198ff8145f7e53101b5715c42a41e8cb8c9c0c26ed4c8f0d15b21fd39052bf19b826a150
data/exe/vore-spider CHANGED
Binary file
data/lib/vore/crawler.rb CHANGED
@@ -17,7 +17,7 @@ module Vore
17
17
  @selma = Selma::Rewriter.new(sanitizer: Selma::Sanitizer.new(sanitization_config), handlers: [@content_extractor])
18
18
  ext = PLATFORM.include?("windows") ? ".exe" : ""
19
19
  @executable = File.expand_path([__FILE__, "..", "..", "..", "exe", "vore-spider#{ext}"].join(FILE_SEPERATOR))
20
- @output_dir = "tmp/vore"
20
+ @parent_output_dir = "tmp/vore"
21
21
 
22
22
  return if File.exist?(@executable)
23
23
 
@@ -26,11 +26,12 @@ module Vore
26
26
  end
27
27
 
28
28
  def scrape_each_page(website, &block)
29
- output_dir = "#{@output_dir}/#{website.gsub(/[^a-zA-Z0-9]/, "_").squeeze("_")}"
29
+ output_dir = "#{@parent_output_dir}/#{website.gsub(/[^a-zA-Z0-9]/, "_").squeeze("_")}"
30
30
  Vore.logger.info("Vore started crawling #{website}, outputting to #{output_dir}")
31
31
 
32
32
  output = %x(#{@executable} \
33
33
  --user-agent #{user_agent} \
34
+ --delay 3000
34
35
  --url #{website} \
35
36
  download \
36
37
  -t \
@@ -38,12 +39,25 @@ module Vore
38
39
 
39
40
  Vore.logger.info("Vore finished crawling #{website}: #{output}")
40
41
 
41
- Dir.glob("tmp/**/*").each do |path|
42
+ results = {
43
+ pages_visited: 0,
44
+ pages_unprocessed: 0,
45
+ unprocessed_pages: [],
46
+ }
47
+
48
+ Dir.glob(File.join(output_dir, "**", "*")).each do |path|
42
49
  next unless File.file?(path)
43
50
 
44
51
  html_file = File.read(path).force_encoding("UTF-8")
45
52
  rewritten_html_file = @selma.rewrite(html_file)
46
53
 
54
+ results[:pages_visited] += 1
55
+ if rewritten_html_file.empty?
56
+ results[:pages_unprocessed] += 1
57
+ results[:unprocessed_pages] << path
58
+ next
59
+ end
60
+
47
61
  # drops the first 3 parts of the path, which are "tmp", "vore", and the site name
48
62
  url_path = path.split(FILE_SEPERATOR)[3..].join("/")
49
63
 
@@ -58,6 +72,8 @@ module Vore
58
72
  ensure
59
73
  File.delete(path) if File.file?(path)
60
74
  end
75
+
76
+ results
61
77
  end
62
78
 
63
79
  # def crawl(site, block)
@@ -19,7 +19,13 @@ module Vole
19
19
  end
20
20
 
21
21
  def handle_element(element)
22
- if element.tag_name == "pre" || element.tag_name == "code" || element.tag_name == "script" || element.tag_name == "form"
22
+ if element.tag_name == "pre" ||
23
+ element.tag_name == "code" ||
24
+ element.tag_name == "form" ||
25
+ element.tag_name == "style" ||
26
+ element.tag_name == "noscript" ||
27
+ element.tag_name == "script" ||
28
+ element.tag_name == "svg"
23
29
  element.remove
24
30
  elsif element.tag_name == "title"
25
31
  @within_title = true
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.0"
4
+ VERSION = "0.2.2"
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.0
4
+ version: 0.2.2
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Garen J. Torikian