mirror of
https://github.com/cquest/tootbot.git
synced 2025-02-23 10:58:25 +00:00
support image/jpeg in addition to image/jpg
This commit is contained in:
parent
3c75dc473c
commit
491e3d7d91
@ -235,12 +235,13 @@ if source[:4] == 'http':
|
|||||||
break
|
break
|
||||||
elif 'links' in t:
|
elif 'links' in t:
|
||||||
for l in t.links:
|
for l in t.links:
|
||||||
if l.type in ('image/gif', 'image/jpg', 'image/png', 'image/webp'):
|
if l.type in ('image/gif', 'image/jpg', 'image/jpeg', 'image/png', 'image/webp'):
|
||||||
media = requests.get(l.url, headers = {'User-agent': 'Mozilla/5.0'})
|
media = requests.get(l.url, headers = {'User-agent': 'Mozilla/5.0'})
|
||||||
if media.status_code == 200:
|
if media.status_code == 200:
|
||||||
media_posted = mastodon_api.media_post(
|
media_posted = mastodon_api.media_post(
|
||||||
media.content, mime_type=media.headers.get('content-type'))
|
media.content, mime_type=media.headers.get('content-type'))
|
||||||
toot_media.append(media_posted['id'])
|
toot_media.append(media_posted['id'])
|
||||||
|
break
|
||||||
|
|
||||||
# replace short links by original URL
|
# replace short links by original URL
|
||||||
m = re.search(r"http[^ \xa0]*", c)
|
m = re.search(r"http[^ \xa0]*", c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user