bots 1.0.4 → 1.0.5
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 +4 -4
- data/lib/scraper.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d58802b035984822506024bb8745293a9c6edf666c9ed4b69311282f226b079a
|
4
|
+
data.tar.gz: 250faa62467ee442ed198b36247f4d5a271dfc03f9614e0021357873bdf749a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddb39e422226e1b490e18d364ae7ab15b6bb8c20425091f41168b32c59ef59809c769e7cf2d8628998676799a21b2cb7957aeb807a9bd1995e1658217822be65
|
7
|
+
data.tar.gz: f8431a7d719c30326d3c1dd69e8b80dd4f916b004c7a44b464c22d83fa5acce26cd59f0b94709b1955ff1dda6450ccd8bc7121b33368b91f92380e88a1f01e54
|
data/lib/scraper.rb
CHANGED
@@ -122,7 +122,7 @@ module BlackStack
|
|
122
122
|
title = page.title
|
123
123
|
s = Timeout::timeout(5) { page.search('body').text }
|
124
124
|
# add the link to the results of no-keyword
|
125
|
-
hpage = {
|
125
|
+
hpage = { 'page_url' => link.downcase, 'page_title' => title, 'page_html' => page.body, 'keywords' => [] }
|
126
126
|
pages << hpage
|
127
127
|
# iterate the keywords
|
128
128
|
i = 0
|
@@ -130,7 +130,7 @@ module BlackStack
|
|
130
130
|
a.each { |k|
|
131
131
|
# find the keyword
|
132
132
|
match = ( s =~ /#{Regexp.escape(k)}/i )
|
133
|
-
hpage[
|
133
|
+
hpage['keywords'] << k if match
|
134
134
|
# count the number of links with match
|
135
135
|
# break if only 1 link is needed
|
136
136
|
if match
|