benjaminjackman / looty

Looty! A tool for Path of Exile that makes inventory searching fun!
GNU General Public License v2.0
60 stars 21 forks source link

Unique stash missing #38

Open AnnanFay opened 4 years ago

AnnanFay commented 4 years ago

The special unique stash is missing from the item data.

On the character viewer on the website you cannot view items, but items are shown in the 'Stashes' section of the user profile, and you can share them like this.

Not sure if this is a known issue, or if someone is already working on it. If someone points me towards the parts of the code which deals with this I'll have a look at implementing it.

It's listed as a bug here (2nd post) so maybe the plan is to ignore it until it's fixed? In which case a statement should be added to the readme, 'Known Bugs' or something.

(edit: though, that bug is from 2016... )

piotrszymaniec commented 4 years ago

That bug is not that old, because Unique stash tab was introduced in march 2019.

I don't have that stash tab, so i don't even have ability to check if you can get it from http://api.pathofexile.com/public-stash-tabs If you'd be so kind, and see for yourself. Then we would know, is there anything to work with. Please check in browser: https://www.pathofexile.com/character-window/get-stash-items?league=Standard&realm=pc&accountName=AnnanFay&tabs=1&POESESSID=_your_poesessid and then add tabIndex= with your unique stash tab index.

Plugin is not often updated, as author doesn't have much time for it. So its difficult to change here something fast. I don't know if anyone is tinkering in looty in goal of pull requests (besides my small attempts).

As for peace of code ... PoeRpc.scala has all logic that connects to API and pulls data. But there is no difference how to treat one tab, different then other. And im not knowledgeable enough to be precise about whats happening where. As I picked up Scala only with purpose of changing here and there. :)

AnnanFay commented 4 years ago

Thanks for the info. What I've found so far:

The get-stash-items API lists the unique tab as if it's a normal tab but with a special type:

    {
        "n": "\u263e",
        "i": 4,
        "id": "edb8df0e801c1dabddfd35fe491785c8baa35301bd546d3c3cc2811e5bb63ec7",
        "type": "UniqueStash",
        "hidden": false,
        "selected": false,
        "colour": { "r": 191, "g": 94, "b": 0 },
        "srcL": "https://web.poecdn.com/gen/image/WzIzLDEseyJ0IjoibCIsImMiOi00MjM1Nzc2fV0/b8a88fb564/Stash_TabL.png",
        "srcC": "https://web.poecdn.com/gen/image/WzIzLDEseyJ0IjoibSIsImMiOi00MjM1Nzc2fV0/be2de19940/Stash_TabL.png",
        "srcR": "https://web.poecdn.com/gen/image/WzIzLDEseyJ0IjoiciIsImMiOi00MjM1Nzc2fV0/410809a5c6/Stash_TabL.png"
    },

However when items are requested with tabIndex it lists the tab as if it were empty.

{
    "numTabs": 23,
    "tabs": [...],
    "uniqueLayout": {},
    "items": []
}

The id above is where the sharing url comes from: https://www.pathofexile.com/account/view-stash/AnnanFay/edb8df0e801c1dabddfd35fe491785c8baa35301bd546d3c3cc2811e5bb63ec7. The data is embedded in the HTML and there appears no way to list all contents - you get new pages by appending / and the page number to the end (20 pages).

I guess the best thing to do is just hope the API is fixed. The alternative is screen scraping the data, which doesn't seem great.

piotrszymaniec commented 4 years ago

Thanks for checking! So it's the same case as with Map stash tab. Though with Map tab people found tricks to make them for sale and request their contents via trade api, targeting their user name, but its rather gimmicky. And I dont particularly need that info. There is plenty to improve QoL in looty without it :)

chinhodado commented 2 years ago

This shouldn't be too hard to implement. From the id of the unique tab, requesting

https://www.pathofexile.com/account/view-stash/<user>/<id>/<n>

where n is a number from 1 to 22 will give a HTML document for each sub-tab. Inside that HTML document near the end there is this line

require(["PoE/Item/DeferredItemRenderer"], function(R) { ...

which contains the JSON content of the tab. So we just need to iterate from 1 to 22, fetch the HTML page at each URL, and parse each HTML page to get the JSON.