billboard_hot_100_songs 0.1.0 → 1.0.0
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/.gitignore +3 -0
- data/Gemfile.lock +51 -0
- data/billboard_hot_100_songs.gemspec +2 -2
- data/bin/billboard_hot_100_songs +1 -0
- data/lib/billboard_hot_100_songs/backup_website/billboard_hot_100_songs.html +4540 -1
- data/lib/billboard_hot_100_songs/cli.rb +1 -1
- data/lib/billboard_hot_100_songs/scraper.rb +7 -6
- data/lib/billboard_hot_100_songs/version.rb +1 -1
- metadata +6 -5
|
@@ -3,14 +3,15 @@ class BillboardHot100Songs::Scraper
|
|
|
3
3
|
BASE_PATH = "https://www.billboard.com/charts/hot-100"
|
|
4
4
|
|
|
5
5
|
def self.scrape_main_page
|
|
6
|
-
|
|
7
6
|
page_data = Nokogiri::HTML(open(BASE_PATH))
|
|
8
7
|
|
|
9
|
-
# BACKUP HTML FOR OFFLINE USE
|
|
10
|
-
# To work offline,
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
|
|
8
|
+
# BACKUP HTML FOR OFFLINE USE
|
|
9
|
+
# To work offline, run the extractor in the backup_website folder to parse data you want to save
|
|
10
|
+
# To run the extractor, cd into the 'backup_website' directory. Then in your terminal enter: 'ruby extractor.rb'
|
|
11
|
+
# Then uncomment the next two lines below (lines 12 and 13) and comment above code + BASE_PATH (lines 3 and 7)
|
|
12
|
+
# html_backup = File.read('lib/billboard_hot_100_songs/backup_website/billboard_hot_100_songs.html')
|
|
13
|
+
# page_data = Nokogiri::HTML(html_backup)
|
|
14
|
+
|
|
14
15
|
page_data.css("li.chart-list__element").map do |element|
|
|
15
16
|
song = {}
|
|
16
17
|
song[:name] = element.css("span.chart-element__information__song").text
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: billboard_hot_100_songs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexander M. Clamor
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 2.1.4
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 2.1.4
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -109,6 +109,7 @@ files:
|
|
|
109
109
|
- ".travis.yml"
|
|
110
110
|
- CODE_OF_CONDUCT.md
|
|
111
111
|
- Gemfile
|
|
112
|
+
- Gemfile.lock
|
|
112
113
|
- LICENSE.txt
|
|
113
114
|
- NOTES.md
|
|
114
115
|
- README.md
|
|
@@ -140,9 +141,9 @@ require_paths:
|
|
|
140
141
|
- lib
|
|
141
142
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
143
|
requirements:
|
|
143
|
-
- -
|
|
144
|
+
- - '='
|
|
144
145
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: 2.
|
|
146
|
+
version: 2.6.1
|
|
146
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
148
|
requirements:
|
|
148
149
|
- - ">="
|