Support imgur.com/gallery links
This commit is contained in:
parent
2b399d4bd5
commit
713b2250bc
|
@ -359,9 +359,9 @@ async def main():
|
||||||
splitted = os.path.splitext(parsed[2])
|
splitted = os.path.splitext(parsed[2])
|
||||||
domain = getattr(random_post, 'domain', parsed[1])
|
domain = getattr(random_post, 'domain', parsed[1])
|
||||||
preview = getattr(random_post, 'preview', None)
|
preview = getattr(random_post, 'preview', None)
|
||||||
if domain.endswith('imgur.com'):
|
if domain == 'imgur.com' or domain.endswith('.imgur.com'):
|
||||||
parsed[1] = 'i.imgur.com'
|
parsed[1] = 'i.imgur.com'
|
||||||
if parsed[2].startswith('/a/'):
|
if parsed[2].startswith('/a/') or parsed[2].startswith('/gallery/'):
|
||||||
albumid = os.path.split(parsed[2].rstrip('/'))[1]
|
albumid = os.path.split(parsed[2].rstrip('/'))[1]
|
||||||
async with session.get(f'https://imgur.com/ajaxalbums/getimages/{albumid}/hit.json?all=true') as resp:
|
async with session.get(f'https://imgur.com/ajaxalbums/getimages/{albumid}/hit.json?all=true') as resp:
|
||||||
apidata = (await resp.json())['data']
|
apidata = (await resp.json())['data']
|
||||||
|
|
Loading…
Reference in New Issue