mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-27 16:00:54 +00:00
[voicerepublic] Detect list of available formats from the web page
This commit is contained in:
parent
f03a8a3c4e
commit
28ebef0b1b
1 changed files with 6 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
|||
# coding: utf-8
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import re
|
||||
|
||||
from .common import InfoExtractor
|
||||
from ..compat import compat_urllib_request
|
||||
from ..utils import ExtractorError
|
||||
|
@ -32,12 +34,15 @@ def _real_extract(self, url):
|
|||
if '<a>Queued for processing, please stand by...</a>' in webpage:
|
||||
raise ExtractorError('Audio is still queued for processing')
|
||||
|
||||
ext_matches = re.finditer(r'data-\w+=\'/vrmedia/\d+-clean\.(\w+)\'', webpage)
|
||||
exts = [match.group(1) for match in ext_matches]
|
||||
|
||||
formats = [{
|
||||
'url': 'https://voicerepublic.com/vrmedia/{}-clean.{}'.format(video_id, ext),
|
||||
'ext': ext,
|
||||
'format_id': ext,
|
||||
'vcodec': 'none',
|
||||
} for ext in ['m4a', 'mp3', 'ogg']]
|
||||
} for ext in exts]
|
||||
self._sort_formats(formats)
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue