check all favorite

This commit is contained in:
Dryusdan 2018-03-10 20:51:34 +01:00
parent 6e15001b25
commit d70759f332
1 changed files with 21 additions and 10 deletions

View File

@ -31,10 +31,14 @@ def get_parameter( parameter, file_path ):
def get_media():
media_attachments = toot.media_attachments
for media in media_attachments:
print(media.url[-20:])
response = requests.get(media.remote_url)
pattern = Image.open(BytesIO(response.content), "r").convert('RGB')
pattern.save('save_media/'+media.url[-20:])
if os.path.isfile('./save_media/'+media.remote_url[-20:]):
sys.exit(0)
if media.remote_url[-3:] != "mp4":
print(media.remote_url[-20:])
response = requests.get(media.remote_url)
pattern = Image.open(BytesIO(response.content), "r").convert('RGB')
pattern.save('save_media/'+media.remote_url[-20:])
secrets_filepath = "secrets/secrets.txt"
@ -50,11 +54,18 @@ mastodon = Mastodon(
api_base_url = 'https://' + mastodon_hostname,
)
masto_allfav = mastodon.favourites(None, None, 40)
for toot in masto_allfav:
if toot.account.acct == "account@domain.com":
get_media()
else :
if toot.account.acct == "otheraccount@domain.com":
while masto_allfav != []:
for toot in masto_allfav:
if toot.account.acct == "bonjourtoutlemonde@hostux.social":
get_media()
else :
if toot.account.acct == "BonjourMadame@hostux.social":
get_media()
else :
if toot.account.acct == "hato0517@mstdn.jp":
get_media()
masto_allfav = mastodon.fetch_next(masto_allfav)
time.sleep(10)