billboard_chart 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +1 -0
- data/billboard_chart.gemspec +26 -0
- data/bin/billboard_chart +4 -0
- data/lib/billboard_chart.rb +10 -0
- data/lib/billboard_chart/.DS_Store +0 -0
- data/lib/billboard_chart/billboard_chart_scraper.rb +49 -0
- metadata +15 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1340e31d6879f16ddea37ada480e3cbdab682e1c
|
4
|
+
data.tar.gz: c48b05a9b6a4725d79bde67dd6206fe231a4e20f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b980a35c5f37334bf03b19000973aa334682a1a267892f4b2b708f37391eba19da32b0e35eb231414dd043ba56d30f2b1db34adba8a43346dcd2e3c72a9410c
|
7
|
+
data.tar.gz: 422b773d4fb97401c56209a742645b8664d0edd70dc9fea08edcfabc8976c3249a0d63f8cc0ba67863e69d0840de9ae69d9120dbc43ce741a1ddbcf039037891
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 stephaniehoh
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Billboard
|
2
|
+
|
3
|
+
Wanna look like you're hard at work in your terminal while checking out which songs
|
4
|
+
are blowing up the Billboard Hot 100?
|
5
|
+
|
6
|
+
Then grab the billboard gem. Just do it.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'billboard'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install billboard
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
TODO: Write usage instructions here
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
|
28
|
+
1. Fork it
|
29
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
30
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
31
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
32
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "billboard_chart"
|
7
|
+
spec.version = "1.0.1"
|
8
|
+
spec.executables << "billboard_chart"
|
9
|
+
spec.authors = ["Stephanie Oh"]
|
10
|
+
spec.email = ["stephoh@gmail.com"]
|
11
|
+
spec.description = "Brings the Top 10 Billboard Hot 100 Singles Chart to your terminal"
|
12
|
+
spec.summary = "Use the Billboard gem to check out which singles are dominating pop music today"
|
13
|
+
spec.homepage = "https://github.com/stephaniehoh/billboard_chart"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split("\n")
|
17
|
+
#spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.required_ruby_version = ">= 1.8.7"
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "nokogiri"
|
25
|
+
spec.add_development_dependency "colored"
|
26
|
+
end
|
data/bin/billboard_chart
ADDED
Binary file
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "open-uri"
|
2
|
+
require "nokogiri"
|
3
|
+
require "colored"
|
4
|
+
#encoding: utf-8
|
5
|
+
|
6
|
+
class BillboardChartScraper
|
7
|
+
attr_accessor :scraped_data
|
8
|
+
|
9
|
+
def initialize(url)
|
10
|
+
@scraped_data = Nokogiri::HTML(open(url))
|
11
|
+
top_ten
|
12
|
+
end
|
13
|
+
|
14
|
+
# =============== Scrape Methods ============= #
|
15
|
+
|
16
|
+
def get_artists
|
17
|
+
@scraped_data.css("p.chart_info a").collect {|artist| artist.text}
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_singles
|
21
|
+
@scraped_data.css("h1").collect {|single| single.text}[1..10]
|
22
|
+
end
|
23
|
+
|
24
|
+
def merge_artists_and_singles
|
25
|
+
Hash[get_artists.zip(get_singles)]
|
26
|
+
end
|
27
|
+
|
28
|
+
# =============== Display Methods ============= #
|
29
|
+
|
30
|
+
def top_ten
|
31
|
+
puts "\n"
|
32
|
+
puts "✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭".yellow
|
33
|
+
puts "\n"
|
34
|
+
puts " ♫ Top 10 Billboard Hot 100 Singles Chart: ♫ "
|
35
|
+
puts " (#{DateTime.now.strftime('%m/%d/%Y')}) ".red
|
36
|
+
puts "\n"
|
37
|
+
i = 0
|
38
|
+
while i < 10
|
39
|
+
merge_artists_and_singles.each do |artist, single|
|
40
|
+
puts "#{i+1}. #{artist} - #{single}"
|
41
|
+
i += 1
|
42
|
+
end
|
43
|
+
puts "\n"
|
44
|
+
puts "✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭ ✭".yellow
|
45
|
+
puts "\n"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: billboard_chart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephanie Oh
|
@@ -69,11 +69,22 @@ dependencies:
|
|
69
69
|
description: Brings the Top 10 Billboard Hot 100 Singles Chart to your terminal
|
70
70
|
email:
|
71
71
|
- stephoh@gmail.com
|
72
|
-
executables:
|
72
|
+
executables:
|
73
|
+
- billboard_chart
|
73
74
|
extensions: []
|
74
75
|
extra_rdoc_files: []
|
75
|
-
files:
|
76
|
-
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- billboard_chart.gemspec
|
83
|
+
- lib/billboard_chart.rb
|
84
|
+
- lib/billboard_chart/.DS_Store
|
85
|
+
- lib/billboard_chart/billboard_chart_scraper.rb
|
86
|
+
- bin/billboard_chart
|
87
|
+
homepage: https://github.com/stephaniehoh/billboard_chart
|
77
88
|
licenses:
|
78
89
|
- MIT
|
79
90
|
metadata: {}
|