Module: CDB
- Defined in:
- lib/cdb/cli.rb,
lib/cdb/issue.rb,
lib/cdb-crawlr.rb,
lib/cdb/series.rb,
lib/cdb/struct.rb,
lib/cdb/renamer.rb more...
Defined Under Namespace
Classes: CLI, Issue, Renamer, Series, Struct
Constant Summary
collapse
- VERSION =
'0.3.3'
- BASE_URL =
'http://www.comicbookdb.com'
{'Connection' => 'keep-alive'}
- SEARCH_PATH =
'search.php'
Class Method Summary
collapse
Class Method Details
permalink
.search(query, type = 'FullSite') ⇒ Object
[View source]
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/cdb-crawlr.rb', line 22
def search(query, type='FullSite')
data = URI.encode_www_form(
form_searchtype: type,
form_search: query
)
url = "#{BASE_URL}/#{SEARCH_PATH}?#{data}"
doc = read_page(url)
node = doc.css('h2:contains("Search Results")').first.parent
{
:series => CDB::Series.parse_results(node),
:issues => CDB::Issue.parse_results(node)
}
end
|
permalink
.show(id, type) ⇒ Object
[View source]
36
37
38
39
40
41
|
# File 'lib/cdb-crawlr.rb', line 36
def show(id, type)
data = URI.encode_www_form('ID' => id)
url = "#{BASE_URL}/#{type::WEB_PATH}?#{data}"
page = read_page(url)
type.parse_data(id, page)
end
|