mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-17 05:26:28 +00:00
Fix card links
This commit is contained in:
parent
8c50692299
commit
9b4b70e2e4
1 changed files with 3 additions and 3 deletions
|
@ -9,7 +9,7 @@ from unicode import Rune, `$`
|
||||||
const
|
const
|
||||||
ytRegex = re"([A-z.]+\.)?youtu(be\.com|\.be)"
|
ytRegex = re"([A-z.]+\.)?youtu(be\.com|\.be)"
|
||||||
twRegex = re"(www\.|mobile\.)?twitter\.com"
|
twRegex = re"(www\.|mobile\.)?twitter\.com"
|
||||||
cards = "https://cards.twitter.com/cards"
|
cards = "cards.twitter.com/cards"
|
||||||
tco = "https://t.co"
|
tco = "https://t.co"
|
||||||
nbsp = $Rune(0x000A0)
|
nbsp = $Rune(0x000A0)
|
||||||
|
|
||||||
|
@ -40,9 +40,9 @@ proc replaceUrl*(url: string; prefs: Prefs; absolute=""): string =
|
||||||
if prefs.replaceYouTube.len > 0:
|
if prefs.replaceYouTube.len > 0:
|
||||||
result = result.replace(ytRegex, prefs.replaceYouTube)
|
result = result.replace(ytRegex, prefs.replaceYouTube)
|
||||||
if prefs.replaceTwitter.len > 0:
|
if prefs.replaceTwitter.len > 0:
|
||||||
result = result.replace(twRegex, prefs.replaceTwitter)
|
|
||||||
result = result.replace(tco, "https://" & prefs.replaceTwitter & "/t.co")
|
result = result.replace(tco, "https://" & prefs.replaceTwitter & "/t.co")
|
||||||
result = result.replace(cards, "https://" & prefs.replaceTwitter & "/cards")
|
result = result.replace(cards, prefs.replaceTwitter & "/cards")
|
||||||
|
result = result.replace(twRegex, prefs.replaceTwitter)
|
||||||
if absolute.len > 0:
|
if absolute.len > 0:
|
||||||
result = result.replace("href=\"/", "href=\"https://" & absolute & "/")
|
result = result.replace("href=\"/", "href=\"https://" & absolute & "/")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue