mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 14:49:32 +00:00
parent
0bc9702854
commit
11d4eb9e39
1 changed files with 5 additions and 5 deletions
10
src/api.nim
10
src/api.nim
|
|
@ -23,10 +23,10 @@ proc cursorParam(after: string): string =
|
||||||
## variables object (same input-validation class as the #1411 media SSRF).
|
## variables object (same input-validation class as the #1411 media SSRF).
|
||||||
if after.len > 0: "\"cursor\":" & $(%after) & "," else: ""
|
if after.len > 0: "\"cursor\":" & $(%after) & "," else: ""
|
||||||
|
|
||||||
proc mediaUrl(id, cursor: string; count=20): ApiReq =
|
proc mediaUrl(id, cursor: string): ApiReq =
|
||||||
result = ApiReq(
|
result = ApiReq(
|
||||||
cookie: apiUrl(graphUserMedia, userMediaVars % [id, cursor, $count]),
|
cookie: apiUrl(graphUserMedia, userMediaVars % [id, cursor, "100"]),
|
||||||
oauth: apiUrl(graphUserMediaV2, restIdVars % [id, cursor, $count])
|
oauth: apiUrl(graphUserMediaV2, restIdVars % [id, cursor, "100"])
|
||||||
)
|
)
|
||||||
|
|
||||||
proc userTweetsUrl(id: string; cursor: string): ApiReq =
|
proc userTweetsUrl(id: string; cursor: string): ApiReq =
|
||||||
|
|
@ -108,7 +108,7 @@ proc getGraphUserTweets*(id: string; kind: TimelineKind; after=""): Future[Profi
|
||||||
url = case kind
|
url = case kind
|
||||||
of TimelineKind.tweets: userTweetsUrl(id, cursor)
|
of TimelineKind.tweets: userTweetsUrl(id, cursor)
|
||||||
of TimelineKind.replies: userTweetsAndRepliesUrl(id, cursor)
|
of TimelineKind.replies: userTweetsAndRepliesUrl(id, cursor)
|
||||||
of TimelineKind.media: mediaUrl(id, cursor, 100)
|
of TimelineKind.media: mediaUrl(id, cursor)
|
||||||
js = await fetch(url)
|
js = await fetch(url)
|
||||||
result = parseGraphTimeline(js, after)
|
result = parseGraphTimeline(js, after)
|
||||||
|
|
||||||
|
|
@ -333,7 +333,7 @@ proc getGraphListSearch*(query: Query; after=""): Future[Result[ListSearchResult
|
||||||
|
|
||||||
proc getPhotoRail*(id: string): Future[PhotoRail] {.async.} =
|
proc getPhotoRail*(id: string): Future[PhotoRail] {.async.} =
|
||||||
if id.len == 0: return
|
if id.len == 0: return
|
||||||
let js = await fetch(mediaUrl(id, "", 30))
|
let js = await fetch(mediaUrl(id, ""))
|
||||||
result = parseGraphPhotoRail(js)
|
result = parseGraphPhotoRail(js)
|
||||||
|
|
||||||
proc getGraphArticle*(id: string): Future[Article] {.async.} =
|
proc getGraphArticle*(id: string): Future[Article] {.async.} =
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue