I'm trying to find a way to detect multiple live simultaneous streams on a same youtube channels.
I want to avoid using the search from the API because of the cost (100) and used since now the "get methods" by using this url : https://www.youtube.com/channel/CHANNEL_ID/live.
But when there is multiple streams in the same time this url seems to redirect only to one of the live.
Does anybody have a magic trick for that ?
I'm using Python and made something like that :
def get_channel_live_url(p_channelID): LiveChannelVideo = re.compile(r'https://www.youtube.com/watch\?v=(.*)') urlpage = 'https://youtube.com/channel/'+p_channelID+'/live' links = browse_and_return_balise(urlpage, balise='link', rel='canonical') for link in links: isLiveChannelVideo = LiveChannelVideo.search(link['href']) if isLiveChannelVideo != None: return isLiveChannelVideo.group(1)where browse_and_return_balise are something like that :
def browse_and_return_balise(url, balise='a', class_=None, attrs=None, rel=None): result = [] page = urllib.request.urlopen(url) soup = BeautifulSoup(page, 'html.parser') result = soup.find_all(balise, class_=class_, attrs=attrs, rel=rel) # Collect all links return resultThe issue is that when a youtube channel broadcast 2 live at the same time I only catch the first one.