How to check live stream information of a youtube channel without using Search.list from youtube data api?

前端 未结 1 1853
野趣味
野趣味 2021-01-06 16:34

Basically, I want to check if several channels are streaming now without using Search.list.

I used Search.list from youtube data APIenter link descr

相关标签:
1条回答
  • 2021-01-06 17:30

    You can also use the playlistItems.list request for retrieve videos from channels who are currently livestreaming.

    tl;dr: Use any livestreaming playlist available in the YouTube Live channel website. Once selected the livestreaming playlist of your interest, use playlistItems.list for retrieve the livestreaming videos from the selected playlist.


    You need follow these steps in order to select the livestreaming playlist and make the request using the YouTube Data API playlistItems.list for retrieve the livestreaming videos from the selected playlist:

    1. Enter to Live channel - which according to its description:

    Description

    YouTube Live - Watch great live streams, such as live gaming, live music, live sports, live news, and Google Hangouts.

    1. In the main page of the "Live" channel, you'll find different kind of livestreaming events (contained in playlists) such as:

    Live Now: Which in my opinion it contains all current livestream events in YouTube (independent of its live streaming category), and the live stream playlist I'll use in this demonstration.

    Live Now - Gaming

    Live Now - News

    Live Now - Sports

    Recent Livestreams

    Upcoming Live Streams

    Live Now - Technology

    Live Now - Animals

    Mobile Live Streams

    Recent Mobile Live Streams

    Webcam Live Streams

    1. Once selected the livestreaming playlist, use the playlistItems.list request for retrieve videos from the selected livestreaming playlist.

    The playlistItems.list request for retrieve the videos from the given playlist is as follows:

    GET https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2C+contentDetails&playlistId=PLU12uITxBEPFJz2brJ8C8IBst7O5fHgJ5&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CprevPageToken%2CtokenPagination%2CvisitorId&key={YOUR_API_KEY}
    

    In this case, if I execute this request in the Google API Explorer demo, the results will contain livestream videos from Latin America.

    N.B, the results may vary from region.

    The results from the demo are:

    {
     "kind": "youtube#playlistItemListResponse",
     "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/BZS3m3wtzWkGJhZ27amHF1uu--g\"",
     "nextPageToken": "CAUQAA",
     "pageInfo": {
      "totalResults": 100,
      "resultsPerPage": 5
     },
     "items": [
      {
    
       "kind": "youtube#playlistItem",
       "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/TQNEIYUD6c8Sx9Shf23I7LlDu28\"",
       "id": "UExVMTJ1SVR4QkVQRkp6MmJySjhDOElCc3Q3TzVmSGdKNS5BOUYwOUM3RENCNEU5MDMx",
       "snippet": {
        "publishedAt": "2019-02-22T14:00:06.000Z",
        "channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
        "title": "Conferencia de prensa matutina desde Palacio Nacional",
        "description": "Sigue las actividades del Presidente de México: \n\nSitio web: https://lopezobrador.org.mx/\nYouTube: https://www.youtube.com/lopezobrador\nFacebook: https://facebook.com/lopezobrador.org.mx\nTwitter: https://twitter.com/lopezobrador_\nInstagram: https://www.instagram.com/lopezobrador/\nTelegram: https://t.me/PresidenteAMLO\n\n#EnVivo #ConferenciaPresidente",
        "thumbnails": {
         "default": {
          "url": "https://i.ytimg.com/vi/-ugBfd4HRt0/default_live.jpg",
          "width": 120,
          "height": 90
         },
         "medium": {
          "url": "https://i.ytimg.com/vi/-ugBfd4HRt0/mqdefault_live.jpg",
          "width": 320,
          "height": 180
         },
         "high": {
          "url": "https://i.ytimg.com/vi/-ugBfd4HRt0/hqdefault_live.jpg",
          "width": 480,
          "height": 360
         },
         "standard": {
          "url": "https://i.ytimg.com/vi/-ugBfd4HRt0/sddefault_live.jpg",
          "width": 640,
          "height": 480
         },
         "maxres": {
          "url": "https://i.ytimg.com/vi/-ugBfd4HRt0/maxresdefault_live.jpg",
          "width": 1280,
          "height": 720
         }
        },
        "channelTitle": "Live",
        "playlistId": "PLU12uITxBEPFJz2brJ8C8IBst7O5fHgJ5",
        "position": 0,
        "resourceId": {
         "kind": "youtube#video",
         "videoId": "-ugBfd4HRt0"
        }
       },
       "contentDetails": {
        "videoId": "-ugBfd4HRt0",
        "videoPublishedAt": "2019-02-21T15:28:17.000Z"
       }
      },
      {
    
       "kind": "youtube#playlistItem",
       "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/7O0tilY80gtiSISmtR2ST0fFfJs\"",
       "id": "UExVMTJ1SVR4QkVQRkp6MmJySjhDOElCc3Q3TzVmSGdKNS5DMDFBOTY2NDRCRkUyODk3",
       "snippet": {
        "publishedAt": "2019-02-22T14:00:06.000Z",
        "channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
        "title": "GH DÚO: La Casa en Directo - 24 Horas | Mediaset España",
        "description": "¿QUIERES VER LA SEÑAL DE LA CÁMARA 2? HAZ CLICK AQUÍ: https://www.mitele.es/directo/gh-duo-24h-senal-2?utm_source=youtube\n\nDescarga la app de GH DÚO para disfrutar del directo multicámara 24h, votar en las encuestas y galas semanales; y estar al tanto de todas las novedades de nuestras parejas en la casa de Guadalix: \n- Para iOS: https://itunes.apple.com/es/app/gran-hermano-vip/id616014934?mt=8\n- Para Android: https://play.google.com/store/apps/details?id=es.mediaset.gh14&hl=es\n\nTras acoger una memorable edición VIP que ya forma parte de la historia de ‘Gran Hermano’, la casa de Guadalix de la Sierra volverá a abrir sus puertas: 16 concursantes famosos, esta vez unidos por lazos sentimentales -parejas o exparejas-, protagonizan ‘GH DÚO’, nueva versión del reality que puedes disfrutar con dos galas semanales en Telecinco. Los martes con GH DÚO: Límite 48 Horas y los jueves con la gala semanal. Recuerda, cada martes y jueves a las 22:00 tienes una cita con GH DÚO en Telecinco.\n\n¡Este año, en GH DÚO, te damos el doble!\n\nSuscríbete para tener lo mejor de Mediaset, HAZ CLICK AQUÍ: goo.gl/zNhHAN\n\nY DESCUBRE MÁS EN: https://www.mitele.es/\n\nNo olvides seguirnos en todas nuestras redes sociales:\n\nInstagram: goo.gl/ANWPMf\nFacebook: goo.gl/nHqNkV\nTwitter: goo.gl/5TqgfA\n\n#GHDÚO22F",
        "thumbnails": {
         "default": {
          "url": "https://i.ytimg.com/vi/xFDnNOEZwDo/default_live.jpg",
          "width": 120,
          "height": 90
         },
         "medium": {
          "url": "https://i.ytimg.com/vi/xFDnNOEZwDo/mqdefault_live.jpg",
          "width": 320,
          "height": 180
         },
         "high": {
          "url": "https://i.ytimg.com/vi/xFDnNOEZwDo/hqdefault_live.jpg",
          "width": 480,
          "height": 360
         }
        },
        "channelTitle": "Live",
        "playlistId": "PLU12uITxBEPFJz2brJ8C8IBst7O5fHgJ5",
        "position": 1,
        "resourceId": {
         "kind": "youtube#video",
         "videoId": "xFDnNOEZwDo"
        }
       },
       "contentDetails": {
        "videoId": "xFDnNOEZwDo",
        "videoPublishedAt": "2019-01-15T07:02:52.000Z"
       }
      },
      {
    
       "kind": "youtube#playlistItem",
       "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/LbTCIKMy5TQIN0smP0wA7dA6vsw\"",
       "id": "UExVMTJ1SVR4QkVQRkp6MmJySjhDOElCc3Q3TzVmSGdKNS5CQUM1Q0FEMjM4ODRBODE0",
       "snippet": {
        "publishedAt": "2019-02-22T14:00:06.000Z",
        "channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
        "title": "Peppa Pig en Español LIVE                                                                     
    0 讨论(0)
提交回复
热议问题