mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-23 03:15:40 +00:00
Include 'www.' in twitter/youtube link replacement
This commit is contained in:
parent
9fc512d88d
commit
6c365b8fba
|
@ -11,8 +11,8 @@ const
|
||||||
usernameRegex = re"(^|[^A-z0-9_?])@([A-z0-9_]+)"
|
usernameRegex = re"(^|[^A-z0-9_?])@([A-z0-9_]+)"
|
||||||
picRegex = re"pic.twitter.com/[^ ]+"
|
picRegex = re"pic.twitter.com/[^ ]+"
|
||||||
ellipsisRegex = re" ?…"
|
ellipsisRegex = re" ?…"
|
||||||
ytRegex = re"youtu(be.com|.be)"
|
ytRegex = re"(www.)?youtu(be.com|.be)"
|
||||||
twRegex = re"twitter.com"
|
twRegex = re"(www.)?twitter.com"
|
||||||
nbsp = $Rune(0x000A0)
|
nbsp = $Rune(0x000A0)
|
||||||
|
|
||||||
proc stripText*(text: string): string =
|
proc stripText*(text: string): string =
|
||||||
|
@ -65,9 +65,9 @@ proc linkifyText*(text: string; prefs: Prefs): string =
|
||||||
proc replaceUrl*(url: string; prefs: Prefs): string =
|
proc replaceUrl*(url: string; prefs: Prefs): string =
|
||||||
result = url
|
result = url
|
||||||
if prefs.replaceYouTube.len > 0:
|
if prefs.replaceYouTube.len > 0:
|
||||||
result = url.replace(ytRegex, prefs.replaceYouTube)
|
result = result.replace(ytRegex, prefs.replaceYouTube)
|
||||||
if prefs.replaceTwitter.len > 0:
|
if prefs.replaceTwitter.len > 0:
|
||||||
result = url.replace(twRegex, prefs.replaceTwitter)
|
result = result.replace(twRegex, prefs.replaceTwitter)
|
||||||
|
|
||||||
proc stripTwitterUrls*(text: string): string =
|
proc stripTwitterUrls*(text: string): string =
|
||||||
result = text
|
result = text
|
||||||
|
|
Loading…
Reference in a new issue