not giving answers

master
Pedro Sá Couto 6 years ago
commit 64ebd4094b

@ -0,0 +1,48 @@
from mastodon import Mastodon
from pprint import pprint
import os
import time
import datetime
from pprint import pprint
today = datetime.date.today()
text_file = open("dms_results.txt", "a+")
text_file.write("Data collected on : "+str(today)+"\n"+"\n")
instances = ["https://todon.nl/", "https://quey.org/"]
#toots token order is also the same
#FOR EXAMPLE
#toot_id[0] goes with instances[0] and now goes with line nr1 from txt file
with open('token.txt', 'r') as token:
for n, token_line in enumerate(token.readlines()):
base_url = instances[n]
print(token_line, base_url)
# token_line is one of the token.txt
# You are reading in token.readlines() and there is no need to read again
# you can use var token_line
mastodon = Mastodon(access_token=token_line.replace('\n', ''),
api_base_url=(str(base_url)))
'''
mastodon direct messages, are the same as toots: *status updates*
With the difference that their visibility rathern than
being public / unlisted / private, are direct status updates
'''
my_credentials = mastodon.account_verify_credentials()
my_id = my_credentials['id']
my_statuses = mastodon.account_statuses(id=my_id)
for status in my_statuses:
if status['visibility'] == 'direct': # filter only direct msgs
pprint(status)
# pprint(status['mentions'])
# print(status['content'])
# print(status['id'])
# print(status['created_at'])
#
# text_file.write("Avatar:" + "\n" + str(bot) + "\n" + "\n")
# text_file.write("Content:" + "\n" + str(content) + "\n" + "\n" + "\n")
#text_file.write("Impossible to print image"+"\n"+"\n")
Loading…
Cancel
Save