mirror of
https://github.com/zedeus/nitter
synced 2024-11-25 19:19:17 +01:00
parent
1a08d009d8
commit
3c45630062
@ -34,6 +34,7 @@ tokenCount = 10
|
|||||||
theme = "Nitter"
|
theme = "Nitter"
|
||||||
replaceTwitter = "nitter.net"
|
replaceTwitter = "nitter.net"
|
||||||
replaceYouTube = "piped.kavin.rocks"
|
replaceYouTube = "piped.kavin.rocks"
|
||||||
|
replaceReddit = "teddit.net"
|
||||||
replaceInstagram = ""
|
replaceInstagram = ""
|
||||||
proxyVideos = true
|
proxyVideos = true
|
||||||
hlsPlayback = false
|
hlsPlayback = false
|
||||||
|
@ -4,8 +4,16 @@ import types, utils, query
|
|||||||
|
|
||||||
const
|
const
|
||||||
ytRegex = re"([A-z.]+\.)?youtu(be\.com|\.be)"
|
ytRegex = re"([A-z.]+\.)?youtu(be\.com|\.be)"
|
||||||
twRegex = re"(?<![^\/> ])(?<![^\/]\/)(www\.|mobile\.)?twitter\.com"
|
|
||||||
igRegex = re"(www\.)?instagram\.com"
|
igRegex = re"(www\.)?instagram\.com"
|
||||||
|
|
||||||
|
rdRegex = re"(?<![.b])((www|np|new|amp|old)\.)?reddit.com"
|
||||||
|
rdShortRegex = re"(?<![.b])redd\.it\/"
|
||||||
|
# Videos cannot be supported uniformly between Teddit and Libreddit,
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
twRegex = re"(?<![^\/> ])(?<![^\/]\/)(www\.|mobile\.)?twitter\.com"
|
||||||
cards = "cards.twitter.com/cards"
|
cards = "cards.twitter.com/cards"
|
||||||
tco = "https://t.co"
|
tco = "https://t.co"
|
||||||
|
|
||||||
@ -53,6 +61,12 @@ proc replaceUrl*(url: string; prefs: Prefs; absolute=""): string =
|
|||||||
result = result.replace(cards, prefs.replaceTwitter & "/cards")
|
result = result.replace(cards, prefs.replaceTwitter & "/cards")
|
||||||
result = result.replace(twRegex, prefs.replaceTwitter)
|
result = result.replace(twRegex, prefs.replaceTwitter)
|
||||||
|
|
||||||
|
if prefs.replaceReddit.len > 0 and (rdRegex in result or "redd.it" in result):
|
||||||
|
result = result.replace(rdShortRegex, prefs.replaceReddit & "/comments/")
|
||||||
|
result = result.replace(rdRegex, prefs.replaceReddit)
|
||||||
|
if prefs.replaceReddit in result and "/gallery/" in result:
|
||||||
|
result = result.replace("/gallery/", "/comments/")
|
||||||
|
|
||||||
if prefs.replaceInstagram.len > 0 and igRegex in result:
|
if prefs.replaceInstagram.len > 0 and igRegex in result:
|
||||||
result = result.replace(igRegex, prefs.replaceInstagram)
|
result = result.replace(igRegex, prefs.replaceInstagram)
|
||||||
|
|
||||||
|
@ -58,6 +58,10 @@ genPrefs:
|
|||||||
"Replace YouTube links with Piped/Invidious (blank to disable)"
|
"Replace YouTube links with Piped/Invidious (blank to disable)"
|
||||||
placeholder: "Piped hostname"
|
placeholder: "Piped hostname"
|
||||||
|
|
||||||
|
replaceReddit(input, "teddit.net"):
|
||||||
|
"Replace Reddit links with Teddit/Libreddit (blank to disable)"
|
||||||
|
placeholder: "Teddit hostname"
|
||||||
|
|
||||||
replaceInstagram(input, ""):
|
replaceInstagram(input, ""):
|
||||||
"Replace Instagram links with Bibliogram (blank to disable)"
|
"Replace Instagram links with Bibliogram (blank to disable)"
|
||||||
placeholder: "Bibliogram hostname"
|
placeholder: "Bibliogram hostname"
|
||||||
|
@ -42,7 +42,7 @@ link = [
|
|||||||
['nim_lang/status/1110499584852353024', [
|
['nim_lang/status/1110499584852353024', [
|
||||||
'nim-lang.org/araq/ownedrefs.…',
|
'nim-lang.org/araq/ownedrefs.…',
|
||||||
'news.ycombinator.com/item?id…',
|
'news.ycombinator.com/item?id…',
|
||||||
'old.reddit.com/r/programming…'
|
'teddit.net/r/programming…'
|
||||||
]],
|
]],
|
||||||
['nim_lang/status/1125887775151140864', [
|
['nim_lang/status/1125887775151140864', [
|
||||||
'en.wikipedia.org/wiki/Nim_(p…'
|
'en.wikipedia.org/wiki/Nim_(p…'
|
||||||
|
Loading…
Reference in New Issue
Block a user