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_sample.js
Last active May 21, 2020 12:15
Yahoo Weather API JavaScript Example
// Weather API sample javascript code
// Requires: jQuery and crypto-js (v3.1.9)
//
// Copyright 2019 Oath Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
var url = 'https://weather-ydn-yql.media.yahoo.com/forecastrss';
var method = 'GET';
var app_id = 'your-app-id';
var consumer_key = 'your-consumer-key';
var consumer_secret = 'your-consumer-secret';
@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.
// To use this code, you must have the default PHP OAuth extension installed: https://php.net/oauth
// You you will also need to fill in your own consumer key and secret where specified.
// You should then be able to execute the PHP script from the command line.
// **** POTENTIAL CONFIGURATION STARTS HERE ****
<?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>
<!--https://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431-->
<?xml version="1.0" encoding="UTF-8"?>
<fantasy_content xml:lang="en-US" yahoo:uri="http://fantasysports.yahooapis.com/fantasy/v2/league/223.l.431" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" time="181.80584907532ms" copyright="Data provided by Yahoo! and STATS, LLC" xmlns="http://fantasysports.yahooapis.com/fantasy/v2/base.rng">
<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>
<draft_status>postdraft</draft_status>
<num_teams>14</num_teams>
<!--https://fantasysports.yahooapis.com/fantasy/v2/team/223.l.431.t.1/matchups;weeks=1,5-->
<!--Team matchups for weeks 1 and 5 in a NFL H2H league-->
<?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/223.l.431.t.1/matchups;weeks=1,5" time="576.54285430908ms" copyright="Data provided by Yahoo! and STATS, LLC">
<team>
<team_key>223.l.431.t.1</team_key>
<team_id>1</team_id>
<name>PFW - Blunda</name>
<url>https://football.fantasysports.yahoo.com/archive/pnfl/2009/431/1</url>
<team_logos>