mirror of https://github.com/yt-dlp/yt-dlp.git
[smotri] Add support for moderated (?) videos (Fixes #2030)
This commit is contained in:
parent
8d0bdeba18
commit
7dbf5ae587
|
@ -1,5 +1,6 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
import os.path
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
import hashlib
|
import hashlib
|
||||||
|
@ -10,6 +11,7 @@ from ..utils import (
|
||||||
compat_urllib_parse,
|
compat_urllib_parse,
|
||||||
compat_urllib_request,
|
compat_urllib_request,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
url_basename,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,6 +135,15 @@ class SmotriIE(InfoExtractor):
|
||||||
video_page_url = 'http://' + mobj.group('url')
|
video_page_url = 'http://' + mobj.group('url')
|
||||||
video_page = self._download_webpage(video_page_url, video_id, u'Downloading video page')
|
video_page = self._download_webpage(video_page_url, video_id, u'Downloading video page')
|
||||||
|
|
||||||
|
# Warning if video is unavailable
|
||||||
|
warning = self._html_search_regex(
|
||||||
|
r'<div class="videoUnModer">(.*?)</div>', video_page,
|
||||||
|
u'warning messagef', default=None)
|
||||||
|
if warning is not None:
|
||||||
|
self._downloader.report_warning(
|
||||||
|
u'Video %s may not be available; smotri said: %s ' %
|
||||||
|
(video_id, warning))
|
||||||
|
|
||||||
# Adult content
|
# Adult content
|
||||||
if re.search(u'EroConfirmText">', video_page) is not None:
|
if re.search(u'EroConfirmText">', video_page) is not None:
|
||||||
self.report_age_confirmation()
|
self.report_age_confirmation()
|
||||||
|
@ -148,7 +159,7 @@ class SmotriIE(InfoExtractor):
|
||||||
# Extract the rest of meta data
|
# Extract the rest of meta data
|
||||||
video_title = self._search_meta(u'name', video_page, u'title')
|
video_title = self._search_meta(u'name', video_page, u'title')
|
||||||
if not video_title:
|
if not video_title:
|
||||||
video_title = video_url.rsplit('/', 1)[-1]
|
video_title = os.path.splitext(url_basename(video_url))[0]
|
||||||
|
|
||||||
video_description = self._search_meta(u'description', video_page)
|
video_description = self._search_meta(u'description', video_page)
|
||||||
END_TEXT = u' на сайте Smotri.com'
|
END_TEXT = u' на сайте Smotri.com'
|
||||||
|
|
Loading…
Reference in New Issue