mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
14 lines
417 B
Python
14 lines
417 B
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import unicode_literals
|
|
import youtube_dl
|
|
|
|
def get_video_url(url):
|
|
ydl = youtube_dl.YoutubeDL({'quiet': True, 'format': 'bestaudio/best', 'outtmpl': u'%(id)s%(ext)s'})
|
|
with ydl:
|
|
result = ydl.extract_info(url, download=False)
|
|
if 'entries' in result:
|
|
video = result['entries'][0]
|
|
else:
|
|
video = result
|
|
return video["formats"][0]["url"]
|