billboard_chart 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7094db258503ef189db373fd57c54f6297830bca
4
- data.tar.gz: c88e625755d62da222bdfe9ad09f412cb412fc31
3
+ metadata.gz: 1340e31d6879f16ddea37ada480e3cbdab682e1c
4
+ data.tar.gz: c48b05a9b6a4725d79bde67dd6206fe231a4e20f
5
5
  SHA512:
6
- metadata.gz: 7e5997d2459daba00a68bc074606aea3f5e51a030a2bd9f9964b56d76e38ebd82bbf77d9ab4d06e80444e2e4cd5fc13241268cbdad54226fa282b070ee3ef985
7
- data.tar.gz: bb7edb5554596d279bc19d007245021182ef243b42cf94057a9e9c1b2c77d1fc7214eab40767b12a9b8a6a8b0155c9498afa751777df449e473a22edcfa31642
6
+ metadata.gz: 6b980a35c5f37334bf03b19000973aa334682a1a267892f4b2b708f37391eba19da32b0e35eb231414dd043ba56d30f2b1db34adba8a43346dcd2e3c72a9410c
7
+ data.tar.gz: 422b773d4fb97401c56209a742645b8664d0edd70dc9fea08edcfabc8976c3249a0d63f8cc0ba67863e69d0840de9ae69d9120dbc43ce741a1ddbcf039037891
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in billboard_chart.gemspec
4
+ gemspec
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
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'billboard_chart'
4
+ BillboardChart.new
@@ -0,0 +1,10 @@
1
+ require_relative "./billboard_chart/billboard_chart_scraper"
2
+
3
+ class BillboardChart
4
+ attr_accessor :artists, :singles, :top_ten, :chart
5
+
6
+ def initialize
7
+ BillboardChartScraper.new("http://www.billboard.com/charts/hot-100")
8
+ end
9
+
10
+ end
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.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
- homepage: https://github.com/stephaniehoh/billboard
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: {}