Skip to content

Instantly share code, notes, and snippets.

@honno
Created July 18, 2021 10:05
Show Gist options
  • Select an option

  • Save honno/070e5f8a135a882249726f7c407a00c2 to your computer and use it in GitHub Desktop.

Select an option

Save honno/070e5f8a135a882249726f7c407a00c2 to your computer and use it in GitHub Desktop.
Unmute everyone you follow. Yaknow, for those times when you fuck around with the API and mute everybody by accident.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "d65165d3",
"metadata": {},
"outputs": [],
"source": [
"from tweepy import *"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d1d10fda",
"metadata": {},
"outputs": [],
"source": [
"auth = OAuthHandler(<pub>, <priv>)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "af435cef",
"metadata": {},
"outputs": [],
"source": [
"auth.get_authorization_url()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a1fb9bdd",
"metadata": {},
"outputs": [],
"source": [
"token, token_secret = auth.get_access_token(<token>)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "495a7d8d",
"metadata": {},
"outputs": [],
"source": [
"auth.set_access_token(token, token_secret)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "50cdbd02",
"metadata": {},
"outputs": [],
"source": [
"api = API(auth)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1856c809",
"metadata": {},
"outputs": [],
"source": [
"following = api.friends_ids()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6c251a5f",
"metadata": {},
"outputs": [],
"source": [
"from time import sleep\n",
"\n",
"\n",
"for id_ in api.mutes_ids():\n",
" print(f\"{id_=}\")\n",
" while True:\n",
" try:\n",
" api.destroy_mute(id_)\n break\n",
" except TweepError as e:\n",
" if \"272\" in e.response.text:\n",
" break\n",
" print(e)\n",
" sleep(1)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment