Use the correct format string for fetching files from twitter.

Per their docs https://developer.twitter.com/en/docs/twitter-api/v1/data-dictionary/object-model/entities#photo_format
This commit is contained in:
decoy-walrus 2022-02-08 14:50:56 -05:00
parent 4cdb8f78cb
commit 644fe41a08
2 changed files with 3 additions and 3 deletions

View file

@ -94,7 +94,7 @@ proc createMediaRouter*(cfg: Config) =
url.insert(twimg)
if not url.startsWith(https):
url.insert(https)
url.add(":orig")
url.add("?name=orig")
let uri = parseUri(url)
cond isTwitterUrl(uri) == true

View file

@ -10,7 +10,7 @@ import general
proc getSmallPic(url: string): string =
result = url
if "?" notin url and not url.endsWith("placeholder.png"):
result &= ":small"
result &= "?name=small"
result = getPicUrl(result)
proc renderMiniAvatar(user: User; prefs: Prefs): VNode =
@ -58,7 +58,7 @@ proc renderAlbum(tweet: Tweet): VNode =
let
named = "name=" in photo
orig = photo
small = if named: photo else: photo & ":small"
small = if named: photo else: photo & "?name=small"
a(href=getOrigPicUrl(orig), class="still-image", target="_blank"):
genImg(small)