yahoo-fantasy-sports-api icon indicating copy to clipboard operation
yahoo-fantasy-sports-api copied to clipboard

players.leagues cannot use comma separated list of player statuses in filter's status property

Open Liam-OShea opened this issue 2 years ago • 3 comments

Hi Luke!

I noticed that the players.leagues endpoint does not work when providing more than one status in the filter object.

Here is an example of how I construct the query: statuses = "T,K" const filter = { start: i, status: statuses // Comma separated list of statuses }

const players = await yf.players.leagues(league_key, filter, subresources)

I tried supplying the statuses in three separate ways, here are the results:

statuses = "T,K"

PS C:\Users\liamo\Documents\Work\Yahoo API> node .\main.js { 'xml:lang': 'en-us', 'yahoo:uri': '/fantasy/v2/leagues;league_keys=404.l.146608/players;out=stats,ownership,percent_owned,draft_analysis;start=50;status=T,K?format=json', description: 'Invalid status filter option provided.', detail: '' }

statuses = "T, K" // With a space

PS C:\Users\liamo\Documents\Work\Yahoo API> node .\main.js TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters at new ClientRequest (_http_client.js:148:13) at Proxy.request (https.js:314:10) at C:\Users\liamo\Documents\Work\Yahoo API\node_modules\yahoo-fantasy\YahooFantasy.mjs:279:10 at new Promise () at YahooFantasy.api (C:\Users\liamo\Documents\Work\Yahoo API\node_modules\yahoo-fantasy\YahooFantasy.mjs:277:12) at PlayersCollection.leagues (C:\Users\liamo\Documents\Work\Yahoo API\node_modules\yahoo-fantasy\collections\playersCollection.mjs:96:8) at getPlayers (C:\Users\liamo\Documents\Work\Yahoo API\main.js:55:30) at main (C:\Users\liamo\Documents\Work\Yahoo API\main.js:13:18) at Object. (C:\Users\liamo\Documents\Work\Yahoo API\main.js:81:2) at Module._compile (internal/modules/cjs/loader.js:1138:30) { code: 'ERR_UNESCAPED_CHARACTERS' }

statuses = ["T","K"]

PS C:\Users\liamo\Documents\Work\Yahoo API> node .\main.js { 'xml:lang': 'en-us', 'yahoo:uri': '/fantasy/v2/leagues;league_keys=404.l.146608/players;out=stats,ownership,percent_owned,draft_analysis;start=0;status=T,K?format=json', description: 'Invalid status filter option provided.', detail: '' }

This seems to be an issue with how Yahoo accepts the parameters, rather than with how the wrapper is processing them.

Liam-OShea avatar Sep 03 '21 17:09 Liam-OShea

Unsubscribe

On Sep 3, 2021, at 1:11 PM, Liam-OShea @.***> wrote:

Hi Luke!

I noticed that the players.leagues endpoint does not work when providing more than one status in the filter object.

Here is an example of how I construct the query: statuses = "T,K" const filter = { start: i, status: statuses // Comma separated list of statuses }

const players = await yf.players.leagues(league_key, filter, subresources)

I tried supplying the statuses in three separate ways, here are the results:

statuses = "T,K"

PS C:\Users\liamo\Documents\Work\Yahoo API> node .\main.js { 'xml:lang': 'en-us', 'yahoo:uri': '/fantasy/v2/leagues;league_keys=404.l.146608/players;out=stats,ownership,percent_owned,draft_analysis;start=50;status=T,K?format=json', description: 'Invalid status filter option provided.', detail: '' }

statuses = "T, K" // With a space

PS C:\Users\liamo\Documents\Work\Yahoo API> node .\main.js TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters at new ClientRequest (_http_client.js:148:13) at Proxy.request (https.js:314:10) at C:\Users\liamo\Documents\Work\Yahoo API\node_modules\yahoo-fantasy\YahooFantasy.mjs:279:10 at new Promise () at YahooFantasy.api (C:\Users\liamo\Documents\Work\Yahoo API\node_modules\yahoo-fantasy\YahooFantasy.mjs:277:12) at PlayersCollection.leagues (C:\Users\liamo\Documents\Work\Yahoo API\node_modules\yahoo-fantasy\collections\playersCollection.mjs:96:8) at getPlayers (C:\Users\liamo\Documents\Work\Yahoo API\main.js:55:30) at main (C:\Users\liamo\Documents\Work\Yahoo API\main.js:13:18) at Object. (C:\Users\liamo\Documents\Work\Yahoo API\main.js:81:2) at Module._compile (internal/modules/cjs/loader.js:1138:30) { code: 'ERR_UNESCAPED_CHARACTERS' }

statuses = ["T","K"]

PS C:\Users\liamo\Documents\Work\Yahoo API> node .\main.js { 'xml:lang': 'en-us', 'yahoo:uri': '/fantasy/v2/leagues;league_keys=404.l.146608/players;out=stats,ownership,percent_owned,draft_analysis;start=0;status=T,K?format=json', description: 'Invalid status filter option provided.', detail: '' }

This seems to be an issue with how Yahoo accepts the parameters, rather than with how the wrapper is processing them.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

japhy-snyder avatar Sep 04 '21 22:09 japhy-snyder

Interesting... Indeed it's not working...

This makes me believe that perhaps they've removed this functionality on their side at some point since I originally wrote the docs 7 years ago... Their docs don't specify we can use multiple filters... but they aren't always the most reliable.

If my contact gets back to me I'll follow up with a question about this.

whatadewitt avatar Sep 21 '21 01:09 whatadewitt

Hmm.. I thought I had used this feature while experimenting a couple months ago and that it had worked - although I may be misremembering. Sounds good

Liam-OShea avatar Sep 21 '21 18:09 Liam-OShea