Skip to content

Commit

Permalink
[vk] Add support for sibnet embeds (closes ytdl-org#9500)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw committed May 16, 2021
1 parent 552b139 commit 8536dca
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions youtube_dl/extractor/vk.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,13 @@ class VKIE(VKBaseIE):
'only_matching': True,
}]

@staticmethod
def _extract_sibnet_urls(webpage):
# https://help.sibnet.ru/?sibnet_video_embed
return [unescapeHTML(mobj.group('url')) for mobj in re.finditer(
r'<iframe\b[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//video\.sibnet\.ru/shell\.php\?.*?\bvideoid=\d+.*?)\1',
webpage)]

def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
video_id = mobj.group('videoid')
Expand Down Expand Up @@ -408,6 +415,10 @@ def _real_extract(self, url):
if odnoklassniki_url:
return self.url_result(odnoklassniki_url, OdnoklassnikiIE.ie_key())

sibnet_urls = self._extract_sibnet_urls(info_page)
if sibnet_urls:
return self.url_result(sibnet_urls[0])

m_opts = re.search(r'(?s)var\s+opts\s*=\s*({.+?});', info_page)
if m_opts:
m_opts_url = re.search(r"url\s*:\s*'((?!/\b)[^']+)", m_opts.group(1))
Expand Down

0 comments on commit 8536dca

Please sign in to comment.