Skip to content

Instantly share code, notes, and snippets.

@atbradley
Created April 1, 2016 17:24
Show Gist options
  • Save atbradley/b529e897093f9ca61fc1e480ebf05e67 to your computer and use it in GitHub Desktop.
Save atbradley/b529e897093f9ca61fc1e480ebf05e67 to your computer and use it in GitHub Desktop.
Remove "unread" tweets from Pinboard.
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