From 92e91799ac6adbce9bca963f1d489e41512970d4 Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 1 Jul 2019 21:06:46 -0500 Subject: [PATCH] added superscript source text --- app/routes.py | 9 ++++++--- app/templates/hidden.html | 6 +++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/routes.py b/app/routes.py index 9a276ce..05c1efc 100644 --- a/app/routes.py +++ b/app/routes.py @@ -136,11 +136,12 @@ def hidden(id): def base64ify(url): return base64.b64encode(requests.get(url).content).decode() -gelbooru_url = "https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags={}&pid={}&limit={}" +gelbooru_api_url = "https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags={}&pid={}&limit={}" +gelbooru_view_url = "https://gelbooru.com/index.php?page=post&s=view&id={}" def trap(tags, page, count, base64, showfull): # URL Building & Request - temp = gelbooru_url.format(tags, page, count) + temp = gelbooru_api_url.format(tags, page, count) response = requests.get(temp).text # XML Parsing & Data Building parse = xmltodict.parse(response) @@ -156,7 +157,9 @@ def trap(tags, page, count, base64, showfull): 'index' : str(index + 1), 'real_url' : element['@file_url'], 'sample_url' : element['@preview_url'], - 'tags' : list(filter(lambda x : x != '', [tag.strip() for tag in element['@tags'].split(' ')])) + # strips tags, ensures no empty tags (may be unnescary) + 'tags' : list(filter(lambda tag : tag != '', [tag.strip() for tag in element['@tags'].split(' ')])), + 'view' : gelbooru_view_url.format(element['@id']) } if base64: if not showfull: diff --git a/app/templates/hidden.html b/app/templates/hidden.html index 405655b..1ddfab8 100644 --- a/app/templates/hidden.html +++ b/app/templates/hidden.html @@ -7,6 +7,10 @@ font-size: 0.95rem; } + .sup { + font-size: 60%; + } + .pad-tag { margin: 0.10rem; } @@ -89,7 +93,7 @@
- Image #{{ image.index }} + Image #{{ image.index }} source