Created
April 5, 2020 17:04
-
-
Save klyr/62482e282d1f6a36d382f2089eff5529 to your computer and use it in GitHub Desktop.
Remove all bookmarks
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
import requests | |
import bs4 | |
my_recipes = 'https://cookidoo.fr/organize/fr-FR/my-recipes' | |
book = 'https://cookidoo.fr/organize/fr-FR/api/bookmark' | |
cookies = 'XXX' | |
while True: | |
print("===") | |
r = requests.get(my_recipes, headers={'Cookie': cookies}) | |
soup = bs4.BeautifulSoup(r.text, 'html.parser') | |
recipes = soup.find_all("core-tile") | |
if len(recipes) == 0: break | |
for c in recipes: | |
r_id = c.get('data-recipe-id') | |
body = {"_method": "delete", "recipeId": r_id} | |
print(f"Deleting recipe {r_id}") | |
r = requests.delete(book, headers={'Cookie': cookies}, data=body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment