Skip to content

Instantly share code, notes, and snippets.

@xrobau
Last active August 7, 2024 05:06
Show Gist options
  • Save xrobau/fe62f17f19a0af58455c3c7133224368 to your computer and use it in GitHub Desktop.
Save xrobau/fe62f17f19a0af58455c3c7133224368 to your computer and use it in GitHub Desktop.
Bulk remove items from Steam Marketplace
// Push F12 when you're logged into steam in your browser, to open the devtools window
// Edit the window.appid line to change it to the app you want to remove all items from
// the marketplace for, and maxloops to the number of times it'll pull 100 and try to
// remove them. If you have lots of OTHER things in the market, this might not be for
// you, as it will only look at the first 100 items you have up for sale.
window.appid = 3069990; // 'RantCPU Clickbait', random NFT-esque game.
window.pl = function () {
console.log(window.toremove.length + " items to remove");
x = window.toremove.shift();
if (x) {
console.log("Removing item " + x[1]);
$J.post("//steamcommunity.com/market/removelisting/" + x[1], { sessionid: g_sessionID }, function () {
setTimeout(window.pl, 100);
});
} else {
window.maxloops--;
if (window.maxloops) {
console.log("I would go again", window.maxloops);
window.c();
} else {
console.log("I am finished, not going again", window.maxloops);
}
}
}
window.c = function () {
// Sadly, can't filter by appid. It would be amazing if this worked. It doesn't.
$J.getJSON("//steamcommunity.com/market/mylistings/?appid=" + window.appid + "&count=100", function (data) {
window.toremove = [];
console.info("Done loading listings");
if (data.assets[window.appid]) {
var i = data.assets[window.appid][2];
console.log("I have i", i);
$J.each(i, function (k, v) {
var r = new RegExp("RemoveMarketListing\\(\'mylisting\'\, \'(\\d+)\'\, " + window.appid + "\, \'2\'\, \'" + k + "\'", "i");
var itemid = data.results_html.match(r);
if (itemid) {
window.toremove.push(itemid);
}
});
}
if (window.toremove.length) {
console.log("Dispatching");
window.pl();
} else {
console.log("Nothing left to remove");
}
});
};
// This actually starts it. If you want to run it again, don't
// forget to set window.maxloops to something positive!
window.maxloops = 5;
window.c();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment