mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-12 11:06:30 +00:00
Partial fix for wrong multi-user twitter link
This commit is contained in:
parent
33f0ab0ba5
commit
2127af71b4
1 changed files with 10 additions and 4 deletions
|
@ -15,6 +15,8 @@ const
|
||||||
userpicRegex = re"_(normal|bigger|mini|200x200|400x400)(\.[A-z]+)$"
|
userpicRegex = re"_(normal|bigger|mini|200x200|400x400)(\.[A-z]+)$"
|
||||||
extRegex = re"(\.[A-z]+)$"
|
extRegex = re"(\.[A-z]+)$"
|
||||||
|
|
||||||
|
twitter = parseUri("https://twitter.com")
|
||||||
|
|
||||||
proc stripHtml*(text: string): string =
|
proc stripHtml*(text: string): string =
|
||||||
var html = parseHtml(text)
|
var html = parseHtml(text)
|
||||||
for el in html.findAll("a"):
|
for el in html.findAll("a"):
|
||||||
|
@ -121,12 +123,16 @@ proc getLink*(tweet: Tweet; focus=true): string =
|
||||||
if focus: result &= "#m"
|
if focus: result &= "#m"
|
||||||
|
|
||||||
proc getTwitterLink*(path: string; params: Table[string, string]): string =
|
proc getTwitterLink*(path: string; params: Table[string, string]): string =
|
||||||
let
|
var
|
||||||
twitter = parseUri("https://twitter.com")
|
|
||||||
username = params.getOrDefault("name")
|
username = params.getOrDefault("name")
|
||||||
query = initQuery(params, username)
|
query = initQuery(params, username)
|
||||||
|
path = path
|
||||||
|
|
||||||
if "/search" notin path:
|
if "," in username:
|
||||||
|
query.fromUser = username.split(",")
|
||||||
|
path = "/search"
|
||||||
|
|
||||||
|
if "/search" notin path and query.fromUser.len < 2:
|
||||||
return $(twitter / path ? filterParams(params))
|
return $(twitter / path ? filterParams(params))
|
||||||
|
|
||||||
let p = {
|
let p = {
|
||||||
|
@ -135,7 +141,7 @@ proc getTwitterLink*(path: string; params: Table[string, string]): string =
|
||||||
"src": "typed_query"
|
"src": "typed_query"
|
||||||
}
|
}
|
||||||
|
|
||||||
result = $(parseUri("https://twitter.com") / path ? p)
|
result = $(twitter / path ? p)
|
||||||
if username.len > 0:
|
if username.len > 0:
|
||||||
result = result.replace("/" & username, "")
|
result = result.replace("/" & username, "")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue