Skip to content

Instantly share code, notes, and snippets.

@peter9811
Last active February 28, 2025 14:25
Show Gist options
  • Select an option

  • Save peter9811/5cbca1535ed44dcebd5b9bb7dd65d227 to your computer and use it in GitHub Desktop.

Select an option

Save peter9811/5cbca1535ed44dcebd5b9bb7dd65d227 to your computer and use it in GitHub Desktop.

Revisions

  1. peter9811 renamed this gist Feb 28, 2025. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. peter9811 created this gist Sep 4, 2024.
    32 changes: 32 additions & 0 deletions Add Games to Steam Wishlist
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    // Your Steam game IDs
    var gameIDs = [1549970, 440, 730]; // Replace with your game IDs

    // Get the session ID from cookies
    var sessionID = document.cookie.match(/sessionid=([^;]+)/)[1];

    // Function to add games to the wishlist
    async function addToWishlist(gameIDs) {
    for (let i = 0; i < gameIDs.length; i++) {
    let appID = gameIDs[i];

    await fetch('https://store.steampowered.com/api/addtowishlist', {
    method: 'POST',
    headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
    },
    body: `appid=${appID}&sessionid=${sessionID}`
    }).then(response => {
    if (response.ok) {
    console.log(`Added appID: ${appID} to wishlist`);
    } else {
    console.error(`Failed to add appID: ${appID}`);
    }
    }).catch(error => console.error(`Error adding appID: ${appID}`, error));

    await new Promise(resolve => setTimeout(resolve, 150)); // Delay to avoid triggering rate limits
    }
    console.log('All games processed');
    }

    // Start the process
    addToWishlist(gameIDs);