mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-02-07 09:00:59 +00:00
Added upload of video to Mastodon instance
This commit is contained in:
parent
909183eb0a
commit
99ffa52eb6
12
twoot.py
12
twoot.py
|
@ -470,8 +470,18 @@ def main(argv):
|
||||||
# Skip to next tweet
|
# Skip to next tweet
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Upload photos
|
|
||||||
media_ids = []
|
media_ids = []
|
||||||
|
|
||||||
|
# Upload video if there is one
|
||||||
|
if tweet['video'] is not None:
|
||||||
|
try:
|
||||||
|
media_posted = mastodon.media_post(tweet['video'])
|
||||||
|
media_ids.append(media_posted['id'])
|
||||||
|
except (MastodonAPIError, MastodonIllegalArgumentError, TypeError): # Media cannot be uploaded (invalid format, dead link, etc.)
|
||||||
|
pass
|
||||||
|
|
||||||
|
else: # Only upload pic if no video was uploaded
|
||||||
|
# Upload photos
|
||||||
for photo in tweet['photos']:
|
for photo in tweet['photos']:
|
||||||
media = False
|
media = False
|
||||||
# Download picture
|
# Download picture
|
||||||
|
|
Loading…
Reference in New Issue
Block a user