NBA_info 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9afdc5ce4501d761e1f9615862a8e84dc97c7266
4
- data.tar.gz: 773d56c6c2ca27610de22893d6af8d1a66378d59
3
+ metadata.gz: 745d4057fa3d17e96d16f192a21a5ff22f9cb8e3
4
+ data.tar.gz: 027a55450f5a17b35817894349f013c9c8935fa7
5
5
  SHA512:
6
- metadata.gz: 4bc267d2339fb400dedaffb9c174dbd4ae980fcd24534d5f38a2b0066dbb4b6253209ed2b95677abca1a21fa158a40a37a75ab28521b3a3ab9a3b0bfa246160a
7
- data.tar.gz: 8083fe9444600e3401ba6b38a21f70862a0d4328c2777ed3e9e9eae545ce56cac3aed5091d4cf680e4f3e0b487a592f058a5095eaafe7e3e1e5735eaa2a77a1f
6
+ metadata.gz: 07a25bd876280fc9ee8a25bd3ea2a06676b459847b9ce3bce31a92e34da73b47165f95f34414464925bd1d8e4765209cfa733ced6c4e9a8df7626d24405d1321
7
+ data.tar.gz: ca61248a608f8a2db7361b70409c51a1da067f9fecf76a1c8ed66f35191b04eac3defd3df3bd27c7ee1b8612caea1099c3e2b0c2dc0ee4471c175be7c9a9a4fa
File without changes
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 poweihuang, hsuchinwang, seanyean0507
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
Binary file
data/NBA_info.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require 'NBA_info/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'NBA_info'
6
+ s.version = NBA_INFO::VERSION
7
+ s.executables << 'application.rb'
8
+ s.add_development_dependency 'minitest'
9
+ s.add_development_dependency 'minitest-rg'
10
+ s.date = '2014-10-23'
11
+ s.summary = 'NBA information extractor and analyzer'
12
+ s.description = 'Extract and analyze NBA information from Yahoo sport and ESPN.com'
13
+ s.authors = ['poweihuang', 'hsuchinwang', 'seanyean0507']
14
+ s.email = 'benny59438@gmail.com'
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.homepage = 'https://github.com/seanyen0507/web_scraper'
18
+ s.license = 'MIT'
19
+ end
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
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.
2
+ >this assignment scrapes the information and parse HTML directly from websites.
3
+ To run this project, you should execute the file from the following path '/lib/application.rb' with Ruby.
3
4
  ##Choice of website
4
5
  </br>
5
6
  First, we choose the NBA sports infomation on <http://scores.espn.go.com/nba/scoreboard> and scrape each game's starting lineup.
data/bin/application.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'NBA_info'
3
3
  #require '../lib/NBA_info/NBA_info_ex.rb'
4
-
5
- sam = Scraper.new
4
+ sam= Scraper.new
6
5
  puts "Enter 1 to see starting lineup today, enter 2 to see any player's profile you want."
7
6
  control = gets.chomp
8
7
  control = control.to_i
data/lib/NBA_info.rb CHANGED
@@ -1 +1 @@
1
- require 'NBA_info/NBA_info_ex.rb'
1
+ require File.expand_path('../NBA_info/NBA_info_ex', __FILE__)
@@ -0,0 +1,47 @@
1
+ require 'open-uri'
2
+ require 'nokogiri'
3
+ # this is a class
4
+ class Scraper
5
+
6
+
7
+ def game
8
+ x, y, z, w, team_1 = [], [], [], [], []
9
+
10
+ doc = Nokogiri.HTML(open('http://scores.espn.go.com/nba/scoreboard'))
11
+
12
+ time = doc.xpath("//div[@class='game-status']//p")
13
+ time.each { |times| x << times.text }
14
+ team = doc.xpath("//div[@class='team-capsule']//a")
15
+ team.each { |teams| y << teams.text }
16
+ player = doc.xpath("//div[@style='display: block']\
17
+ //table[@class='game-stat-overview']//tbody//tr//td")
18
+ player.each { |p| team_1 << p.text }
19
+
20
+ for i in 0..(y.size) / 2 - 1
21
+ z << y[i * 2] + ' v.s ' + y[i * 2 + 1]
22
+ end
23
+
24
+ for i in 0..(team_1.size) / 5 - 1
25
+ w << team_1[i * 5] + "\t" + "#{team_1[i * 5 + 1]} #{team_1[i * 5 + 2]}" + \
26
+ ' v.s ' + "#{team_1[i * 5 + 3]} #{team_1[i * 5 + 4]}"
27
+ end
28
+
29
+ schedule_table_upcoming = Hash[x.zip(z)]
30
+ [schedule_table_upcoming, w]
31
+
32
+ end
33
+
34
+ def profile(name)
35
+ f = []
36
+ data = %w('PTS' 'REB' 'AST' 'PIE')
37
+ web_data_player = 'http://origin.nba.com/playerfile/'
38
+ web_data_player += name
39
+ doc1 = Nokogiri.HTML(open(web_data_player))
40
+ profile = doc1.xpath("//div[@class='sponsor-branding']\
41
+ //tr[@class='stats text-shadow']//td")
42
+ profile.each { |p| f << p.text }
43
+ player_profile = Hash[data.zip(f)]
44
+ [player_profile, f]
45
+ end
46
+
47
+ end
@@ -0,0 +1,4 @@
1
+ module NBA_INFO
2
+ VERSION = '0.1.2'
3
+ DATE = '2014-10-24'
4
+ end
data/spec/test.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'minitest/autorun'
2
2
  require 'minitest/rg'
3
+ <<<<<<< HEAD
3
4
  require '../lib/NBA_info/NBA_info_ex.rb'
4
5
 
5
6
  describe 'Do some test' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: NBA_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - poweihuang
@@ -48,11 +48,16 @@ extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
50
  - ".travis.yml"
51
+ - Gemfile
52
+ - LICENSE
53
+ - NBA_info-0.1.1.gem
54
+ - NBA_info.gemspec
51
55
  - README.md
52
56
  - Rakefile
53
57
  - bin/application.rb
54
- - gemfile
55
58
  - lib/NBA_info.rb
59
+ - lib/NBA_info/NBA_info_ex.rb
60
+ - lib/NBA_info/version.rb
56
61
  - spec/test.rb
57
62
  homepage: https://github.com/seanyen0507/web_scraper
58
63
  licenses:
@@ -74,9 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
79
  version: '0'
75
80
  requirements: []
76
81
  rubyforge_project:
77
- rubygems_version: 2.4.1
82
+ rubygems_version: 2.2.2
78
83
  signing_key:
79
84
  specification_version: 4
80
85
  summary: NBA information extractor and analyzer
81
- test_files:
82
- - spec/test.rb
86
+ test_files: []