gatherer 0.0.3 → 0.0.4
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.
- data/README.md +0 -5
- data/lib/gatherer/client.rb +10 -7
- data/lib/gatherer/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,
|
|
2
|
-
|
|
3
1
|
.,-:::::/ :::. :::::::::::: :: .: .,:::::: :::::::.. .,:::::: :::::::..
|
|
4
2
|
,;;-'````' ;;`;;;;;;;;;;'''',;; ;;,;;;;'''' ;;;;``;;;; ;;;;'''' ;;;;``;;;;
|
|
5
3
|
[[[ [[[[[[/,[[ '[[, [[ ,[[[,,,[[[ [[cccc [[[,/[[[' [[cccc [[[,/[[['
|
|
@@ -7,9 +5,6 @@
|
|
|
7
5
|
`Y8bo,,,o88o888 888, 88, 888 "88o888oo,__ 888b "88bo,888oo,__ 888b "88bo,
|
|
8
6
|
`'YMUP"YMMYMM ""` MMM MMM YMM""""YUMMMMMMM "W" """"YUMMMMMMM "W"
|
|
9
7
|
|
|
10
|
-
`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`'~,_.~'`
|
|
11
|
-
|
|
12
|
-
|
|
13
8
|
# Gatherer: The Magicking
|
|
14
9
|
|
|
15
10
|
Gatherer is a gem to scrape Magic: The Gathering card data from [gatherer.wizards.com](http://gatherer.wizards.com).
|
data/lib/gatherer/client.rb
CHANGED
|
@@ -22,13 +22,7 @@ module Gatherer
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def expansions(homepage_file = nil, expansion_file = nil)
|
|
25
|
-
homepage_file
|
|
26
|
-
doc = Nokogiri::HTML(homepage_file)
|
|
27
|
-
expansion_titles = doc.css('select#ctl00_ctl00_MainContent_Content_SearchControls_setAddText')
|
|
28
|
-
.css('option')
|
|
29
|
-
.map {|option| option['value'] }
|
|
30
|
-
.select {|expansion| !expansion.empty?}
|
|
31
|
-
expansion_titles.map do |title|
|
|
25
|
+
expansion_titles(homepage_file).map do |title|
|
|
32
26
|
Gatherer::Expansion.new(
|
|
33
27
|
title: title,
|
|
34
28
|
abbreviation: expansion_abbreviation_for(title, expansion_file)
|
|
@@ -36,6 +30,15 @@ module Gatherer
|
|
|
36
30
|
end
|
|
37
31
|
end
|
|
38
32
|
|
|
33
|
+
def expansion_titles(file = nil)
|
|
34
|
+
file ||= open('http://gatherer.wizards.com')
|
|
35
|
+
doc = Nokogiri::HTML(file)
|
|
36
|
+
expansion_titles = doc.css('select#ctl00_ctl00_MainContent_Content_SearchControls_setAddText')
|
|
37
|
+
.css('option')
|
|
38
|
+
.map {|option| option['value'] }
|
|
39
|
+
.select {|expansion| !expansion.empty?}
|
|
40
|
+
end
|
|
41
|
+
|
|
39
42
|
def expansion_abbreviation_for(title, file = nil)
|
|
40
43
|
file ||= open(Scraper.new(expansion: title).url)
|
|
41
44
|
doc = Nokogiri::HTML(file)
|
data/lib/gatherer/version.rb
CHANGED