Revert "Revert "Replace tweet endpoint with GraphQL""

This reverts commit 36c72f9860.
This commit is contained in:
Zed
2023-02-24 01:01:22 +01:00
parent 36c72f9860
commit 670a3bca6e
7 changed files with 111 additions and 67 deletions

View File

@@ -133,10 +133,6 @@ proc getTombstone*(js: JsonNode): string =
result = js{"tombstoneInfo", "richText", "text"}.getStr
result.removeSuffix(" Learn more")
proc getSource*(js: JsonNode): string =
let src = js{"source"}.getStr
result = src.substr(src.find('>') + 1, src.rfind('<') - 1)
proc getMp4Resolution*(url: string): int =
# parses the height out of a URL like this one:
# https://video.twimg.com/ext_tw_video/<tweet-id>/pu/vid/720x1280/<random>.mp4