Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Để xác thực các thực thể khi bạn tạo hoặc cập nhật nguồn cấp dữ liệu, hãy sử dụng các Giản đồ JSON sau. Các giản đồ này dựa trên thông số kỹ thuật của Giản đồ JSON.
Bằng cách thêm một bài kiểm thử đơn vị để xác thực các thực thể mà bạn tạo, bạn có thể phát hiện các vấn đề sẽ ảnh hưởng đến chất lượng nguồn cấp dữ liệu. Bạn cũng có thể sử dụng các giản đồ này trong quá trình phát triển nguồn cấp dữ liệu để tránh các lỗi thường gặp.
Giản đồ truyền hình trực tiếp xác thực các thực thể BroadcastEvent, BroadcastService, CableOrSatelliteService, Movie, Organization, SportsEvent, TelevisionChannel, TVEpisode, TVSeason và TVSeries.
Music Schema xác thực các thực thể MusicAlbum, MusicGroup, MusicPlaylist và MusicRecording.
Radio Schema xác thực các thực thể RadioBroadcastService.
Hãy sử dụng thông số kỹ thuật trên trang web này làm nguồn đáng tin cậy, vì các giản đồ này có thể chưa triển khai hết tất cả các tính năng.
Các giản đồ được cung cấp được viết bằng bản nháp 7, vì vậy, phương thức triển khai mà bạn chọn cần hỗ trợ phiên bản này để hoạt động đúng cách.
Ví dụ về quy trình xác thực
Ví dụ sau đây cho biết cách xác thực tất cả các thực thể có trong tệp feed.json bằng cách sử dụng tệp giản đồ schema.json và mô-đun python jsonschema. Các thực thể này nằm trong thuộc tính dataFeedElement như được chỉ định trong tài liệu về thư bao nguồn cấp dữ liệu.
importjsonfromjsonschemaimportvalidate# Loading the schema filewithopen("schema.json","r")asfp:schema=json.load(fp)# Opening the feedwithopen("feed.json","r")asfp:feed=json.load(fp)# Validating each entity in the feedforentityinfeed["dataFeedElement"]:try:validate(schema=schema,instance=entity)print("Entity validated successfully")exceptExceptionase:# e may contain an explanation as to why the entity wasn't validprint("Failed to validate the entity")
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],[],[[["JSON Schemas are provided to validate entities when creating or updating your data feed, ensuring data quality and consistency."],["Choose the appropriate Media Actions schema (VOD, Live TV, Music, or Radio) based on the type of entities in your feed."],["Select a validator implementation that supports JSON Schema draft 7 and integrate it into your workflow for automated validation."],["Refer to the specification on this site as the primary source of truth for entity requirements, as schemas may not include all features."],["Utilize the provided example code snippet to validate entities within your feed using the chosen schema and a compatible validator."]]],["To validate feed entities, use the provided JSON Schemas, based on the JSON Schema specification, for different media types: Video On Demand, Live TV, Music, and Radio. Add unit tests for validation to detect issues and avoid errors during feed development. Choose a validator implementation supporting draft 7, such as the `jsonschema` python module. Validate entities by loading the schema and feed, then iterating through entities in the `dataFeedElement` property and testing with the selected implementation, printing the results.\n"]]