NBA_info 0.1.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 +7 -0
- data/.travis.yml +13 -0
- data/README.md +19 -0
- data/Rakefile +6 -0
- data/bin/application.rb +30 -0
- data/gemfile +9 -0
- data/lib/NBA_info.rb +1 -0
- data/spec/test.rb +24 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9afdc5ce4501d761e1f9615862a8e84dc97c7266
|
4
|
+
data.tar.gz: 773d56c6c2ca27610de22893d6af8d1a66378d59
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4bc267d2339fb400dedaffb9c174dbd4ae980fcd24534d5f38a2b0066dbb4b6253209ed2b95677abca1a21fa158a40a37a75ab28521b3a3ab9a3b0bfa246160a
|
7
|
+
data.tar.gz: 8083fe9444600e3401ba6b38a21f70862a0d4328c2777ed3e9e9eae545ce56cac3aed5091d4cf680e4f3e0b487a592f058a5095eaafe7e3e1e5735eaa2a77a1f
|
data/.travis.yml
ADDED
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#WebScraper HW
|
2
|
+
>this assignment scrapes the information and parse HTML directly from websites.To run this project, you should execute the file from the following path '/lib/application.rb' with Ruby.
|
3
|
+
##Choice of website
|
4
|
+
</br>
|
5
|
+
First, we choose the NBA sports infomation on <http://scores.espn.go.com/nba/scoreboard> and scrape each game's starting lineup.
|
6
|
+
Second, we use the NBA players website <http://origin.nba.com/players/> to scrape the players' current season stats which user enters.
|
7
|
+
##Structure of our Code
|
8
|
+
</br>
|
9
|
+
We used `Nokogiri` to parse HTML on Ruby, then used `XPATH` to find the tag on HTML.
|
10
|
+
|
11
|
+
require 'open-uri'
|
12
|
+
require 'nokogiri'
|
13
|
+
Users can enter '1' to see any players' stats in current season they enter.
|
14
|
+
</br>
|
15
|
+
Users can also enter '2' to see the starting lineup in today's game or see the highest records(PTS, REB, STL) in the final game.
|
16
|
+
##Collaborator
|
17
|
+
* [seanyen0507](https://github.com/seanyen0507)
|
18
|
+
* [hsuchinwang](https://github.com/hsuchinwang)
|
19
|
+
* [poweihuang](https://github.com/poweihuang)
|
data/Rakefile
ADDED
data/bin/application.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'NBA_info'
|
3
|
+
#require '../lib/NBA_info/NBA_info_ex.rb'
|
4
|
+
|
5
|
+
sam = Scraper.new
|
6
|
+
puts "Enter 1 to see starting lineup today, enter 2 to see any player's profile you want."
|
7
|
+
control = gets.chomp
|
8
|
+
control = control.to_i
|
9
|
+
|
10
|
+
if control == 2
|
11
|
+
puts "Which player's profile you want to see?"
|
12
|
+
name = gets.chomp
|
13
|
+
name.downcase!
|
14
|
+
name.gsub!(' ', '_')
|
15
|
+
sean = sam.profile(name)[0]
|
16
|
+
sean.each {
|
17
|
+
|key, value| puts "#{key} : #{value}"
|
18
|
+
}
|
19
|
+
elsif control == 1
|
20
|
+
po = sam.game[0]
|
21
|
+
w = sam.game[1]
|
22
|
+
po.each do |key, value|
|
23
|
+
puts "#{key}\t#{value}"
|
24
|
+
if key.include? 'PM' || 'AM'
|
25
|
+
5.times { puts w.shift }
|
26
|
+
else
|
27
|
+
3.times { puts w.shift }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/gemfile
ADDED
data/lib/NBA_info.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'NBA_info/NBA_info_ex.rb'
|
data/spec/test.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'minitest/rg'
|
3
|
+
require '../lib/NBA_info/NBA_info_ex.rb'
|
4
|
+
|
5
|
+
describe 'Do some test' do
|
6
|
+
sam = Scraper.new
|
7
|
+
before do
|
8
|
+
@game = sam.game
|
9
|
+
@profile = sam.profile('chris_bosh')
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'will not empty' do
|
13
|
+
@profile[0].wont_be_empty
|
14
|
+
@game[0].wont_be_empty
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'will be number' do
|
18
|
+
@profile[1][1].must_be_kind_of String
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'size will be 4' do
|
22
|
+
@profile[1].size.must_equal 4
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: NBA_info
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- poweihuang
|
8
|
+
- hsuchinwang
|
9
|
+
- seanyean0507
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: minitest
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: minitest-rg
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
description: Extract and analyze NBA information from Yahoo sport and ESPN.com
|
44
|
+
email: benny59438@gmail.com
|
45
|
+
executables:
|
46
|
+
- application.rb
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- ".travis.yml"
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- bin/application.rb
|
54
|
+
- gemfile
|
55
|
+
- lib/NBA_info.rb
|
56
|
+
- spec/test.rb
|
57
|
+
homepage: https://github.com/seanyen0507/web_scraper
|
58
|
+
licenses:
|
59
|
+
- MIT
|
60
|
+
metadata: {}
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
requirements: []
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 2.4.1
|
78
|
+
signing_key:
|
79
|
+
specification_version: 4
|
80
|
+
summary: NBA information extractor and analyzer
|
81
|
+
test_files:
|
82
|
+
- spec/test.rb
|