mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 22:59:31 +00:00
parent
ecc8bc5a95
commit
e1b3e9db76
8 changed files with 70 additions and 69 deletions
|
|
@ -18,6 +18,10 @@ const
|
|||
|
||||
twitter = parseUri("https://twitter.com")
|
||||
|
||||
proc getUrlPrefix*(cfg: Config): string =
|
||||
if cfg.useHttps: "https://" & cfg.hostname
|
||||
else: "http://" & cfg.hostname
|
||||
|
||||
proc stripHtml*(text: string): string =
|
||||
var html = parseHtml(text)
|
||||
for el in html.findAll("a"):
|
||||
|
|
@ -48,7 +52,7 @@ proc replaceUrl*(url: string; prefs: Prefs; absolute=""): string =
|
|||
result = result.replace(cards, prefs.replaceTwitter & "/cards")
|
||||
result = result.replace(twRegex, prefs.replaceTwitter)
|
||||
if absolute.len > 0:
|
||||
result = result.replace("href=\"/", "href=\"https://" & absolute & "/")
|
||||
result = result.replace("href=\"/", "href=\"" & absolute & "/")
|
||||
|
||||
proc getM3u8Url*(content: string): string =
|
||||
var m: RegexMatch
|
||||
|
|
@ -69,7 +73,7 @@ proc getUserpic*(profile: Profile; style=""): string =
|
|||
getUserPic(profile.userpic, style)
|
||||
|
||||
proc getVideoEmbed*(cfg: Config; id: int64): string =
|
||||
&"https://{cfg.hostname}/i/videos/{id}"
|
||||
&"{getUrlPrefix(cfg)}/i/videos/{id}"
|
||||
|
||||
proc pageTitle*(profile: Profile): string =
|
||||
&"{profile.fullname} (@{profile.username})"
|
||||
|
|
|
|||
Loading…
Reference in a new issue