Skip to content

Instantly share code, notes, and snippets.

View VerizonMediaOwner's full-sized avatar

Verizon Media VerizonMediaOwner

View GitHub Profile
@VerizonMediaOwner
VerizonMediaOwner / weather_ydn_rss.xml
Created January 10, 2019 20:41
Yahoo Weather API XML Response Example
<rss xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" version="2.0">
<channel>
<yweather:units distance="km" pressure="mbar" speed="km/h" temperature="C" />
<title>Yahoo! Weather - Sunnyvale, CA, US</title>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2502265/</link>
<description>Yahoo! Weather for Sunnyvale, CA, US</description>
<language>en-us</language>
<lastBuildDate>Wed, 09 Jan 2019 12:32 PM PST</lastBuildDate>
<ttl>60</ttl>
<yweather:location city="Sunnyvale" country="United States" region=" CA" />
@VerizonMediaOwner
VerizonMediaOwner / oauth_get_teams.php
Created February 26, 2019 15:27
Get a user's teams
<?php
/**
* Update this script to include your client ID and secret. You can also
* pass them along as command line arguments.
* Copyright 2017 Yahoo Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
*/
$client_id = 'INSERT_CLIENT_ID_HERE';
$client_secret = 'INSERT_CLIENT_SECRET_HERE';
$game_keys = 'nfl';
@VerizonMediaOwner
VerizonMediaOwner / oauth_get_public_data.php
Last active February 26, 2019 15:31
Get public data about an NFL player
<?php
/**
* Update this script to include your client ID and secret. You can also
* pass them along as command line arguments.
* Copyright 2017 Yahoo Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
*/
$client_id = 'INSERT_CLIENT_ID_HERE';
$client_secret = 'INSERT_CLIENT_SECRET_HERE';
// See if we want to pull client info from command line
<?php
// Copyright 2017 Yahoo Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
// **** POTENTIAL CONFIGURATION STARTS HERE ****
// MODIFY: Insert your own consumer key and secret here!
$consumer_data = array();
$consumer_data['test']['key'] = '<INSERT CONSUMER KEY HERE>';
$consumer_data['test']['secret'] = '<INSERT CONSUMER SECRET HERE>';
<?php
///////////////////////////////////////////////////////////////////////////////
// Copyright 2017 Yahoo Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
// FUNCTION make_write_request
/// @brief Make a write (PUT/POST) request
///
/// @param[out] $auth_failure Sets variable to true on 401 HTTP code (auth)
/// @param[in] $consumer_key Application consumer key
/// @param[in] $consumer_secret Application consumer secret
/// @param[in] $access_token Access token for user/application
<?php
// Copyright 2017 Yahoo Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
$consumer_key = '<INSERT CONSUMER KEY HERE>';
$consumer_secret = '<INSERT CONSUMER SECRET HERE>';
$o = new OAuth( $consumer_key, $consumer_secret,
OAUTH_SIG_METHOD_HMACSHA1,
OAUTH_AUTH_TYPE_URI );
$url = 'https://fantasysports.yahooapis.com/fantasy/v2/game/nfl';
<?xml version="1.0" encoding="UTF-8"?>
<fantasy_content xml:lang="en-US" yahoo:uri="http://fantasysports.yahooapis.com/fantasy/v2/game/nfl" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" time="30.575037002563ms" copyright="Data provided by Yahoo! and STATS, LLC" xmlns="http://fantasysports.yahooapis.com/fantasy/v2/base.rng">
<game>
<game_key>257</game_key>
<game_id>257</game_id>
<name>Football</name>
<code>nfl</code>
<type>full</type>
<url>https://football.fantasysports.yahoo.com/f1</url>
<season>2011</season>
<?xml version="1.0" encoding="UTF-8"?>
<fantasy_content xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xmlns="http://fantasysports.yahooapis.com/fantasy/v2/base.rng" xml:lang="en-US" yahoo:uri="http://fantasysports.yahooapis.com/fantasy/v2/team/253.l.102614.t.10/roster/players" time="110.02206802368ms" copyright="Data provided by Yahoo! and STATS, LLC">
<team>
<team_key>253.l.102614.t.10</team_key>
<team_id>10</team_id>
<name>Matt Dzaman</name>
<url>https://baseball.fantasysports.yahoo.com/b1/102614/10</url>
<team_logos>
<team_logo>
<size>medium</size>
<?xml version="1.0"?>
<fantasy_content>
<roster>
<coverage_type>week</coverage_type>
<week>13</week>
<players>
<player>
<player_key>242.p.8332</player_key>
<position>WR</position>
<?xml version="1.0" encoding="UTF-8"?>
<fantasy_content xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xmlns="http://fantasysports.yahooapis.com/fantasy/v2/base.rng" xml:lang="en-US" yahoo:uri="http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431/players;player_keys=223.p.5479" time="508.72206687927ms" copyright="Data provided by Yahoo! and STATS, LLC">
<league>
<league_key>223.l.431</league_key>
<league_id>431</league_id>
<name>Y! Friends and Family League</name>
<url>https://football.fantasysports.yahoo.com/archive/pnfl/2009/431</url>
<password>liss</password>
<draft_status>postdraft</draft_status>
<num_teams>14</num_teams>