mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-12 02:56:29 +00:00
Include username in status requests
This commit is contained in:
parent
a801b01142
commit
a43950dcf5
2 changed files with 4 additions and 5 deletions
|
@ -14,10 +14,9 @@ const
|
|||
timelineParams = "?include_available_features=1&include_entities=1&include_new_items_bar=false&reset_error_state=false"
|
||||
showUrl = "i/profiles/show/$1" & timelineParams
|
||||
timelineUrl = showUrl % "$1/timeline/tweets"
|
||||
timelineMediaUrl = showUrl % "$1/media_timeline"
|
||||
profilePopupUrl = "i/profiles/popup"
|
||||
profileIntentUrl = "intent/user"
|
||||
tweetUrl = "i/status/"
|
||||
tweetUrl = "status"
|
||||
videoUrl = "videos/tweet/config/$1.json"
|
||||
tokenUrl = "guest/activate.json"
|
||||
|
||||
|
@ -198,7 +197,7 @@ proc getTimeline*(username: string; after=""): Future[Timeline] {.async.} =
|
|||
result.tweets = parseTweets(html)
|
||||
await getVideos(result.tweets)
|
||||
|
||||
proc getTweet*(id: string): Future[Conversation] {.async.} =
|
||||
proc getTweet*(username: string; id: string): Future[Conversation] {.async.} =
|
||||
let headers = newHttpHeaders({
|
||||
"Accept": "application/json, text/javascript, */*; q=0.01",
|
||||
"Referer": $base,
|
||||
|
@ -211,7 +210,7 @@ proc getTweet*(id: string): Future[Conversation] {.async.} =
|
|||
})
|
||||
|
||||
let
|
||||
url = base / tweetUrl / id
|
||||
url = base / username / tweetUrl / id
|
||||
html = await fetchHtml(url, headers)
|
||||
|
||||
if html.isNil:
|
||||
|
|
|
@ -43,7 +43,7 @@ routes:
|
|||
get "/@name/status/@id":
|
||||
cond '.' notin @"name"
|
||||
|
||||
let conversation = await getTweet(@"id")
|
||||
let conversation = await getTweet(@"name", @"id")
|
||||
if conversation.isNil or conversation.tweet.id.len == 0:
|
||||
resp Http404, showError("Tweet not found")
|
||||
|
||||
|
|
Loading…
Reference in a new issue