-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathurlTester.js
46 lines (44 loc) · 2.5 KB
/
urlTester.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/******
* This is used to test various urls and logs the data to the Logger
* It is not needed, but here to test things
*/
function testUrl() {
let teamKey = `${yearId}.l.${GLOBALS.leagueKey}.t.2`
let service = getService();
if (service.hasAccess()) {
let response
//let url = "https://fantasysports.yahooapis.com/fantasy/v2/leagues"
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/league/${GLOBALS.leagueKey}/standings;week=1`
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/team/${teamKey}`;
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/team/${teamKey}/roster;type=week;week=2/players`
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/league/${yearId}.l.${GLOBALS.leagueKey}/players;player_keys=${yearId}.p.27560/stats;type=week;week=1`;
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/player/stats;player_keys=${yearId}.p.27560,${yearId}.p.24788;weeks=1`
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/league/${yearId}.l.${GLOBALS.leagueKey}/draftresults`
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/team/${teamKey}/matchups;weeks=1`;
let url = `https://fantasysports.yahooapis.com/fantasy/v2/team/${yearId}.l.${GLOBALS.leagueId}.t.2/matchups;weeks=2`
//let url =`https://fantasysports.yahooapis.com/fantasy/v2/league/${leagueKey}/teams`;
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/teams;team_keys=${teamKey}/matchups;type=week;week=1`;
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/team/${teamKey}/roster;type=week;week=2/players`;
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/player/stat_categories`;
//let url =`https://fantasysports.yahooapis.com/fantasy/v2/team/${yearId}.l.${GLOBALS.leagueKey}.t.1/roster;type=week;week=8/players`;
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/league/${yearId}.l.${GLOBALS.leagueKey}/players;player_keys=${yearId}.p.32671,${yearId}.p.29288,${yearId}.p.30197,${yearId}.p.30218,${yearId}.p.31919/stats;type=week;week=7`
//let url = `https://fantasysports.yahooapis.com/fantasy/v2/team/${teamKey}/metadata`
try{
response = UrlFetchApp.fetch(url, {
muteHttpExceptions: true,
headers: {
'Authorization': 'Bearer ' + service.getAccessToken()
}
});
}
catch(e){
Logger.log(e)
}
let xml = response.getContentText();
let json = XML_to_JSON(xml);
Logger.log(JSON.stringify(json))
}
else{
showSidebar();
}
}