USA Today Headshots


FantasyData works with USA Today to provide clients with licensed player headshots, with transparent backgrounds. The images are licensed by USA Today, but the URLs to the images are directly integrated into FantasyData's API feeds. So, clients simply need to integrate with the FantasyData API to pull the headshot URLs, then download them from USA Today's download server using credentials supplied by USA Today. Below are the detailed instructions for pulling the headshot URLs from the FantasyData API, and how to download the headshots using USA Today's secure download server.

FantasyData Documentation

FantasyData provides USA Today headshot URLs directly in their feeds for ease of use by clients. As such, clients don't need to integrate with the USA Today JSON feed at all, as everything is available directly in the FantasyData Player Details (rosters) feeds.

There are three columns providing USA Today headshot information, named as follows.

  • UsaTodayPlayerID
  • UsaTodayHeadshotUrl
  • UsaTodayHeadshotNoBackgroundUrl

The following Player Details endpoints include the USA Today headshot URLs. Please note these are the equivalent of players/rosters feeds that clients would need to integrate with anyway.

NFL

All Players (Active & Free Agents)

MLB

Active Players
Free Agents

NBA

Active Players
Free Agents

NHL

Active Players
Free Agents

Soccer (MLS)

All Players
Players by League
Players by Team

USA Today Documentation

The USA Today headshot URLs point to the DownloadAPI. Here is the info needed to unlock the USA Today headshot images provided in the FantasyData Player Details feeds noted above.

The image download API employs a simplified OAuth flow, requests must be signed but the response from the service is a resource rather than an access token. The included example script shows how to send the necessary OAuth components with a request.

The Image Download method takes one parameter, imageID, and returns the image file as a response.

Image Download Example using Python (this script downloads image 7414493):

    
    import urllib
    import oauth2
    import time
 
    imageid = 7414493

    def build_request(url, imageid, method='GET'):
        params = {
            'oauth_version': "1.0",
            'oauth_nonce': oauth2.generate_nonce(),
            'oauth_timestamp': int(time.time()),
            'imageID': imageid,
        }
        consumer = oauth2.Consumer(key=’mykey’,secret=’mysecret’)
        params['oauth_consumer_key'] = consumer.key
 
        req = oauth2.Request(method=method, url=url, parameters=params)
        signature_method = oauth2.SignatureMethod_HMAC_SHA1()
        req.sign_request(signature_method, consumer, None)
        return req
  
    request = build_request('http://api.usatodaysportsimages.com/api/download/', imageid)
    print request.to_url()
    local_filename, headers = urllib.urlretrieve(request.to_url(), './'+str(imageid)+'.jpg')
    print local_filename