Sto provando a configurare una semplice app che utilizza l'API di Yahoo Fantasy Sport e consente l'esecuzione di query tramite YQL.Problema con Yahoo Sports API
class Program
{
static void Main(string[] args)
{
string yql = "select * from fantasysports.games where game_key in ('268')";
//var xml = QueryYahoo(yql);
// Console.Write(xml.InnerText);
string consumerKey = "--my key--";
string consumerSecret = "--my secret--";
var xml = QueryYahoo(yql, consumerKey, consumerSecret);
Console.Write(xml.InnerText);
}
private static XmlDocument QueryYahoo(string yql)
{
string url = "http://query.yahooapis.com/v1/public/yql?format=xml&diagnostics=false&q=" + Uri.EscapeUriString(yql);
var req = System.Net.HttpWebRequest.Create(url);
var xml = new XmlDocument();
using (var res = req.GetResponse().GetResponseStream())
{
xml.Load(res);
}
return xml;
}
private static XmlDocument QueryYahoo(string yql, string consumerKey, string consumerSecret)
{
string url = "http://query.yahooapis.com/v1/yql?format=xml&diagnostics=true&q=" + Uri.EscapeUriString(yql);
url = OAuth.GetUrl(url, consumerKey, consumerSecret);
var req = System.Net.HttpWebRequest.Create(url);
var xml = new XmlDocument();
using (var res = req.GetResponse().GetResponseStream())
{
xml.Load(res);
}
return xml;
}
V'è una certa nascosto qui dentro, ho una classe personalizzata per rendere l'url ok per l'API di Yahoo. Ecco la struttura dell'URL che il metodo OAuth.GetUrl() restituisce
Con questo, mi sembra sempre di ottenere Errore di autenticazione. La tabella fantasysports.games richiede un livello di sicurezza maggiore di quello fornito, hai fornito APP ma almeno USER è atteso
Non sono sicuro di cosa significhi, sto passando le mie informazioni di autenticazione all'api, ma sembra che ho bisogno più permessi. Qualcuno ha un esempio funzionante di questo. Se necessario, posso fornire codice al metodo GetUrl, ma è più o meno una copia incolla da qui
http://andy.edinborough.org/Getting-Started-with-Yahoo-and-OAuth
Fatemi sapere se avete domande. Grazie!
hai mai questo numero? –
@RyanDrost Non l'ho fatto –
Se qualcuno ha qualche idea su come estrarre dati di giocatori semplici (che dovrebbero essere disponibili pubblicamente?) Per favore aiutatemi. Qualcuno ha capito come far funzionare un comando YQL nella sua app Web MVC? – dave317