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

php Youtube Get video id from live_stream

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

How to play Youtube live stream video in application?

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

How does Youtube/Facebook live stream from web browser works

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

recording live stream video from tv card using ffmpeg at window

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

ffmpeg recording video from live stream closed if connention intrupt

getting the youtube id from a link

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

Youtube Live Stream Chat Messages

Retrieve video ID from YouTube link

Extract the video ID from youtube url in .net

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

Get youtube video id from youtube url in smarty template?

Fetch YouTube Video Id from youtube URL in zend framework

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

Get youtube video Id from shared video Url

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

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

How to control youtube embed live stream?

Embed YouTube live stream in android app

How to Live Stream YouTube without Audio

Recording a YouTube live stream using VLC

Live stream prerecorded footage to YouTube using FFMPEG

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

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

Python: getting the youtube author image from the video link

TOP Ranking

HotTag

Archive