问题
I need a way to get the URLs of a YouTube live stream, ideally URLs for each quality (i.e. 240p, 360p).
What I tried so far:
- Use Wireshark (Don't know how to apply proper filters)
- Use urlsnoopers (Couldn't find anything that works in Linux)
- Get the m3u8 URL from the page source (Couldn't control quality)
- Use Firefox developer tools to analyze the network (Would not get the m3u8 URL for some links)
On another note I noticed that some of the lower quality stream URL links seem to get stuck after a few seconds. Any idea why?
回答1:
There's a Python tool called livestreamer that gets the job done.
Steps:
Install python-pip (Python module management tool):
yum install python-pip
Add the livestreamer module:
sudo pip install livestreamer
Play the video with the --stream-url option:
livestreamer https://www.youtube.com/watch?v=eWRei_9cEO8 240p --stream-url
来源:https://stackoverflow.com/questions/25563055/getting-youtube-livestream-url