mirror of
https://github.com/zedeus/nitter.git
synced 2024-05-08 20:32:44 +00:00
Compare commits
11 commits
632ebc4a83
...
de2dea20c8
Author | SHA1 | Date | |
---|---|---|---|
de2dea20c8 | |||
c6edec0490 | |||
ffcbec77b5 | |||
e6ff628103 | |||
dbbfa39c9d | |||
4a6b998640 | |||
a5c6fe0ed3 | |||
8a741f4d5f | |||
8670a71c30 | |||
1a804dc6e2 | |||
cc931d02bb |
|
@ -202,7 +202,7 @@ proc initAccountPool*(cfg: Config; path: string) =
|
|||
quit 1
|
||||
|
||||
let accountsPrePurge = accountPool.len
|
||||
accountPool.keepItIf(not it.hasExpired)
|
||||
#accountPool.keepItIf(not it.hasExpired)
|
||||
|
||||
log "Successfully added ", accountPool.len, " valid accounts."
|
||||
if accountsPrePurge > accountPool.len:
|
||||
|
|
|
@ -20,6 +20,10 @@ let
|
|||
# so v.redd.it links will not be replaced.
|
||||
# Images aren't supported due to errors from Teddit when the image
|
||||
# wasn't first displayed via a post on the Teddit instance.
|
||||
|
||||
imgurRegex = re"((i|i.stack)\.)?imgur\.(com|io)"
|
||||
|
||||
mediumRegex = re"([a-zA-Z0-9_.-]+\.)?medium\.com"
|
||||
|
||||
wwwRegex = re"https?://(www[0-9]?\.)?"
|
||||
m3u8Regex = re"""url="(.+.m3u8)""""
|
||||
|
@ -68,6 +72,12 @@ proc replaceUrls*(body: string; prefs: Prefs; absolute=""): string =
|
|||
result = result.replace(rdRegex, prefs.replaceReddit)
|
||||
if prefs.replaceReddit in result and "/gallery/" in result:
|
||||
result = result.replace("/gallery/", "/comments/")
|
||||
|
||||
if prefs.replaceImgur.len > 0 and "imgur" in result:
|
||||
result = result.replace(imgurRegex, prefs.replaceImgur)
|
||||
|
||||
if prefs.replaceMedium.len > 0 and "medium.com" in result:
|
||||
result = result.replace(mediumRegex, prefs.replaceMedium)
|
||||
|
||||
if absolute.len > 0 and "href" in result:
|
||||
result = result.replace("href=\"/", &"href=\"{absolute}/")
|
||||
|
|
|
@ -106,6 +106,14 @@ genPrefs:
|
|||
replaceReddit(input, ""):
|
||||
"Reddit -> Teddit/Libreddit"
|
||||
placeholder: "Teddit hostname"
|
||||
|
||||
replaceImgur(input, ""):
|
||||
"Imgur -> Rimgo"
|
||||
placeholder: "Rimgo hostname"
|
||||
|
||||
replaceMedium(input, ""):
|
||||
"Medium -> Scribe"
|
||||
placeholder: "Scribe hostname"
|
||||
|
||||
iterator allPrefs*(): Pref =
|
||||
for k, v in prefList:
|
||||
|
|
Loading…
Reference in a new issue