udacicharts 0.0.4
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 +7 -0
- data/lib/udacicharts.rb +29 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a3e056630b9b48e281bd9ffa9e3aac2716778c2
|
4
|
+
data.tar.gz: 910c557d24da465d90030d2067f140033025c1ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c6b6ee9e593bcb4a6cc849d863e3517a03a6e261f23468d1aba23ddfcab0d38eada4d36026829efd529b8735c8b6622a1a317a10e8f4878affa7acd219c79eb
|
7
|
+
data.tar.gz: 50dac241f6766cc2850e57adc92b1c6210f9a7dc3c09c94b226e05f2513876f754ac6e9c2f72d67d5f371a3e165a56650aa195a2420633283ba6120b04de0254
|
data/lib/udacicharts.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "open-uri"
|
2
|
+
require "nokogiri"
|
3
|
+
|
4
|
+
class BillboardCharts
|
5
|
+
|
6
|
+
@limit = 100
|
7
|
+
|
8
|
+
def initialize(chart_name='hot-100')
|
9
|
+
url = 'http://www.billboard.com/charts/'+chart_name
|
10
|
+
@scraped_data = Nokogiri::HTML(open(url))
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_artists
|
14
|
+
@scraped_data.css(".chart-row__artist").collect do |artist|
|
15
|
+
artist.text.strip!
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_singles
|
20
|
+
@scraped_data.css(".chart-row__song").collect do |song|
|
21
|
+
song.text
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_list(limit=100)
|
26
|
+
@limit=limit
|
27
|
+
get_artists.zip(get_singles)
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: udacicharts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- blue steele
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: ''
|
14
|
+
email:
|
15
|
+
- blue@udacity.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/udacicharts.rb
|
21
|
+
homepage: https://github.com/udacity/udaci_charts
|
22
|
+
licenses:
|
23
|
+
- MIT
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.4.5.1
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: get billboard data
|
45
|
+
test_files: []
|