LapisMirror
LapisMirror copied to clipboard
Cannot mirror multiple images in Twitter posts
I've got it: you have to iterate through status.extended_entities['media']
in twitter.py
to get each media url, get the large size by the url + ":large" added to the end, and then return those urls.
Imgur does support and work with http://image.jpg:large
.
According to the logs:
Imported data from submission "https://twitter.com/arberlezi/status/674116679450951680" DEBUG - Import info: [{'importer_display': {'header': 'Mirrored Twitter image from GumballFallsFan (@ArberLezi):\n\n'}, 'import_urls': ['http://pbs.twimg.com/media/CVrxiFgU4AAXrII.jpg:large', 'http://pbs.twimg.com/media/CVrxiFuUsAEFyj9.jpg:large'], 'author': 'the Twitter user GumballFallsFan (@ArberLezi)', 'source': 'https://twitter.com/arberlezi/status/674116679450951680'}] DEBUG - Calling export_submission() on plugins DEBUG - An album will be uploaded. DEBUG - Uploading URL "http://pbs.twimg.com/media/CVrxiFgU4AAXrII.jpg:large" to imgur DEBUG - Uploaded image: {'bandwidth': 0, 'vote': None, 'height': 288, 'section': None, 'animated': False, 'width': 645, 'datetime': 1485635891, 'id': 'CdiyV0I', 'nsfw': None, 'favorite': False, 'link': 'http://i.imgur.com/CdiyV0I.jpg', 'is_ad': False, 'deletehash': 'VlssIqdBlxZLYnw', 'size': 35568, 'type': 'image/jpeg', 'account_id': 0, 'views': 0, 'name': '', 'account_url': None, 'description': None, 'title': None, 'in_gallery': False} DEBUG - Uploading URL "http://pbs.twimg.com/media/CVrxiFuUsAEFyj9.jpg:large" to imgur DEBUG - Uploaded image: {'bandwidth': 0, 'vote': None, 'height': 640, 'section': None, 'animated': False, 'width': 960, 'datetime': 1485635893, 'id': 'HFSVrWX', 'nsfw': None, 'favorite': False, 'link': 'http://i.imgur.com/HFSVrWX.jpg', 'is_ad': False, 'deletehash': 'op4NmGQBTJAveuL', 'size': 62034, 'type': 'image/jpeg', 'account_id': 0, 'views': 0, 'name': '', 'account_url': None, 'description': None, 'title': None, 'in_gallery': False} INFO - Successfully imported data from ImgurPlugin.export_submission() INFO - Replied comment to https://www.reddit.com/r/heyitsshugatest/comments/5qpqsn/testing_to_see_if_large_images_are_mirrored_by/
The fix imports large images by default. So no need to concatanate/replace an extension for the URLs.
This issue can be closed as soon as it's merged.