From a43950dcf5065ea578adcd939591bfa691ea11e9 Mon Sep 17 00:00:00 2001 From: Zed Date: Thu, 27 Jun 2019 20:13:46 +0200 Subject: [PATCH] Include username in status requests --- src/api.nim | 7 +++---- src/nitter.nim | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/api.nim b/src/api.nim index 60755dc..208484b 100644 --- a/src/api.nim +++ b/src/api.nim @@ -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: diff --git a/src/nitter.nim b/src/nitter.nim index f40f8c3..ced2114 100644 --- a/src/nitter.nim +++ b/src/nitter.nim @@ -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")