Code Monkey home page Code Monkey logo

Comments (10)

nickfrerichs avatar nickfrerichs commented on July 16, 2024

Bob,

I've not found any free source for player injury data, but I may be able to pull "news" for players using the nfl fantasy api (http://api.fantasy.nfl.com/v1/docs/service?serviceName=playersNews). Do you think that might be of use? I could possibly parse the content for words related to player injuries.

from fflproject.

Darrend1 avatar Darrend1 commented on July 16, 2024

I have a script we used in our league that worked good on the lineup submit page. If I have time when I get home i'll see if I can post it here.

from fflproject.

Boblyng avatar Boblyng commented on July 16, 2024

Lets see what Darrend1 has otherwise if the injury news from the api could be parsed so it pops the injury note or icon next to the player in the main team view at least that would be good.

from fflproject.

Boblyng avatar Boblyng commented on July 16, 2024

How confident are you in the nflgame stats vs the api stats going forward?

from fflproject.

Darrend1 avatar Darrend1 commented on July 16, 2024

untitled

Ill edit this with the code later when I get to my server. But essentially it pulls the injury list from rotowire and throws it into a injury table in the database. I currently have the script run a few times a week to pull injuries. Then when the user loads a page, such as the lineup submit page, it pulls the injury data from there while pulling the starting lineups. I have it set to show additional injury info when you mouse over the player. Our site has a lot of custom stuff, so I'm gonna have to cross reference the default files to see what's actually changed. It's not much code to add though, I know that.

I used rotowire due to the details and up to date injury statuses.

from fflproject.

nickfrerichs avatar nickfrerichs commented on July 16, 2024

I try to avoid depending on web scraping, do you have a way to get a feed and match up player IDs with rotowire?

I can probably add a table for player history/news that displays on the site and leave it up to you to have a script populate it with data.

As far as nflgame vs the nfl.com fantasy api. When I looked at the fantasy api last year it was not nearly as live as nflgame. That api is intended to write your own interface to manage a nfl.com fantasy league rather than provide stats. So I'll be sticking with nflgame because of the near real-time stats for live scoring.

from fflproject.

Boblyng avatar Boblyng commented on July 16, 2024

I was trying to parse the nfl news api into the database using.
`<?php
url = "http://api.fantasy.nfl.com/v1/players/news";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url); //gets the url contents

$data = curl_exec ($ch); // Execute Curl request
curl_close($ch);

$xml = simplexml_load_string($data);
$con=mysql_connect("localhost","root","XXXXXX");
mysql_select_db("ffl_project", $con) or die mysql_error()); //Select Database

foreach ($xml -> note as $row) {
$gsisPlayerId= = $row -> gsisPlayerId;
$body = $row -> body;
$analysis = $row -> analysis;

//perform sql query
$sql = "INSERT INTO injury_table (gsisPlayerId, body,analysis)"
. "VALUES ('$gsisPlayerId', '$body', '$analysis')";

$result = mysql_query ($sql);
if (!$result) {
echo 'MYSQL ERROR';
} else {
echo 'SUCCESS';
}
}
?>`
But the gsisPlayerId seems to be giving me error.
Here is an example row.

<note id="342839" esbid="GOL705804" gsisPlayerId="00-0024410" firstName="Kedric" lastName="Golston" position="DL" teamAbbr="" source="rotowire" timestamp="2017-05-21 14:21:45"><headline/><body>Golston (hamstring) visited with the 49ers on Friday, Matt Barrows of The Sacramento Bee reports.</body><analysis>Golston, who opened the 2016 season as the Redskins' starting nose tackle but suffered a season-ending hamstring tear in Week 2, was medically cleared from the injury roughly two and a half weeks ago. This meeting with San Francisco marks the first free-agent visit of the offseason for the 33-year-old vet. The 49ers are beginning to construct a fearsome defensive line and Golston would, at the minimum, provide excellent depth and a strong veteran presence.</analysis></note>

from fflproject.

Boblyng avatar Boblyng commented on July 16, 2024

Otherwise I was looking at it in json format.
http://api.fantasy.nfl.com/v1/players/news?format=json

from fflproject.

nickfrerichs avatar nickfrerichs commented on July 16, 2024

from fflproject.

nickfrerichs avatar nickfrerichs commented on July 16, 2024

I'm going to close this, a basic icon is in develop now and it pulls from nfl.com/injuries. Once I know it's reliable, I'll refine the look over the season. Currently it looks too much like a Cherrio

from fflproject.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.