Getting video id "Live Stream" from Youtube

May Chester

I'm having trouble getting the video ID, which is live, using YouTube API v3. I use the "playlists" query to get the current videos from the channel, all right, but there is no live broadcast in this data. The problem can be solved by applying the query "search", but it weighs 100 quotas, and this is not suitable for me. Does anyone know a possible solution to this problem?

May Chester

I solved this problem, here is my code on python.

from lxml import html
import requests 

page = requests.get(f"https://www.youtube.com/embed/live_stream?channel={channel_id}")
    if page.status_code == 200:
        tree = html.fromstring(page.content)
        links = tree.xpath('//link[@rel="canonical"]')
        if links:
            id = links[0].attrib['href'].split("watch?v=")[1]

Collected from the Internet

Please contact javaer1[email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

getting the youtube id from a link

Regex to extract both video id or playlist id from youtube url

Best way to live stream video from java server to android client?

Extract the video ID from youtube url in .net

How to control youtube embed live stream?

Youtube Live Stream Chat Messages

php Youtube Get video id from live_stream

Embed YouTube live stream in android app

Why can't I display an embedded video from a YouTube Live stream?

How to play Youtube live stream video in application?

How does Youtube/Facebook live stream from web browser works

Flutter Dart : How to extract youtube video ID from video URL?

Embed a YouTube channel's current live stream without the video ID

Recording a YouTube live stream using VLC

Live stream video and capture input from the user and send it to Raspberry Pi Robot

Get youtube video id from youtube url in smarty template?

recording live stream video from tv card using ffmpeg at window

Fetch YouTube Video Id from youtube URL in zend framework

Getting "Time Elapsed" of a playing video from the YouTube API in ActionScript 3.0

How to get Youtube Live Stream by Channel Id in Youtube API V3 in android?

How to Live Stream YouTube without Audio

ffmpeg recording video from live stream closed if connention intrupt

Get youtube video Id from shared video Url

Live stream prerecorded footage to YouTube using FFMPEG

How can you get a fast video live stream from your iPhone to a server?

Retrieve video ID from YouTube link

How to resize output frame from live stream from youtube using opencv

Getting YouTube Video ID from user-supplied search term using YouTube API

Python: getting the youtube author image from the video link