Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Reading Data From Websites
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
midnitehood




PostPosted: Mon Nov 18, 2013 6:58 pm   Post subject: Reading Data From Websites

Hi everyone,

Me and my friend are working on an assignment for our grade 11 computer science class in java. We were thinking of making a program where stats are displayed and what not. So I kno that java can read from text files, but it would be a pain to have to create a new text file everytime information changes. So my main question is, is there anyway I can retrieve stats from a website like nhl.com? Like can I make it so that even though the stats change theres no extra work involved for me? Also these are integer stats, like 20 goals or 10 penalty minutes, if that makes a difference.


Thanks everyone

All answers are much appreciated
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Mon Nov 18, 2013 9:06 pm   Post subject: RE:Reading Data From Websites

There are two main approaches here:

1) "Scraping": make a standard HTTP request to the page you want information from, then scan through the HTML returned looking for the values you need. This is fragile (breaks if they change the layout of the page, for example) and generally considered poor web citizenship (especially if you automate making tons of requests, which can flood the webserver).

2) Use the provided API. This only works if your target offers an API, but if they do it's much better. You make an HTTP request to a specific URL, which returns some data-interchange language like XML or JSON. It's both easier to code and more reliable, but generally they will impose limits on how frequently you can retrieve data (to avoid flooding their servers).

Fortunately, it looks like there are a lot of different APIs offered for getting sports data. You might try http://www.nicetimeonice.com/api or http://developer.sportsdatallc.com/page . I think the former is free, but the latter also has a 90-day trial edition that you might be able to use to complete your assignment (and let your teacher mark it).
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: