check all favorite
This commit is contained in:
parent
6e15001b25
commit
d70759f332
31
dlimage.py
31
dlimage.py
|
@ -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)
|
||||
|
||||
|
|
Reference in New Issue