Created
April 1, 2016 17:24
-
-
Save atbradley/b529e897093f9ca61fc1e480ebf05e67 to your computer and use it in GitHub Desktop.
Remove "unread" tweets from Pinboard.
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
USER_TOKEN = 'pinboard:ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' | |
import re | |
import requests | |
import sys | |
import time | |
links = requests.get('https://api.pinboard.in/v1/posts/all?auth_token='+USER_TOKEN+'&format=json')#&count=100') | |
if links.status_code != 200: | |
print("FAIL: "+links.status_code) | |
sys.exit() | |
cnt = 0 | |
for link in links.json():#['posts']: | |
if 'yes' == link['toread'] and re.search('https?://(.+\.)?twitter.com', link['href']): | |
cnt += 1 | |
requests.get('https://api.pinboard.in/v1/posts/delete?auth_token='+USER_TOKEN+'&format=json&url='+link['href']) | |
print(link['href']) | |
time.sleep(5) | |
print(cnt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment