futapi / fut

fut is a simple library for managing Fifa 19 Ultimate Team.
GNU General Public License v3.0
317 stars 138 forks source link

Any way to specifically search for rare cards? #269

Open j-stone opened 7 years ago

j-stone commented 7 years ago

Is there way to send 'rareFlag == 1' in the search request to EA servers to only return rare cards in the results?

Apologies in advance if I've overlooked something and it's a silly question.

oczkers commented 7 years ago

There wasn't but now it is :)

https://github.com/oczkers/fut/archive/master.zip

    >>>> fut.searchAuctions(..., rare=True)
j-stone commented 7 years ago

This wasn't working so I realised I made a mistake calling the param rareFlag, it is actually rareflag. I updated this in searchAuctions() and re-installed. However, I still receive non-rare results when setting rare=True.

oczkers commented 7 years ago

However, I still receive non-rare results when setting rare=True.

Maybe it's only for listing non-rare items when rareflag=0?

j-stone commented 7 years ago

I'm not sure what you mean? I receive results containing both rare and non-rare items regardless of whether I set rare to True or False at the moment. Little bit strange as we are definitely setting rareflag = 1 in the params but the results contain rareflag=0 and 1.

oczkers commented 7 years ago

I set it to not sending any rareflag to ea if nothing or False was given. Now logic is changed so:

rare is default set to True if you change it to False there shouldn't be any rare cards in results so it's not solving Your problem and looks like you have to make for loop to check if item is rare. For example:

items = fut.searchAucitons(...)
for item in items:
    if item['rareFlag'] == 1:  # or maybe True? i don't remember
        do_sth()

or simple one line transformation:

items = fut.searchAucitons(...)
items = [i for i in items if i['rareFlag'] == 1]

PS. Is it even possible to get only rare items via webapp?

j-stone commented 7 years ago

The webapp does not provide a method to search for rare/non-rare specifically, only filtered by bronze/silver/gold/special. But I was told my someone on a forum that they were specifically sniping rare golds as in they were able to return only rares from their search request.

I was doing it the way you suggest by completing a search request and eliminating non-rares based on the rareflag attribute but this is a bad method as your search request starts with those that are expiring and no cheap ones last that long. Would need to be searching on the pages around 60 min remaining but this would all lead to too many requests sent to the EA server in too short a period of time resulting in a ban.

Thanks anyway for your help! Much appreciated.

oczkers commented 7 years ago

The webapp does not provide a method to search for rare/non-rare specifically

In that case i need someone to confirm that this param is working at all before merging into main release. test version (rareflag branch): https://github.com/oczkers/fut/archive/rareflag.zip