jc214809 / Baseball

Baseball
2 stars 0 forks source link

Question for you! #11

Open b-neufeld opened 8 years ago

b-neufeld commented 8 years ago

Hi! I found this repo while trying "reverse engineer" the mlb.com fantasy baseball interface. I'm searching for the holy grail, which to me would be the ability to return the current daily score outside of the flash-based Scoreboard interface.

It looks like you are well ahead of where I am. Looking at your Scoreboard.js, Scoreboard2.js, do I understand correctly that you couldn't find a JSON object with the daily score for each fantasy team, and that you "build" that daily score yourself by iterating through the live game data for that day?

Is your project portable (can I quickly get it set up for my league) or is there a lot hard-coded for your own?

Thanks. What you're doing looks very interesting.

jc214809 commented 8 years ago

Hey there!

Thanks for your interest. Sorry you had to look through that crap i call code lol but I have been able to find more information after I wrote this first app I have actually changed the app so that i now work for the 2016 season which wasn't that bad. but the only thing that really matters is the findMyTeam method that contains the player id that are needed.

I have actually started a rewite that actually pulls live team data but it pretty basic right now and only has one showing

jc214809 commented 8 years ago

i have found a score JSON but it doesnt update todays points

b-neufeld commented 8 years ago

Thanks for the reply!

I started hacking away at this in Python the other day.. I found the .xml files with the batting & pitching staff stats that seems to be updated on the fly for "today's points" (which I think I have to turn into fantasy points manually). I'm going to try and get a basic points page working for my league.

I will keep you posted on what I come up with.

Cheers.

jc214809 commented 8 years ago

Here's the link to my live page in case you wanted to take a look around. http://jc214809.github.io/Baseball/index2.html

Also I have a bunch of helpful links in the read me too

b-neufeld commented 8 years ago

Wow, I am very impressed! You've got something really cool started.

Have you hard-coded the player_IDs in your findMyTeam method - is that why it's loading so fast?

It looks like you're powering through each game's JSON data to grab all the stats for each batter? I started looking through all these player xml files that seem to be updated instantly: http://gdx.mlb.com/components/game/mlb/year_2016/month_04/day_18/batters/429665_1.xml

Sorry for asking all these questions lol.. it's cool to find someone working on something similar.

jc214809 commented 8 years ago

I do hard code the ID for now. I actually do use the xml for the pitching staff but for some reason I hate using probably because JavaScript doesn't like xml very much

jc214809 commented 8 years ago

Don't worry about the questions I wish I had someone when I started

b-neufeld commented 8 years ago

I sunk a couple days into a Python script to do most of the heavy lifting (I am not strong at all in Java) and here's what I've come up with: http://brahm.ca/fb/baseball.py

I am going to keep tweaking it, and I will get set up to share the code too. Not 100% complete yet and I think I can make it faster.

The only variable someone would have to change to deploy a copy for their league is the league_id - it looks up the team_ids from that, then the roster info and player_ids.

jc214809 commented 8 years ago

Thats pretty cool! I would like to take a look at your code eventually i've never used python seem pretty interesting.

b-neufeld commented 8 years ago

https://github.com/b-neufeld/mlb-fantasy-checker

I got my code online tonight!

Over the week I've changed all of the data collection. I don't use read in any XML score data; it all comes from the boxscore.json files (even the pitching). It still takes about 10sec to load on average, but that is still better than the flash interface haha.

I'd love to figure out some of the Java auto-refreshing stuff but that is totally foreign to me at this point!

jc214809 commented 8 years ago

Hey man! Very cool, I really like what your doing! Especially the 'butt' replacement! lol How do i get the players to show do i just click the arrow? Yeah i hate working with the xml in JavaScript because the just do not play well. JSON all the way. btw I got you site to load in 5 sec but that is during the day when there are no games going on lol

b-neufeld commented 8 years ago

Thanks!

For the arrow drop-downs I used HTML5 "summary" and "details" tags: http://www.w3schools.com/tags/tag_summary.asp

jc214809 commented 8 years ago

Hey! Long time no talk just want to update you with my new rewritten version of my fantasy baseball app http://jc214809.github.io/FantasyBaseball/#/ I have it pulling data and auto updating data as you watch site. There are only two variables that need to be changed to make it work for anyone in the app.js you change the league Id and your team Id. Btw I have only been trying to make this work for an iPhone 6 so the CSS may be wonky with everything else

b-neufeld commented 8 years ago

That looks sweet! I might have to pull a copy and run it for my league!

I haven't done much with mine lately; a couple weeks ago I hacked in Google Charts API to show a "points back" chart. It looks pretty good on mobile. You can check it out if you want at the same link: http://brahm.ca/fb/baseball.py