1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

[bild] don't assume embed url(closes #17876)

If the url provided is not the embed url, try to find the embed url on the page
This commit is contained in:
ispedals 2018-10-24 22:22:32 -04:00 committed by GitHub
parent b99b0bcfa0
commit 1efe3b811a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,8 +3,10 @@ from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
base_url,
int_or_none,
unescapeHTML,
urljoin,
)
@ -27,8 +29,16 @@ class BildIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
video_data = self._download_json(
url.split('.bild.html')[0] + ',view=json.bild.html', video_id)
# if we didn't get a direct link to the video, try to find it on the page
if 'bild.de/video/clip/' not in url:
json_url = self._search_regex(
r'data-video-json="(.*?)"',
self._download_webpage(url, video_id), video_id)
video_data = self._download_json(
urljoin(base_url(url), json_url), video_id)
else:
video_data = self._download_json(
url.split('.bild.html')[0] + ',view=json.bild.html', video_id)
return {
'id': video_id,