mirror of
https://github.com/zedeus/nitter
synced 2024-11-22 09:57:16 +01:00
add new card kind, and do not raise error for unknown card kind (#467)
This commit is contained in:
parent
5caf77481f
commit
68136de07b
@ -169,7 +169,7 @@ proc parseCard(js: JsonNode; urls: JsonNode): Card =
|
||||
let
|
||||
vals = ? js{"binding_values"}
|
||||
name = js{"name"}.getStr
|
||||
kind = parseEnum[CardKind](name[(name.find(":") + 1) ..< name.len])
|
||||
kind = parseEnum[CardKind](name[(name.find(":") + 1) ..< name.len], unknown)
|
||||
|
||||
result = Card(
|
||||
kind: kind,
|
||||
@ -195,7 +195,7 @@ proc parseCard(js: JsonNode; urls: JsonNode): Card =
|
||||
result.url = vals{"player_url"}.getStrVal
|
||||
if "youtube.com" in result.url:
|
||||
result.url = result.url.replace("/embed/", "/watch?v=")
|
||||
of unified:
|
||||
of unified, unknown:
|
||||
result.title = "This card type is not supported."
|
||||
else: discard
|
||||
|
||||
|
@ -126,6 +126,8 @@ type
|
||||
videoDirectMessage = "video_direct_message"
|
||||
imageDirectMessage = "image_direct_message"
|
||||
audiospace = "audiospace"
|
||||
newsletter_publication = "newsletter_publication"
|
||||
unknown
|
||||
|
||||
Card* = object
|
||||
kind*: CardKind
|
||||
|
Loading…
Reference in New Issue
Block a user