Class: Nytimesbooks::Scraper

Inherits:
Object
  • Object
show all
Defined in:
lib/nytimesbooks/scraper.rb

Class Method Summary collapse

Class Method Details

.childrens_middleObject



51
52
53
54
55
56
57
# File 'lib/nytimesbooks/scraper.rb', line 51

def self.childrens_middle
  puts "Children's Middle Grade"
  doc = Nokogiri::HTML(open("https://www.nytimes.com/books/best-sellers/childrens-middle-grade-hardcover/?module=DropDownNav&action=click&region=navbar&contentCollection=Books&version=Childrens&referrer=https%3A%2F%2Fwww.nytimes.com%2Fbooks%2Fbest-sellers%2Fchildrens-middle-grade-hardcover%2F&pgtype=Reference"))
  childrens_middle_array = []
    childrens_middle_array = Nytimesbooks::Book.new_book(doc)
  childrens_middle_array
end

.childrens_pictureObject



59
60
61
62
63
64
65
# File 'lib/nytimesbooks/scraper.rb', line 59

def self.childrens_picture
  puts "Children's Picture Books"
  doc = Nokogiri::HTML(open("https://www.nytimes.com/books/best-sellers/picture-books/?module=DropDownNav&action=click&region=navbar&contentCollection=Books&version=Childrens&referrer=https%3A%2F%2Fwww.nytimes.com%2Fbooks%2Fbest-sellers%2Fchildrens-middle-grade-hardcover%2F&pgtype=Reference"))
  children_picture_array = []
    children_picture_array = Nytimesbooks::Book.new_book(doc)
  children_picture_array
end

.childrens_seriesObject



67
68
69
70
71
72
73
# File 'lib/nytimesbooks/scraper.rb', line 67

def self.childrens_series
  puts "Children's Series"
  doc = Nokogiri::HTML(open("https://www.nytimes.com/books/best-sellers/series-books/?module=DropDownNav&action=click&region=navbar&contentCollection=Books&version=Childrens&referrer=https%3A%2F%2Fwww.nytimes.com%2Fsection%2Fbooks&pgtype=Reference"))
  children_series_array = []
    children_series_array = Nytimesbooks::Book.new_book(doc)
  children_series_array
end

.combined_fictionObject



3
4
5
6
7
8
9
# File 'lib/nytimesbooks/scraper.rb', line 3

def self.combined_fiction
  puts "Combined Print & E-Book Fiction"
  doc = Nokogiri::HTML(open("https://www.nytimes.com/books/best-sellers/combined-print-and-e-book-fiction/?action=click&contentCollection=Books&referrer=https%3A%2F%2Fwww.nytimes.com%2Fsection%2Fbooks&region=Body&module=CompleteListLink&version=Fiction&pgtype=Reference"))
  combined_fiction_array = []
    combined_fiction_array = Nytimesbooks::Book.new_book(doc)
  combined_fiction_array
end

.combined_nonfictionObject



27
28
29
30
31
32
33
# File 'lib/nytimesbooks/scraper.rb', line 27

def self.combined_nonfiction
  puts "Combined Print & E-Book Nonfiction"
  doc = Nokogiri::HTML(open("https://www.nytimes.com/books/best-sellers/combined-print-and-e-book-nonfiction/?module=DropDownNav&action=click&region=navbar&contentCollection=Books&version=Nonfiction&referrer=https%3A%2F%2Fwww.nytimes.com%2Fbooks%2Fbest-sellers%2Fhardcover-fiction%2F&pgtype=Reference"))
  combined_nonfiction_array = []
    combined_nonfiction_array = Nytimesbooks::Book.new_book(doc)
  combined_nonfiction_array
end

.hardcover_fictionObject



11
12
13
14
15
16
17
# File 'lib/nytimesbooks/scraper.rb', line 11

def self.hardcover_fiction
  puts "Hardcover Fiction"
  doc = Nokogiri::HTML(open("https://www.nytimes.com/books/best-sellers/hardcover-fiction/?module=DropDownNav&action=click&region=navbar&contentCollection=Books&version=Fiction&referrer=https%3A%2F%2Fwww.nytimes.com%2Fbooks%2Fbest-sellers%2F&pgtype=Reference"))
  hardcover_fiction_array = []
    hardcover_fiction_array = Nytimesbooks::Book.new_book(doc)
  hardcover_fiction_array
end

.hardcover_nonfictionObject



35
36
37
38
39
40
41
# File 'lib/nytimesbooks/scraper.rb', line 35

def self.hardcover_nonfiction
  puts "Hardcover Nonfiction"
  doc = Nokogiri::HTML(open("https://www.nytimes.com/books/best-sellers/hardcover-nonfiction/?module=DropDownNav&action=click&region=navbar&contentCollection=Books&version=Nonfiction&referrer=https%3A%2F%2Fwww.nytimes.com%2Fbooks%2Fbest-sellers%2Ftrade-fiction-paperback%2F&pgtype=Reference&mtrref=www.nytimes.com&gwh=631EB713B46E9B6EEA11D9D78A6A73A3&gwt=pay"))
  hardcover_nonfiction_array = []
    hardcover_nonfiction_array = Nytimesbooks::Book.new_book(doc)
  hardcover_nonfiction_array
end

.paperback_fictionObject



19
20
21
22
23
24
25
# File 'lib/nytimesbooks/scraper.rb', line 19

def self.paperback_fiction
  puts "Paperback Fiction"
  doc = Nokogiri::HTML(open("https://www.nytimes.com/books/best-sellers/trade-fiction-paperback/?module=DropDownNav&action=click&region=navbar&contentCollection=Books&version=Fiction&referrer=https%3A%2F%2Fwww.nytimes.com%2Fbooks%2Fbest-sellers%2Fcombined-print-and-e-book-fiction%2F&pgtype=Reference"))
  paperback_fiction_array = []
    paperback_fiction_array = Nytimesbooks::Book.new_book(doc)
  paperback_fiction_array
end

.paperback_nonfictionObject



43
44
45
46
47
48
49
# File 'lib/nytimesbooks/scraper.rb', line 43

def self.paperback_nonfiction
  puts "Paperback Nonfiction"
  doc = Nokogiri::HTML(open("https://www.nytimes.com/books/best-sellers/paperback-nonfiction/?module=DropDownNav&action=click&region=navbar&contentCollection=Books&version=Nonfiction&referrer=https%3A%2F%2Fwww.nytimes.com%2Fsection%2Fbooks&pgtype=Reference"))
  paperback_nonfiction_array = []
    paperback_nonfiction_array = Nytimesbooks::Book.new_book(doc)
  paperback_nonfiction_array
end

.young_adultObject



75
76
77
78
79
80
81
# File 'lib/nytimesbooks/scraper.rb', line 75

def self.young_adult
  puts "Young Adult Hardcover"
  doc = Nokogiri::HTML(open("https://www.nytimes.com/books/best-sellers/young-adult-hardcover/?module=DropDownNav&action=click&region=navbar&contentCollection=Books&version=More&referrer=https%3A%2F%2Fwww.nytimes.com%2Fbooks%2Fbest-sellers%2F&pgtype=Reference"))
  young_adult_array = []
    young_adult_array = Nytimesbooks::Book.new_book(doc)
  young_adult_array
end