Improve search endpoint compatibility

Fixes #63
This commit is contained in:
Zed
2019-10-08 13:45:47 +02:00
parent aa4f3f69bb
commit 1c9c6a2947
7 changed files with 15 additions and 15 deletions

View File

@@ -35,7 +35,7 @@ proc getListMembers*(username, list, agent: string): Future[Result[Profile]] {.a
minId: html.selectAttr(".stream-container", "data-min-position"),
hasMore: html.select(".has-more-items") != nil,
beginning: true,
query: Query(kind: users),
query: Query(kind: userList),
content: html.selectAll(".account").map(parseListProfile)
)
@@ -56,7 +56,7 @@ proc getListMembersSearch*(username, list, agent, after: string): Future[Result[
let json = await fetchJson(url ? params, headers)
result = getResult[Profile](json, Query(kind: users), after)
result = getResult[Profile](json, Query(kind: userList), after)
if json == nil or not json.hasKey("items_html"): return
let html = json["items_html"].to(string)

View File

@@ -16,7 +16,7 @@ proc getResult*[T](json: JsonNode; query: Query; after: string): Result[T] =
proc getSearch*[T](query: Query; after, agent: string): Future[Result[T]] {.async.} =
let
kind = if query.kind == userSearch: "users" else: "tweets"
kind = if query.kind == users: "users" else: "tweets"
pos = when T is Tweet: genPos(after) else: after
param = genQueryParam(query)