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

1

4

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

I used Search.list from youtube data APIenter link description here, but I found this method was really costly. As the page says, "A call to this method has a quota cost of 100 units." So it's extremely easy to reach the limit every day.

I have searched for hours to find another method that can provide live stream status of a particular channel. There must be something I have missed because when I enter a channel, I can easily know whether this channel is streaming now or has any live stream plan. I thought it would be a property of the channel.

However, I didn't find any related method. When I called Channels.list(), I could find uploaded videos as a playlist in "items.contentDetails.relatedPlaylists.uploads", but there's no live stream information.

The only solution I've come up with is to request the page https://www.youtube.com/channel/channel_id/live and check if it contains "offline", but I think it might be better to use their own API.

Brendon answered 19/2, 2019 at 15:0 Comment(5)
How frequently are you requesting whether there are livestream events?Alvin
@MauricioAriasOlave It'll be requested each hour, but each time I have to request more than one times because I have to check several channels(maybe up to 50 channels?), and the daily quota is only 10, 000.Brendon
ENE Kalku, had you check if [channel.list](https://developers.google.com/youtube/v3/docs/channels/list) provides whether the channel is online or it retrieves livestream info?, if not, please check the documentation.Alvin
can you add in your question which channel_id's are you using?Alvin
@MauricioAriasOlave I've checked, nothing about livestream information.Brendon
A
-1

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 🔴 -  Capitulos Completos ⭐️Pepa la Cerdita",
    "description": "Peppa Pig en Español LIVE 🔴 -  Capitulos Completos ⭐️Pepa la Cerdita\n► Aquí encontrarás todos tus vídeos favoritos, no olvides suscribirte: goo.gl/ooH7wv \n\nPeppa Pig En Español Capitulos Completos 2017 ★10★ Video De Peppa Pig En Español Capitulos Nuevos\n\nPeppa es una cerdita adorable que vive con sus papás y su hermanito George. Le encanta jugar y disfrazarse y se pasa el día saltando en los charcos de lodo que rodean su casa.",
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/vi/KeML7QM4U3U/default_live.jpg",
      "width": 120,
      "height": 90
     },
     "medium": {
      "url": "https://i.ytimg.com/vi/KeML7QM4U3U/mqdefault_live.jpg",
      "width": 320,
      "height": 180
     },
     "high": {
      "url": "https://i.ytimg.com/vi/KeML7QM4U3U/hqdefault_live.jpg",
      "width": 480,
      "height": 360
     },
     "standard": {
      "url": "https://i.ytimg.com/vi/KeML7QM4U3U/sddefault_live.jpg",
      "width": 640,
      "height": 480
     },
     "maxres": {
      "url": "https://i.ytimg.com/vi/KeML7QM4U3U/maxresdefault_live.jpg",
      "width": 1280,
      "height": 720
     }
    },
    "channelTitle": "Live",
    "playlistId": "PLU12uITxBEPFJz2brJ8C8IBst7O5fHgJ5",
    "position": 2,
    "resourceId": {
     "kind": "youtube#video",
     "videoId": "KeML7QM4U3U"
    }
   },
   "contentDetails": {
    "videoId": "KeML7QM4U3U",
    "videoPublishedAt": "2019-01-23T12:57:23.000Z"
   }
  },
  {

   "kind": "youtube#playlistItem",
   "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/6kuZv-N8F4RzpSkryFD-UXiF2gU\"",
   "id": "UExVMTJ1SVR4QkVQRkp6MmJySjhDOElCc3Q3TzVmSGdKNS5GRTIyMkM4OTJGNjg5OTA2",
   "snippet": {
    "publishedAt": "2019-02-22T14:00:06.000Z",
    "channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
    "title": "Conferencia Matutina de Lopez Obrador, Conociendo la Verdad de Guardia Nacional. 22 de feb del 2019",
    "description": "Lopez obrador respondiendo preguntas sobre la guardia nacional.\nVisitanos en:\nhttps://www.facebook.com/viralpanchito\nhttps://twitter.com/viralpancho\n\nPuedes apoyar a Viral Pancho con una donacion voluntaria aqui\nhttps://www.paypal.me/viralpancho",
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/vi/NBR3AIbFdiI/default_live.jpg",
      "width": 120,
      "height": 90
     },
     "medium": {
      "url": "https://i.ytimg.com/vi/NBR3AIbFdiI/mqdefault_live.jpg",
      "width": 320,
      "height": 180
     },
     "high": {
      "url": "https://i.ytimg.com/vi/NBR3AIbFdiI/hqdefault_live.jpg",
      "width": 480,
      "height": 360
     },
     "standard": {
      "url": "https://i.ytimg.com/vi/NBR3AIbFdiI/sddefault_live.jpg",
      "width": 640,
      "height": 480
     },
     "maxres": {
      "url": "https://i.ytimg.com/vi/NBR3AIbFdiI/maxresdefault_live.jpg",
      "width": 1280,
      "height": 720
     }
    },
    "channelTitle": "Live",
    "playlistId": "PLU12uITxBEPFJz2brJ8C8IBst7O5fHgJ5",
    "position": 3,
    "resourceId": {
     "kind": "youtube#video",
     "videoId": "NBR3AIbFdiI"
    }
   },
   "contentDetails": {
    "videoId": "NBR3AIbFdiI",
    "videoPublishedAt": "2019-02-22T12:46:00.000Z"
   }
  },
  {

   "kind": "youtube#playlistItem",
   "etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/R8tPzgtvpcLUQ7234B21zC0sTVM\"",
   "id": "UExVMTJ1SVR4QkVQRkp6MmJySjhDOElCc3Q3TzVmSGdKNS5ERTI4MUI3MTBBMTdEQTZG",
   "snippet": {
    "publishedAt": "2019-02-22T14:00:06.000Z",
    "channelId": "UC4R8DWoMoI7CAwX8_LjQHig",
    "title": "TN en vivo las 24hs",
    "description": "TN en vivo. Suscribite al canal líder en noticias de Argentina.",
    "thumbnails": {
     "default": {
      "url": "https://i.ytimg.com/vi/-1xif50QMr4/default_live.jpg",
      "width": 120,
      "height": 90
     },
     "medium": {
      "url": "https://i.ytimg.com/vi/-1xif50QMr4/mqdefault_live.jpg",
      "width": 320,
      "height": 180
     },
     "high": {
      "url": "https://i.ytimg.com/vi/-1xif50QMr4/hqdefault_live.jpg",
      "width": 480,
      "height": 360
     },
     "standard": {
      "url": "https://i.ytimg.com/vi/-1xif50QMr4/sddefault_live.jpg",
      "width": 640,
      "height": 480
     },
     "maxres": {
      "url": "https://i.ytimg.com/vi/-1xif50QMr4/maxresdefault_live.jpg",
      "width": 1280,
      "height": 720
     }
    },
    "channelTitle": "Live",
    "playlistId": "PLU12uITxBEPFJz2brJ8C8IBst7O5fHgJ5",
    "position": 4,
    "resourceId": {
     "kind": "youtube#video",
     "videoId": "-1xif50QMr4"
    }
   },
   "contentDetails": {
    "videoId": "-1xif50QMr4",
    "videoPublishedAt": "2018-08-16T17:56:20.000Z"
   }
  }
 ]
}
Alvin answered 22/2, 2019 at 14:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.