mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-17 05:26:28 +00:00
Fix more wrong mimetypes
This commit is contained in:
parent
030d649300
commit
4104bfcba9
1 changed files with 2 additions and 1 deletions
|
@ -10,6 +10,7 @@ const
|
||||||
"pbs.twimg.com",
|
"pbs.twimg.com",
|
||||||
"video.twimg.com"
|
"video.twimg.com"
|
||||||
]
|
]
|
||||||
|
badExts = @["1500x500", "jpgn", "jpg:", "jpg_"]
|
||||||
|
|
||||||
proc getHmac*(data: string): string =
|
proc getHmac*(data: string): string =
|
||||||
($hmac(sha256, key, data))[0 .. 12]
|
($hmac(sha256, key, data))[0 .. 12]
|
||||||
|
@ -29,7 +30,7 @@ proc getPicUrl*(link: string): string =
|
||||||
proc cleanFilename*(filename: string): string =
|
proc cleanFilename*(filename: string): string =
|
||||||
const reg = re"[^A-Za-z0-9._-]"
|
const reg = re"[^A-Za-z0-9._-]"
|
||||||
result = filename.replace(reg, "_")
|
result = filename.replace(reg, "_")
|
||||||
if "1500x500" in result or "name_orig" in result:
|
if badExts.anyIt(it in result):
|
||||||
result &= ".jpg"
|
result &= ".jpg"
|
||||||
|
|
||||||
proc filterParams*(params: Table): seq[(string, string)] =
|
proc filterParams*(params: Table): seq[(string, string)] =
|
||||||
|
|
Loading…
Reference in a new issue