Skip to content

Instantly share code, notes, and snippets.

@alexymik
Created September 12, 2020 02:25
Show Gist options
  • Save alexymik/fba6c3837b01c1c81751f0655c4d0ddb to your computer and use it in GitHub Desktop.
Save alexymik/fba6c3837b01c1c81751f0655c4d0ddb to your computer and use it in GitHub Desktop.
Python script to unsubcribe an apartment building from RetailMeNot mail flyers. Requires AntiCaptcha API key
import cloudscraper
import pprint
import names
import time
UNSUBSCRIBE_URL = 'https://www.retailmenot.com/responsive/ajax/UnsubscribeMailerQueue.php'
APARTMENT_MAX_FLOOR = 6
APARTMENT_MAX_UNIT = 7
for apt_floor in range(1, APARTMENT_MAX_FLOOR + 1):
for apt_unit in range(1, APARTMENT_MAX_UNIT + 1):
name = names.get_full_name()
apt_number = apt_floor * 100 + apt_unit
payload = {
"fullName": name,
"aptUnitNumber": apt_number,
"streetAddress": "Your Address",
"city": "Your City",
"state": "CA",
"zipCode": "Your Zip",
"email": "null",
"phoneNumber": "null",
"source": "RMN",
"dateTime": 1594161792
}
print("Unsubscribing %s in apartment %s ..." % (name, apt_number))
scraper = cloudscraper.create_scraper(
interpreter="nodejs",
recaptcha={
"provider": "anticaptcha",
"api_key": ""
})
response = scraper.post(UNSUBSCRIBE_URL, json=payload)
pprint.pprint(response.text)
exit(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment