Last active
October 3, 2021 18:14
-
-
Save drench/5972614 to your computer and use it in GitHub Desktop.
Use this if your Amazon wishlist has mysterious items that are unhelpfully "no longer available". While on the offending wish list page, open your browser debugger console and run this to get a list of IDs for the "no longer available" items. Paste them in to Google and there's a very good chance you'll find out what that item was.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
let result = document.evaluate('//span[contains(text(), "is no longer available")]', document.body); | |
let node = null; | |
while (node = result.iterateNext()) { console.log(node.id.replace(/^itemName_/, '')) } | |
})(); |
Thanks for this... the IDs it returned weren't very helpful, but I saw the ASINs were still in the tree, so I tweaked it a bit. Try this:
(function () {
let result = document.evaluate('//span[contains(text(), "is no longer available")]', document.body);
let node = null;
while (node = result.iterateNext()) {
let id = node.id.replace(/^itemName_/, '');
let node2 = node;
while(node2) {
let attr = node2.attributes["data-itemid"];
if (attr && attr.value == id)
break;
node2 = node2.parentElement;
}
let v = node2.attributes["data-reposition-action-params"].value;
v = v.replace(/^.*(ASIN:[^|]+).*$/, "$1");
console.log(v);
}
})();
I had pretty good luck with the 6 missing items on my wishlist using the ASINs. I had to search without the "ASIN" prefix for a couple of them, and I had to use Bing to find one, but I was able to track down what they all were.
Looks good, though weirdly I am seeing the details on my "discontinued" items on my wishlists now as-is so I can't try it out myself. The links (one example here) are 404s.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It works in the sense that it spits out a few codes, but unfortunately they dont seem to be useful, at least in my case. Searches on Amazon and Google turn up either literally nothing or things I'd never have on my wishlist. Ive had some luck using this method, but even that is hit or miss, which I guess is probably due to the reason that this is even an issue ( being that the items became unlisted or whatever.) I just wish amazon could've just left the titles there so we could at least just read that or something.
Regardless I appreciate the help and effort, especially for something you probably forgot about a long time ago lol.