GDNewsScraper 3.0.0 → 3.0.1
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/GDNewsScraper/scrapers/polygon_com/news.rb +8 -8
- data/lib/GDNewsScraper/version.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06e468f8771feccf3609fa31369c22b865c5645b
|
4
|
+
data.tar.gz: 1936f2409c7f4c7bfb33cc58d3feaa5243e47203
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a90733cf5b4403b607154fcc354153ae26aa4ca9cd57334258e59a88e9ffdf7c913cc9dddb7e4e5cb643a6481cb24ad874bdb1aad91b583923a45507ffb1686
|
7
|
+
data.tar.gz: 310056309d60efe507b8e5ca92025f55945cc8dc4d17f934444f77e94281c20f129ab29242275ace4de86a0ddbd381b665ada074937c793b7dd0b0b592ff52db
|
@@ -124,7 +124,7 @@ module GDNewsScraper::Scrapers
|
|
124
124
|
article_body[:videos][iframe_id] = {}
|
125
125
|
article_body[:videos][iframe_id][:url] = iframe.attr('src')
|
126
126
|
|
127
|
-
article_body[:body] << iframe.replace("
|
127
|
+
article_body[:body] << iframe.replace("{{video:#{ iframe_id }}}").to_html
|
128
128
|
end
|
129
129
|
|
130
130
|
article_container.children.each do |node|
|
@@ -140,7 +140,7 @@ module GDNewsScraper::Scrapers
|
|
140
140
|
article_body[:videos][iframe_id] = {}
|
141
141
|
article_body[:videos][iframe_id][:url] = iframe.attr('src')
|
142
142
|
|
143
|
-
article_body[:body] << iframe.replace("
|
143
|
+
article_body[:body] << iframe.replace("{{video:#{ iframe_id }}}").to_html
|
144
144
|
end
|
145
145
|
|
146
146
|
# Check to see if the div contains a gallery
|
@@ -161,7 +161,7 @@ module GDNewsScraper::Scrapers
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
-
article_body[:body] << gallery.replace("
|
164
|
+
article_body[:body] << gallery.replace("{{gallery:#{ gallery_id }}}").to_html
|
165
165
|
end
|
166
166
|
|
167
167
|
twitdget = node.at('.twitter-tweet')
|
@@ -195,7 +195,7 @@ module GDNewsScraper::Scrapers
|
|
195
195
|
article_body[:images][image_id] = {}
|
196
196
|
article_body[:images][image_id][:url] = image_url
|
197
197
|
|
198
|
-
article_body[:body] << node.replace("
|
198
|
+
article_body[:body] << node.replace("{{image:#{ image_id }}}").to_html
|
199
199
|
else
|
200
200
|
image_alt = image.children.at('img').attr('alt')
|
201
201
|
image_title = image.children.at('img').attr('title')
|
@@ -215,7 +215,7 @@ module GDNewsScraper::Scrapers
|
|
215
215
|
article_body[:figures][figure_id][:cite] = image_meta.first.at('cite')&.text
|
216
216
|
end
|
217
217
|
|
218
|
-
article_body[:body] << node.replace("
|
218
|
+
article_body[:body] << node.replace("{{figure:#{ figure_id }}}").to_html
|
219
219
|
end
|
220
220
|
rescue
|
221
221
|
raise 'Unknown format, please review.'
|
@@ -227,12 +227,12 @@ module GDNewsScraper::Scrapers
|
|
227
227
|
if url.name == 'a'
|
228
228
|
url_id = random_string
|
229
229
|
|
230
|
-
article_body[:anchors][url_id
|
230
|
+
article_body[:anchors][url_id] = {
|
231
231
|
text: url.children.text,
|
232
232
|
url: url.attributes['href'].value
|
233
233
|
}
|
234
234
|
|
235
|
-
url.replace("
|
235
|
+
url.replace("{{anchor:#{ url_id }}}")
|
236
236
|
end
|
237
237
|
rescue
|
238
238
|
raise 'Unknown format, please review.'
|
@@ -262,7 +262,7 @@ module GDNewsScraper::Scrapers
|
|
262
262
|
end
|
263
263
|
|
264
264
|
def random_string
|
265
|
-
(0...50).map { (65 + rand(25)).chr }.join
|
265
|
+
(0...50).map { (65 + rand(25)).chr }.join.to_sym
|
266
266
|
end
|
267
267
|
end # News
|
268
268
|
end # PolygonCOM
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module GDNewsScraper
|
2
|
-
VERSION ||= '3.0.
|
2
|
+
VERSION ||= '3.0.1'
|
3
3
|
|
4
4
|
# => major: A new Source has been added or removed
|
5
5
|
# => minor: A Source code has changed drastically to a point where it's not
|
@@ -25,4 +25,6 @@ module GDNewsScraper
|
|
25
25
|
# In a 'Wordpress' kind of style, various html elements are now
|
26
26
|
# returned in a way that an app can recognize and translate it into a
|
27
27
|
# widget
|
28
|
+
# v3.0.1 - Change the placeholder from [] to {{:}} which makes it a lot easier
|
29
|
+
# to scan and replace with Regex using scan(/\{{(.*?)\}}/)
|
28
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: GDNewsScraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vlad Radulescu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|