mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-23 08:25:37 +00:00
parent
bb83b6b6d3
commit
c412b3d791
|
@ -51,9 +51,10 @@ proc getGuestToken(agent: string; force=false): Future[string] {.async.} =
|
||||||
tokenUpdated = getTime()
|
tokenUpdated = getTime()
|
||||||
tokenUses = 0
|
tokenUses = 0
|
||||||
|
|
||||||
let
|
let headers = genHeaders({"authorization": auth}, agent, base, lang=false)
|
||||||
headers = genHeaders({"authorization": auth}, agent, base, lang=false)
|
newClient()
|
||||||
json = await fetchJson(apiBase / tokenUrl, headers)
|
|
||||||
|
let json = parseJson(await client.postContent($(apiBase / tokenUrl)))
|
||||||
|
|
||||||
if json != nil:
|
if json != nil:
|
||||||
result = json["guest_token"].to(string)
|
result = json["guest_token"].to(string)
|
||||||
|
|
|
@ -110,6 +110,7 @@ proc cleanPos*(pos: string): string =
|
||||||
pos.multiReplace((posPrefix, ""), (posSuffix, ""))
|
pos.multiReplace((posPrefix, ""), (posSuffix, ""))
|
||||||
|
|
||||||
proc genPos*(pos: string): string =
|
proc genPos*(pos: string): string =
|
||||||
|
if pos.len == 0: return
|
||||||
result = posPrefix & pos
|
result = posPrefix & pos
|
||||||
if "A==" notin result:
|
if "A==" notin result:
|
||||||
result &= posSuffix
|
result &= posSuffix
|
||||||
|
|
Loading…
Reference in a new issue