From 5d650d0f61a0dbd9dccedfb8c09ba6b1b1bdd052 Mon Sep 17 00:00:00 2001 From: Alexander Biryukov Date: Thu, 18 Jul 2019 12:14:51 +0300 Subject: [PATCH 1/6] JSON schema prototype --- docs/schema.json | 481 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 481 insertions(+) create mode 100644 docs/schema.json diff --git a/docs/schema.json b/docs/schema.json new file mode 100644 index 000000000..f1621d143 --- /dev/null +++ b/docs/schema.json @@ -0,0 +1,481 @@ +{ + "$schema": "http://json-schema.org/schema#", + "title": "Youtube-dl JSON output schema", + "description": "This schema is produced when youtube-dl -J is invoked", + "definitions": { + "json-output": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-json-output", + "properties": { + "id": { + "type": "string", + "$comment": "video ID" + }, + "title": { + "type": "string" + }, + "duration": { + "type": "string" + }, + "formats": { + "type": "array", + "items": { + "$ref": "#/definitions/format" + } + }, + "creator": { + "type": "string" + }, + "timestamp": { + "type": "integer" + }, + "uploader": { + "type": "string" + }, + "channel": { + "type": "string" + }, + "description": { + "type": "string" + }, + "categories": { + "type": "array", + "items": { + "type": "string" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "thumbnails": { + "type": "array", + "items": { + "$ref": "#/definitions/thumbnail" + } + }, + "thumbnail": { + "type": "string" + }, + "chapters": { + "type": "array", + "items": { + "$ref": "#/definitions/chapter" + } + }, + "subtitles": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/definitions/subtitle" + } + } + }, + "playlist": { + "type": "string" + }, + "comments": { + "type": "array", + "items": { + "$ref": "#/definitions/comment" + } + }, + "chapter": { + "type": "string" + }, + "series": { + "type": "string" + }, + "season": { + "type": "string" + }, + "episode": { + "type": "string" + }, + "track": { + "type": "string" + }, + "artist": { + "type": "string" + }, + "genre": { + "type": "string" + }, + "album": { + "type": "string" + }, + "extractor": { + "type": "string" + }, + "license": { + "type": "string" + }, + "location": { + "type": "string" + }, + "webpage_url": { + "type": "string" + }, + "release_date": { + "type": "string" + }, + "upload_date": { + "type": "string" + }, + "uploader_id": { + "type": "string" + }, + "uploader_url": { + "type": "string" + }, + "channel_id": { + "type": "string" + }, + "channel_url": { + "type": "string" + }, + "requested_subtitles": { + "type": "object", + "additionalProperties": { + "type": "array", + "$ref": "#/definitions/subtitle" + } + }, + "automatic_captions": { + "type": "object", + "additionalProperties": { + "type": "array", + "$ref": "#/definitions/subtitle" + } + }, + "playlist_index": { + "type": "string" + }, + "playlist_id": { + "type": "string" + }, + "playlist_title": { + "type": "string" + }, + "playlist_uploader": { + "type": "string" + }, + "playlist_uploader_id": { + "type": "string" + }, + "view_count": { + "type": "integer" + }, + "average_rating": { + "type": "string" + }, + "like_count": { + "type": "integer" + }, + "dislike_count": { + "type": "integer" + }, + "repost_count": { + "type": "integer" + }, + "comment_count": { + "type": "integer" + }, + "chapter_number": { + "type": "string" + }, + "chapter_id": { + "type": "string" + }, + "season_number": { + "type": "string" + }, + "season_id": { + "type": "string" + }, + "episode_number": { + "type": "string" + }, + "episode_id": { + "type": "string" + }, + "track_number": { + "type": "string" + }, + "track_id": { + "type": "string" + }, + "album_type": { + "type": "string" + }, + "album_artist": { + "type": "string" + }, + "disc_number": { + "type": "integer" + }, + "release_year": { + "type": "integer" + }, + "start_time": { + "type": "string" + }, + "end_time": { + "type": "string" + }, + "extractor_key": { + "type": "string" + }, + "display_id": { + "type": "string" + }, + "is_live": { + "type": "boolean" + }, + "age_limit": { + "type": "integer" + }, + "alt_title": { + "type": "string" + } + } + }, + "chapter": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-chapter", + "properties": { + "title": { + "type": "string" + }, + "start_time": { + "type": "string" + }, + "end_time": { + "type": "string" + } + } + }, + "comment": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-comment", + "properties": { + "author": { + "type": "string" + }, + "id": { + "type": "string" + }, + "html": { + "type": "string" + }, + "text": { + "type": "string" + }, + "timestamp": { + "type": "integer" + }, + "parent": { + "type": "string" + }, + "author_id": { + "type": "string" + } + } + }, + "protocol": { + "type": "string", + "enum": [ + "http", + "https", + "rtsp", + "rtmp", + "rtmpe", + "mms", + "f4m", + "ism", + "m3u8", + "m3u8_native", + "http_dash_segments" + ] + }, + "subtitle": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-subtitle", + "properties": { + "url": { + "type": "string" + }, + "data": { + "type": "string" + }, + "ext": { + "type": "string" + } + } + }, + "thumbnail": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-thumbnail", + "properties": { + "id": { + "type": "string" + }, + "url": { + "type": "string" + }, + "preference": { + "type": "integer" + }, + "width": { + "type": "integer" + }, + "height": { + "type": "integer" + }, + "filesize": { + "type": "integer" + } + } + }, + "fragment": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-fragment", + "properties": { + "url": { + "type": "string" + }, + "path": { + "type": "string" + }, + "duration": { + "type": "string" + }, + "filesize": { + "type": "integer" + } + } + }, + "format": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-format", + "properties": { + "url": { + "type": "string" + }, + "ext": { + "type": "string" + }, + "format": { + "type": "string" + }, + "width": { + "type": "integer" + }, + "height": { + "type": "integer" + }, + "resolution": { + "type": "string" + }, + "fps": { + "type": "integer" + }, + "container": { + "type": "string" + }, + "filesize": { + "type": "integer" + }, + "protocol": { + "$ref": "#/definitions/protocol" + }, + "fragments": { + "type": "array", + "items": { + "$ref": "#/definitions/fragment" + } + }, + "preference": { + "type": "string" + }, + "language": { + "type": "string" + }, + "quality": { + "type": "integer" + }, + "manifest_url": { + "type": "string" + }, + "format_id": { + "type": "string" + }, + "format_note": { + "type": "string" + }, + "tbr": { + "type": "integer" + }, + "abr": { + "type": "integer" + }, + "acodec": { + "type": "string" + }, + "asr": { + "type": "integer" + }, + "vbr": { + "type": "integer" + }, + "vcodec": { + "type": "string" + }, + "filesize_approx": { + "type": "string" + }, + "player_url": { + "type": "string" + }, + "fragment_base_url": { + "type": "string" + }, + "language_preference": { + "type": "integer" + }, + "source_preference": { + "type": "integer" + }, + "http_headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "stretched_ratio": { + "type": "number" + }, + "no_resume": { + "type": "boolean" + }, + "downloader_options": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "anyOf": [ + { + "$ref": "#/definitions/json-output" + }, + { + "$ref": "#/definitions/format" + } + ] +} From decae705e6b3284d73d0fe6770122eacad7d1703 Mon Sep 17 00:00:00 2001 From: Alexander Biryukov Date: Thu, 18 Jul 2019 12:50:04 +0300 Subject: [PATCH 2/6] Added nullability to schema --- docs/schema.json | 1330 +++++++++++++++++++++++++++++----------------- 1 file changed, 849 insertions(+), 481 deletions(-) diff --git a/docs/schema.json b/docs/schema.json index f1621d143..9a1f84d8d 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -1,481 +1,849 @@ -{ - "$schema": "http://json-schema.org/schema#", - "title": "Youtube-dl JSON output schema", - "description": "This schema is produced when youtube-dl -J is invoked", - "definitions": { - "json-output": { - "type": "object", - "id": "urn:jsonschema:youtube-dl-json-output", - "properties": { - "id": { - "type": "string", - "$comment": "video ID" - }, - "title": { - "type": "string" - }, - "duration": { - "type": "string" - }, - "formats": { - "type": "array", - "items": { - "$ref": "#/definitions/format" - } - }, - "creator": { - "type": "string" - }, - "timestamp": { - "type": "integer" - }, - "uploader": { - "type": "string" - }, - "channel": { - "type": "string" - }, - "description": { - "type": "string" - }, - "categories": { - "type": "array", - "items": { - "type": "string" - } - }, - "tags": { - "type": "array", - "items": { - "type": "string" - } - }, - "thumbnails": { - "type": "array", - "items": { - "$ref": "#/definitions/thumbnail" - } - }, - "thumbnail": { - "type": "string" - }, - "chapters": { - "type": "array", - "items": { - "$ref": "#/definitions/chapter" - } - }, - "subtitles": { - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "$ref": "#/definitions/subtitle" - } - } - }, - "playlist": { - "type": "string" - }, - "comments": { - "type": "array", - "items": { - "$ref": "#/definitions/comment" - } - }, - "chapter": { - "type": "string" - }, - "series": { - "type": "string" - }, - "season": { - "type": "string" - }, - "episode": { - "type": "string" - }, - "track": { - "type": "string" - }, - "artist": { - "type": "string" - }, - "genre": { - "type": "string" - }, - "album": { - "type": "string" - }, - "extractor": { - "type": "string" - }, - "license": { - "type": "string" - }, - "location": { - "type": "string" - }, - "webpage_url": { - "type": "string" - }, - "release_date": { - "type": "string" - }, - "upload_date": { - "type": "string" - }, - "uploader_id": { - "type": "string" - }, - "uploader_url": { - "type": "string" - }, - "channel_id": { - "type": "string" - }, - "channel_url": { - "type": "string" - }, - "requested_subtitles": { - "type": "object", - "additionalProperties": { - "type": "array", - "$ref": "#/definitions/subtitle" - } - }, - "automatic_captions": { - "type": "object", - "additionalProperties": { - "type": "array", - "$ref": "#/definitions/subtitle" - } - }, - "playlist_index": { - "type": "string" - }, - "playlist_id": { - "type": "string" - }, - "playlist_title": { - "type": "string" - }, - "playlist_uploader": { - "type": "string" - }, - "playlist_uploader_id": { - "type": "string" - }, - "view_count": { - "type": "integer" - }, - "average_rating": { - "type": "string" - }, - "like_count": { - "type": "integer" - }, - "dislike_count": { - "type": "integer" - }, - "repost_count": { - "type": "integer" - }, - "comment_count": { - "type": "integer" - }, - "chapter_number": { - "type": "string" - }, - "chapter_id": { - "type": "string" - }, - "season_number": { - "type": "string" - }, - "season_id": { - "type": "string" - }, - "episode_number": { - "type": "string" - }, - "episode_id": { - "type": "string" - }, - "track_number": { - "type": "string" - }, - "track_id": { - "type": "string" - }, - "album_type": { - "type": "string" - }, - "album_artist": { - "type": "string" - }, - "disc_number": { - "type": "integer" - }, - "release_year": { - "type": "integer" - }, - "start_time": { - "type": "string" - }, - "end_time": { - "type": "string" - }, - "extractor_key": { - "type": "string" - }, - "display_id": { - "type": "string" - }, - "is_live": { - "type": "boolean" - }, - "age_limit": { - "type": "integer" - }, - "alt_title": { - "type": "string" - } - } - }, - "chapter": { - "type": "object", - "id": "urn:jsonschema:youtube-dl-chapter", - "properties": { - "title": { - "type": "string" - }, - "start_time": { - "type": "string" - }, - "end_time": { - "type": "string" - } - } - }, - "comment": { - "type": "object", - "id": "urn:jsonschema:youtube-dl-comment", - "properties": { - "author": { - "type": "string" - }, - "id": { - "type": "string" - }, - "html": { - "type": "string" - }, - "text": { - "type": "string" - }, - "timestamp": { - "type": "integer" - }, - "parent": { - "type": "string" - }, - "author_id": { - "type": "string" - } - } - }, - "protocol": { - "type": "string", - "enum": [ - "http", - "https", - "rtsp", - "rtmp", - "rtmpe", - "mms", - "f4m", - "ism", - "m3u8", - "m3u8_native", - "http_dash_segments" - ] - }, - "subtitle": { - "type": "object", - "id": "urn:jsonschema:youtube-dl-subtitle", - "properties": { - "url": { - "type": "string" - }, - "data": { - "type": "string" - }, - "ext": { - "type": "string" - } - } - }, - "thumbnail": { - "type": "object", - "id": "urn:jsonschema:youtube-dl-thumbnail", - "properties": { - "id": { - "type": "string" - }, - "url": { - "type": "string" - }, - "preference": { - "type": "integer" - }, - "width": { - "type": "integer" - }, - "height": { - "type": "integer" - }, - "filesize": { - "type": "integer" - } - } - }, - "fragment": { - "type": "object", - "id": "urn:jsonschema:youtube-dl-fragment", - "properties": { - "url": { - "type": "string" - }, - "path": { - "type": "string" - }, - "duration": { - "type": "string" - }, - "filesize": { - "type": "integer" - } - } - }, - "format": { - "type": "object", - "id": "urn:jsonschema:youtube-dl-format", - "properties": { - "url": { - "type": "string" - }, - "ext": { - "type": "string" - }, - "format": { - "type": "string" - }, - "width": { - "type": "integer" - }, - "height": { - "type": "integer" - }, - "resolution": { - "type": "string" - }, - "fps": { - "type": "integer" - }, - "container": { - "type": "string" - }, - "filesize": { - "type": "integer" - }, - "protocol": { - "$ref": "#/definitions/protocol" - }, - "fragments": { - "type": "array", - "items": { - "$ref": "#/definitions/fragment" - } - }, - "preference": { - "type": "string" - }, - "language": { - "type": "string" - }, - "quality": { - "type": "integer" - }, - "manifest_url": { - "type": "string" - }, - "format_id": { - "type": "string" - }, - "format_note": { - "type": "string" - }, - "tbr": { - "type": "integer" - }, - "abr": { - "type": "integer" - }, - "acodec": { - "type": "string" - }, - "asr": { - "type": "integer" - }, - "vbr": { - "type": "integer" - }, - "vcodec": { - "type": "string" - }, - "filesize_approx": { - "type": "string" - }, - "player_url": { - "type": "string" - }, - "fragment_base_url": { - "type": "string" - }, - "language_preference": { - "type": "integer" - }, - "source_preference": { - "type": "integer" - }, - "http_headers": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "stretched_ratio": { - "type": "number" - }, - "no_resume": { - "type": "boolean" - }, - "downloader_options": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - } - }, - "anyOf": [ - { - "$ref": "#/definitions/json-output" - }, - { - "$ref": "#/definitions/format" - } - ] -} +{ + "$schema": "http://json-schema.org/schema#", + "title": "Youtube-dl JSON output schema", + "description": "This schema is produced when youtube-dl -J is invoked", + "definitions": { + "json-output": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-json-output", + "properties": { + "id": { + "type": "string", + "$comment": "video ID" + }, + "title": { + "type": "string" + }, + "duration": { + "type": [ + "string", + "number", + "null" + ] + }, + "formats": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/format" + } + }, + "creator": { + "type": [ + "string", + "null" + ] + }, + "timestamp": { + "type": [ + "integer", + "null" + ] + }, + "uploader": { + "type": [ + "string", + "null" + ] + }, + "channel": { + "type": [ + "string", + "null" + ] + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "categories": { + "type": [ + "array", + "null" + ], + "items": { + "type": [ + "string", + "null" + ] + } + }, + "tags": { + "type": [ + "array", + "null" + ], + "items": { + "type": [ + "string", + "null" + ] + } + }, + "thumbnails": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/thumbnail" + } + }, + "thumbnail": { + "type": [ + "string", + "null" + ] + }, + "chapters": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/chapter" + } + }, + "subtitles": { + "type": "object", + "additionalProperties": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/subtitle" + } + } + }, + "playlist": { + "type": [ + "string", + "null" + ] + }, + "comments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/comment" + } + }, + "chapter": { + "type": [ + "string", + "null" + ] + }, + "series": { + "type": [ + "string", + "null" + ] + }, + "season": { + "type": [ + "string", + "null" + ] + }, + "episode": { + "type": [ + "string", + "null" + ] + }, + "track": { + "type": [ + "string", + "null" + ] + }, + "artist": { + "type": [ + "string", + "null" + ] + }, + "genre": { + "type": [ + "string", + "null" + ] + }, + "album": { + "type": [ + "string", + "null" + ] + }, + "extractor": { + "type": [ + "string", + "null" + ] + }, + "license": { + "type": [ + "string", + "null" + ] + }, + "location": { + "type": [ + "string", + "null" + ] + }, + "webpage_url": { + "type": [ + "string", + "null" + ] + }, + "release_date": { + "type": [ + "string", + "null" + ] + }, + "upload_date": { + "type": [ + "string", + "null" + ] + }, + "uploader_id": { + "type": [ + "string", + "null" + ] + }, + "uploader_url": { + "type": [ + "string", + "null" + ] + }, + "channel_id": { + "type": [ + "string", + "null" + ] + }, + "channel_url": { + "type": [ + "string", + "null" + ] + }, + "requested_subtitles": { + "type": "object", + "additionalProperties": { + "type": [ + "array", + "null" + ], + "$ref": "#/definitions/subtitle" + } + }, + "automatic_captions": { + "type": "object", + "additionalProperties": { + "type": [ + "array", + "null" + ], + "$ref": "#/definitions/subtitle" + } + }, + "playlist_index": { + "type": [ + "string", + "null" + ] + }, + "playlist_id": { + "type": [ + "string", + "null" + ] + }, + "playlist_title": { + "type": [ + "string", + "null" + ] + }, + "playlist_uploader": { + "type": [ + "string", + "null" + ] + }, + "playlist_uploader_id": { + "type": [ + "string", + "null" + ] + }, + "view_count": { + "type": [ + "integer", + "null" + ] + }, + "average_rating": { + "type": [ + "string", + "number", + "null" + ] + }, + "like_count": { + "type": [ + "integer", + "null" + ] + }, + "dislike_count": { + "type": [ + "integer", + "null" + ] + }, + "repost_count": { + "type": [ + "integer", + "null" + ] + }, + "comment_count": { + "type": [ + "integer", + "null" + ] + }, + "chapter_number": { + "type": [ + "string", + "null" + ] + }, + "chapter_id": { + "type": [ + "string", + "null" + ] + }, + "season_number": { + "type": [ + "string", + "null" + ] + }, + "season_id": { + "type": [ + "string", + "null" + ] + }, + "episode_number": { + "type": [ + "string", + "null" + ] + }, + "episode_id": { + "type": [ + "string", + "null" + ] + }, + "track_number": { + "type": [ + "string", + "null" + ] + }, + "track_id": { + "type": [ + "string", + "null" + ] + }, + "album_type": { + "type": [ + "string", + "null" + ] + }, + "album_artist": { + "type": [ + "string", + "null" + ] + }, + "disc_number": { + "type": [ + "integer", + "null" + ] + }, + "release_year": { + "type": [ + "integer", + "null" + ] + }, + "start_time": { + "type": [ + "string", + "null" + ] + }, + "end_time": { + "type": [ + "string", + "null" + ] + }, + "extractor_key": { + "type": [ + "string", + "null" + ] + }, + "display_id": { + "type": [ + "string", + "null" + ] + }, + "is_live": { + "type": [ + "boolean", + "null" + ] + }, + "age_limit": { + "type": [ + "integer", + "null" + ] + }, + "alt_title": { + "type": [ + "string", + "null" + ] + } + } + }, + "chapter": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-chapter", + "properties": { + "title": { + "type": [ + "string", + "null" + ] + }, + "start_time": { + "type": [ + "string", + "null" + ] + }, + "end_time": { + "type": [ + "string", + "null" + ] + } + } + }, + "comment": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-comment", + "properties": { + "author": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ] + }, + "html": { + "type": [ + "string", + "null" + ] + }, + "text": { + "type": [ + "string", + "null" + ] + }, + "timestamp": { + "type": [ + "integer", + "null" + ] + }, + "parent": { + "type": [ + "string", + "null" + ] + }, + "author_id": { + "type": [ + "string", + "null" + ] + } + } + }, + "protocol": { + "type": [ + "string", + "null" + ], + "enum": [ + "http", + "https", + "rtsp", + "rtmp", + "rtmpe", + "mms", + "f4m", + "ism", + "m3u8", + "m3u8_native", + "http_dash_segments" + ] + }, + "subtitle": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-subtitle", + "properties": { + "url": { + "type": [ + "string", + "null" + ] + }, + "data": { + "type": [ + "string", + "null" + ] + }, + "ext": { + "type": [ + "string", + "null" + ] + } + } + }, + "thumbnail": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-thumbnail", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "url": { + "type": [ + "string", + "null" + ] + }, + "preference": { + "type": [ + "integer", + "null" + ] + }, + "width": { + "type": [ + "integer", + "null" + ] + }, + "height": { + "type": [ + "integer", + "null" + ] + }, + "filesize": { + "type": [ + "integer", + "null" + ] + } + } + }, + "fragment": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-fragment", + "properties": { + "url": { + "type": [ + "string", + "null" + ] + }, + "path": { + "type": [ + "string", + "null" + ] + }, + "duration": { + "type": [ + "string", + "null" + ] + }, + "filesize": { + "type": [ + "integer", + "null" + ] + } + } + }, + "format": { + "type": "object", + "id": "urn:jsonschema:youtube-dl-format", + "required": [ + "url" + ], + "properties": { + "url": { + "type": [ + "string", + "null" + ] + }, + "ext": { + "type": [ + "string", + "null" + ] + }, + "format": { + "type": [ + "string", + "null" + ] + }, + "width": { + "type": [ + "integer", + "null" + ] + }, + "height": { + "type": [ + "integer", + "null" + ] + }, + "resolution": { + "type": [ + "string", + "null" + ] + }, + "fps": { + "type": [ + "integer", + "null" + ] + }, + "container": { + "type": [ + "string", + "null" + ] + }, + "filesize": { + "type": [ + "integer", + "null" + ] + }, + "protocol": { + "$ref": "#/definitions/protocol" + }, + "fragments": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/fragment" + } + }, + "preference": { + "type": [ + "string", + "null" + ] + }, + "language": { + "type": [ + "string", + "null" + ] + }, + "quality": { + "type": [ + "integer", + "null" + ] + }, + "manifest_url": { + "type": [ + "string", + "null" + ] + }, + "format_id": { + "type": [ + "string", + "null" + ] + }, + "format_note": { + "type": [ + "string", + "null" + ] + }, + "tbr": { + "type": [ + "number", + "null" + ] + }, + "abr": { + "type": [ + "number", + "null" + ] + }, + "acodec": { + "type": [ + "string", + "null" + ] + }, + "asr": { + "type": [ + "number", + "null" + ] + }, + "vbr": { + "type": [ + "number", + "null" + ] + }, + "vcodec": { + "type": [ + "string", + "null" + ] + }, + "filesize_approx": { + "type": [ + "string", + "null" + ] + }, + "player_url": { + "type": [ + "string", + "null" + ] + }, + "fragment_base_url": { + "type": [ + "string", + "null" + ] + }, + "language_preference": { + "type": [ + "integer", + "null" + ] + }, + "source_preference": { + "type": [ + "integer", + "null" + ] + }, + "http_headers": { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "null" + ] + } + }, + "stretched_ratio": { + "type": "number" + }, + "no_resume": { + "type": [ + "boolean", + "null" + ] + }, + "downloader_options": { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "null" + ] + } + } + } + } + }, + "allOf": [ + { + "$ref": "#/definitions/json-output" + }, + { + "$ref": "#/definitions/format" + } + ] +} From 228852cf5367b75eb3fa7f54fe743faf1e6324db Mon Sep 17 00:00:00 2001 From: Alexander Biryukov Date: Thu, 18 Jul 2019 12:58:15 +0300 Subject: [PATCH 3/6] Nullability fixes --- docs/schema.json | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/docs/schema.json b/docs/schema.json index 9a1f84d8d..9cd08bdd6 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -244,23 +244,22 @@ ] }, "requested_subtitles": { - "type": "object", + "type": [ + "object", + "null" + ], "additionalProperties": { - "type": [ - "array", - "null" - ], + "type": "object", "$ref": "#/definitions/subtitle" } }, "automatic_captions": { "type": "object", "additionalProperties": { - "type": [ - "array", - "null" - ], - "$ref": "#/definitions/subtitle" + "type": "array", + "items": { + "$ref": "#/definitions/subtitle" + } } }, "playlist_index": { @@ -636,9 +635,6 @@ "format": { "type": "object", "id": "urn:jsonschema:youtube-dl-format", - "required": [ - "url" - ], "properties": { "url": { "type": [ @@ -818,7 +814,10 @@ } }, "stretched_ratio": { - "type": "number" + "type": [ + "number", + "null" + ] }, "no_resume": { "type": [ @@ -830,8 +829,10 @@ "type": "object", "additionalProperties": { "type": [ + "object", "string", - "null" + "number", + "boolean" ] } } From da3b8cae0df304f0b04f6759d6224bf267d10fc1 Mon Sep 17 00:00:00 2001 From: Alexander Biryukov Date: Thu, 18 Jul 2019 13:03:58 +0300 Subject: [PATCH 4/6] Added missing types --- docs/schema.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/schema.json b/docs/schema.json index 9cd08bdd6..7305b0531 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -621,6 +621,7 @@ "duration": { "type": [ "string", + "number", "null" ] }, @@ -705,6 +706,7 @@ "preference": { "type": [ "string", + "integer", "null" ] }, From bc3c190039549b40e1370f9b7f6c6d3a67b94b33 Mon Sep 17 00:00:00 2001 From: Alexander Biryukov Date: Thu, 18 Jul 2019 19:15:10 +0300 Subject: [PATCH 5/6] Added playlist schema, required fields --- docs/schema.json | 102 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 4 deletions(-) diff --git a/docs/schema.json b/docs/schema.json index 7305b0531..3d8fa1742 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -1,11 +1,104 @@ { - "$schema": "http://json-schema.org/schema#", "title": "Youtube-dl JSON output schema", "description": "This schema is produced when youtube-dl -J is invoked", "definitions": { + "single-video": { + "anyOf": [ + { + "required": [ + "formats" + ] + }, + { + "required": [ + "url" + ] + } + ], + "allOf": [ + { + "$ref": "#/definitions/json-output" + }, + { + "$ref": "#/definitions/format" + } + ] + }, + "playlist": { + "type": "object", + "properties": { + "uploader_url": { + "type": [ + "string", + "null" + ] + }, + "uploader": { + "type": [ + "string", + "null" + ] + }, + "extractor_key": { + "type": [ + "string", + "null" + ] + }, + "extractor": { + "type": [ + "string", + "null" + ] + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "uploader_id": { + "type": [ + "string", + "null" + ] + }, + "webpage_url_basename": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ] + }, + "webpage_url": { + "type": [ + "string", + "null" + ] + }, + "entries": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/single-video" + } + } + } + }, "json-output": { "type": "object", "id": "urn:jsonschema:youtube-dl-json-output", + "required": [ + "id", + "title" + ], "properties": { "id": { "type": "string", @@ -265,6 +358,7 @@ "playlist_index": { "type": [ "string", + "integer", "null" ] }, @@ -841,12 +935,12 @@ } } }, - "allOf": [ + "anyOf": [ { - "$ref": "#/definitions/json-output" + "$ref": "#/definitions/single-video" }, { - "$ref": "#/definitions/format" + "$ref": "#/definitions/playlist" } ] } From be3022cea40de12d6c7906e8db473bce1ae0f5ec Mon Sep 17 00:00:00 2001 From: Alexander Biryukov Date: Thu, 18 Jul 2019 19:19:35 +0300 Subject: [PATCH 6/6] Added required fields for playlist --- docs/schema.json | 50 +++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/docs/schema.json b/docs/schema.json index 3d8fa1742..72cfd580a 100644 --- a/docs/schema.json +++ b/docs/schema.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/schema#", "title": "Youtube-dl JSON output schema", "description": "This schema is produced when youtube-dl -J is invoked", "definitions": { @@ -26,26 +27,13 @@ }, "playlist": { "type": "object", + "required": [ + "id", + "title", + "entries" + ], "properties": { - "uploader_url": { - "type": [ - "string", - "null" - ] - }, - "uploader": { - "type": [ - "string", - "null" - ] - }, - "extractor_key": { - "type": [ - "string", - "null" - ] - }, - "extractor": { + "id": { "type": [ "string", "null" @@ -57,7 +45,7 @@ "null" ] }, - "uploader_id": { + "webpage_url": { "type": [ "string", "null" @@ -69,13 +57,31 @@ "null" ] }, - "id": { + "uploader": { "type": [ "string", "null" ] }, - "webpage_url": { + "uploader_id": { + "type": [ + "string", + "null" + ] + }, + "uploader_url": { + "type": [ + "string", + "null" + ] + }, + "extractor": { + "type": [ + "string", + "null" + ] + }, + "extractor_key": { "type": [ "string", "null"