Return the parsed raw YouTube URL only if available, otherwise the original URL
This commit is contained in:
parent
aebeadbcf7
commit
fa9b816d06
1 changed files with 2 additions and 1 deletions
|
@ -465,7 +465,8 @@ class MediaPlugin(Plugin):
|
||||||
url = 'https://www.youtube.com/watch?v={}'.format(m.group(1))
|
url = 'https://www.youtube.com/watch?v={}'.format(m.group(1))
|
||||||
|
|
||||||
proc = subprocess.Popen(['youtube-dl', '-f', 'best', '-g', url], stdout=subprocess.PIPE)
|
proc = subprocess.Popen(['youtube-dl', '-f', 'best', '-g', url], stdout=subprocess.PIPE)
|
||||||
return proc.stdout.read().decode("utf-8", "strict")[:-1]
|
raw_url = proc.stdout.read().decode("utf-8", "strict")[:-1]
|
||||||
|
return raw_url if raw_url else url
|
||||||
|
|
||||||
@action
|
@action
|
||||||
def get_youtube_info(self, url):
|
def get_youtube_info(self, url):
|
||||||
|
|
Loading…
Reference in a new issue