mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-13 03:26:30 +00:00
add new card kind, and do not raise error for unknown card kind (#467)
This commit is contained in:
parent
5caf77481f
commit
68136de07b
2 changed files with 4 additions and 2 deletions
|
@ -169,7 +169,7 @@ proc parseCard(js: JsonNode; urls: JsonNode): Card =
|
||||||
let
|
let
|
||||||
vals = ? js{"binding_values"}
|
vals = ? js{"binding_values"}
|
||||||
name = js{"name"}.getStr
|
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(
|
result = Card(
|
||||||
kind: kind,
|
kind: kind,
|
||||||
|
@ -195,7 +195,7 @@ proc parseCard(js: JsonNode; urls: JsonNode): Card =
|
||||||
result.url = vals{"player_url"}.getStrVal
|
result.url = vals{"player_url"}.getStrVal
|
||||||
if "youtube.com" in result.url:
|
if "youtube.com" in result.url:
|
||||||
result.url = result.url.replace("/embed/", "/watch?v=")
|
result.url = result.url.replace("/embed/", "/watch?v=")
|
||||||
of unified:
|
of unified, unknown:
|
||||||
result.title = "This card type is not supported."
|
result.title = "This card type is not supported."
|
||||||
else: discard
|
else: discard
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,8 @@ type
|
||||||
videoDirectMessage = "video_direct_message"
|
videoDirectMessage = "video_direct_message"
|
||||||
imageDirectMessage = "image_direct_message"
|
imageDirectMessage = "image_direct_message"
|
||||||
audiospace = "audiospace"
|
audiospace = "audiospace"
|
||||||
|
newsletter_publication = "newsletter_publication"
|
||||||
|
unknown
|
||||||
|
|
||||||
Card* = object
|
Card* = object
|
||||||
kind*: CardKind
|
kind*: CardKind
|
||||||
|
|
Loading…
Reference in a new issue