Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save OrderAndCh4oS/9626ef7411df99931c7e0d315295c332 to your computer and use it in GitHub Desktop.

Select an option

Save OrderAndCh4oS/9626ef7411df99931c7e0d315295c332 to your computer and use it in GitHub Desktop.

Revisions

  1. @L422Y L422Y revised this gist Sep 19, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Mass cancel Amazon Subscribe and Save.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ https://www.amazon.com/auto-deliveries/subscriptionList?shipId=mpkmmwlssrkq&ref_

    2. Paste into devtools console
    3. Wait a few moments, and then refresh/repeat for any additional pages
    4. Confirm by checkout your email inbox for the cancellation emails
    4. Confirm by checking to see if you've received cancellation emails

    ```js
    await Promise.all([...document.querySelectorAll('[data-subscription-id]')]
  2. @L422Y L422Y renamed this gist Jul 10, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @L422Y L422Y created this gist Jul 10, 2024.
    44 changes: 44 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    1. Open your subscriptions page:
    ```
    https://www.amazon.com/auto-deliveries/subscriptionList?shipId=mpkmmwlssrkq&ref_=mys_nav_op_D
    ```

    2. Paste into devtools console
    3. Wait a few moments, and then refresh/repeat for any additional pages
    4. Confirm by checkout your email inbox for the cancellation emails

    ```js
    await Promise.all([...document.querySelectorAll('[data-subscription-id]')]
    .map(el => el.getAttribute('data-subscription-id'))
    .map(async (subscriptionId) => {
    try {
    const res = await fetch(`https://www.amazon.com/auto-deliveries/ajax/cancelSubscription?deviceType=desktop&deviceContext=web&subscriptionId=${subscriptionId}`)
    const cancelPanel = await res.text()

    const div = document.createElement('div')
    div.innerHTML = cancelPanel
    document.body.appendChild(div)

    const form = div.querySelector("form[name='cancelForm']")
    if (form) {
    const formData = new FormData(form)
    const formEntries = Object.fromEntries(formData.entries())

    await fetch(form.action, {
    method: form.method,
    headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
    },
    body: new URLSearchParams(formEntries)
    })

    div.remove()
    }

    return 'ok'
    } catch (reason) {
    return `error: ${reason}`
    }
    })
    )
    ```