|
|
@ -46,14 +46,13 @@ tmp = json.loads(http.read())['json']['data']
|
|
|
|
headers.update({'Cookie': 'reddit_session=%s' % tmp['cookie']})
|
|
|
|
headers.update({'Cookie': 'reddit_session=%s' % tmp['cookie']})
|
|
|
|
modhash = tmp['modhash']
|
|
|
|
modhash = tmp['modhash']
|
|
|
|
|
|
|
|
|
|
|
|
print '# Headers: %s' % headers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for dat in deletion_ids:
|
|
|
|
for dat in deletion_ids:
|
|
|
|
print u'''{time} {subreddit}: {text}...'''.format(
|
|
|
|
id = dat['id']
|
|
|
|
subreddit = dat['subreddit'],
|
|
|
|
time = datetime.fromtimestamp(dat['created']).date()
|
|
|
|
id = dat['id'],
|
|
|
|
subreddit = dat['subreddit']
|
|
|
|
time = datetime.fromtimestamp(dat['created']).date(),
|
|
|
|
text = dat[u'body'][:20]
|
|
|
|
text = dat[u'body'][:20])
|
|
|
|
|
|
|
|
|
|
|
|
print '{time} {subreddit}: "{text}..."'.format(subreddit=subreddit, id=id, time=time, text=text)
|
|
|
|
# And now for the deleting
|
|
|
|
# And now for the deleting
|
|
|
|
conn = httplib.HTTPConnection('www.reddit.com')
|
|
|
|
conn = httplib.HTTPConnection('www.reddit.com')
|
|
|
|
params = urllib.urlencode({
|
|
|
|
params = urllib.urlencode({
|
|
|
@ -62,6 +61,7 @@ for dat in deletion_ids:
|
|
|
|
'api_type': 'json'})
|
|
|
|
'api_type': 'json'})
|
|
|
|
conn.request('POST', '/api/del', params, headers)
|
|
|
|
conn.request('POST', '/api/del', params, headers)
|
|
|
|
http = conn.getresponse()
|
|
|
|
http = conn.getresponse()
|
|
|
|
print http.getheaders(), http.read()
|
|
|
|
if http.read() != '{}':
|
|
|
|
break
|
|
|
|
print '''Failed to delete "%s" (%s - %s - %s)''' % (text, id, time, subreddit)
|
|
|
|
#sleep(2)
|
|
|
|
break # Still in-testing
|
|
|
|
|
|
|
|
sleep(2)
|
|
|
|