spieker 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: 8d68fdae00bc592760e27214ce5b0546702034a9
4
- data.tar.gz: 2451ccff0b6d42c869b1f3fbada18fc700806bf5
3
+ metadata.gz: 1efbda5b0c8acddf71421f0a398fe81147bba156
4
+ data.tar.gz: b8d089ba60167155d2f502e6bbe6f06110d55a58
5
5
  SHA512:
6
- metadata.gz: 2689c5559124616dc3305271a479f1e52212788cfc116d3524283b6da38c8395e84ae2b64d7abc3cc18b5be45c277200d83e8669e73f757e222af338e7d5f420
7
- data.tar.gz: 7a7c4fa8ac735de6440484861035000816cac7fdd2a19f29207dceb75912f638aa5e0ace15f76fb2a094ebe398a7341043620d693ac63ace5ce702b933b32073
6
+ metadata.gz: 33cbdaa59a122b8572c84e6697dd8f2e3c066248a0a770bee2766ec8a0de261eda9f90591f4ae3fc2539a39e402bac78286bec9e5bc0df4f77ac224f4fc61e3a
7
+ data.tar.gz: 68074bacc9d188afcaf4ce2ac896b6684c3dcea36034b16760a53a564262999628bdf2fedc31a1e2ff3c90e415e7fb286a3f6ace046ecd4e392eff64a4584da1
data/CHANGELOG CHANGED
@@ -1,6 +1,11 @@
1
+ 0.0.8
2
+ * Handle query params like a boss
3
+ * Fix small bug with language not always being set
4
+
1
5
  0.0.7
2
6
  * Support setting the language as a parameter, default is 'en'
3
7
  * Wait for tolqjs to submit the content before continuing
8
+
4
9
  0.0.4
5
10
  * Set useragent to Tolq Spieker
6
11
 
@@ -28,7 +28,7 @@ module Spieker
28
28
  links.each do |link|
29
29
  report "Crawling page #{link}"
30
30
 
31
- scraper = LinkScraper.new(link)
31
+ scraper = LinkScraper.new(link, lang: @lang)
32
32
  new_links_threaded[link] = scraper.result
33
33
  track_link(link)
34
34
 
@@ -39,17 +39,24 @@ module Spieker
39
39
 
40
40
  def drive_page_for_links
41
41
  begin
42
- visit @url.path + "#!lang=#{@lang}"
43
- links = page.all('a').map { |el| el[:href]}
42
+ query = if @url.query
43
+ "?#{@url.query}"
44
+ else
45
+ ""
46
+ end
47
+ visit @url.path + query + "#!lang=#{@lang}"
48
+ # Capybara + selenium causes some links not to be found. There doesn't seem to be any method to that.
49
+ # Cool is tho, in JS it's a lot faster as well
50
+ links = page.evaluate_script('document.getElementsByTagName(\'a\')').map { |el| el['href'] }
44
51
  begin
45
52
  # Our javascript adds a class if the content has been succesfully submitted
46
53
  page.find(:css, 'html.tolq-content-updated')
47
54
  rescue Capybara::Ambiguous, Capybara::ElementNotFound => e
48
- puts "Something went wrong with submitting the content #{e.inspect}"
55
+ puts "Something went wrong with submitting the content: #{e.message}"
49
56
  end
50
57
  links
51
58
  rescue => e
52
- puts "Error parsing #{@url.to_s}, #{e.inspect}"
59
+ puts "Error parsing #{@url.to_s}, #{e.message}"
53
60
  []
54
61
  end
55
62
  end
@@ -1,3 +1,3 @@
1
1
  module Spieker
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spieker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timon Vonk