[Python] Youtube video is not playable from a created playlist

Discussão em 'Python' iniciado por Stack, Agosto 7, 2025.

  1. Stack

    Stack Membro Participativo

    I have python program that creates random playlists from my subscriptions that I play with youtube music. It works just fine. Some of the videos that get added to the the playlists are not playable and I want to figure out how to test for them in the program before they get into the playlist.

    Example video https://music.youtube.com/watch?v=5AxTF5cuYPM

    I pulled up the api list for the video using these parts:

    contentDetails,id,liveStreamingDetails,localizations,paidProductPlacementDetails,player,recordingDetails,snippet,statistics,status,topicDetails

    And got this result: (had to chop out the chinese to get it to post)

    {
    "kind": "youtube#videoListResponse",
    "etag": "zsqqOTGDedIqdo5o5kiqjG7uQsk",
    "items": [
    {
    "kind": "youtube#video",
    "etag": "t9kElYNA6IX_5ftRajSbHWjLiZg",
    "id": "5AxTF5cuYPM",
    "snippet": {
    "publishedAt": "2020-05-08T13:00:03Z",
    "channelId": "UCOYbuyJtfv9ks4lvlv-VuBg",
    "title": chopped out,
    "description": chopped out,
    "thumbnails": {
    "default": {
    "url": "https://i.ytimg.com/vi/5AxTF5cuYPM/default.jpg",
    "width": 120,
    "height": 90
    },
    "medium": {
    "url": "https://i.ytimg.com/vi/5AxTF5cuYPM/mqdefault.jpg",
    "width": 320,
    "height": 180
    },
    "high": {
    "url": "https://i.ytimg.com/vi/5AxTF5cuYPM/hqdefault.jpg",
    "width": 480,
    "height": 360
    },
    "standard": {
    "url": "https://i.ytimg.com/vi/5AxTF5cuYPM/sddefault.jpg",
    "width": 640,
    "height": 480
    },
    "maxres": {
    "url": "https://i.ytimg.com/vi/5AxTF5cuYPM/maxresdefault.jpg",
    "width": 1280,
    "height": 720
    }
    },
    "channelTitle": "蘇慧倫 TarcySu",
    "categoryId": "22",
    "liveBroadcastContent": "none",
    "localized": {
    "title": chopped out,
    "description": chopped out
    }
    },
    "contentDetails": {
    "duration": "PT3M40S",
    "dimension": "2d",
    "definition": "hd",
    "caption": "false",
    "licensedContent": false,
    "contentRating": {},
    "projection": "rectangular"
    },
    "status": {
    "uploadStatus": "processed",
    "privacyStatus": "public",
    "license": "youtube",
    "embeddable": true,
    "publicStatsViewable": true,
    "madeForKids": false
    },
    "statistics": {
    "viewCount": "2297",
    "likeCount": "89",
    "favoriteCount": "0",
    "commentCount": "3"
    },
    "player": {
    "embedHtml": "\u003ciframe width=\"480\" height=\"270\" src=\"//www.youtube.com/embed/5AxTF5cuYPM\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen\u003e\u003c/iframe\u003e"
    },
    "topicDetails": {
    "topicCategories": [
    "https://en.wikipedia.org/wiki/Entertainment",
    "https://en.wikipedia.org/wiki/Music_of_Asia"
    ]
    },
    "recordingDetails": {},
    "paidProductPlacementDetails": {
    "hasPaidProductPlacement": false
    }
    }
    ],
    "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 1
    }
    }


    Nowhere in the results do I see anything that would prevent the video from playing so I have nothing to test for.

    Continue reading...

Compartilhe esta Página