mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-12-23 16:26:40 +00:00
SteamIE: only verify the age if needed
Also use the _html_search_regex function
This commit is contained in:
parent
bb47437686
commit
68f54207a3
1 changed files with 14 additions and 4 deletions
|
@ -3365,6 +3365,8 @@ class SteamIE(InfoExtractor):
|
||||||
(?P<gameID>\d+)/?
|
(?P<gameID>\d+)/?
|
||||||
(?P<videoID>\d*)(?P<extra>\??) #For urltype == video we sometimes get the videoID
|
(?P<videoID>\d*)(?P<extra>\??) #For urltype == video we sometimes get the videoID
|
||||||
"""
|
"""
|
||||||
|
_VIDEO_PAGE_TEMPLATE = 'http://store.steampowered.com/video/%s/'
|
||||||
|
_AGECHECK_TEMPLATE = 'http://store.steampowered.com/agecheck/video/%s/?snr=1_agecheck_agecheck__age-gate&ageDay=1&ageMonth=January&ageYear=1970'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def suitable(cls, url):
|
def suitable(cls, url):
|
||||||
|
@ -3374,11 +3376,19 @@ class SteamIE(InfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
m = re.match(self._VALID_URL, url, re.VERBOSE)
|
m = re.match(self._VALID_URL, url, re.VERBOSE)
|
||||||
gameID = m.group('gameID')
|
gameID = m.group('gameID')
|
||||||
videourl = 'http://store.steampowered.com/agecheck/video/%s/?snr=1_agecheck_agecheck__age-gate&ageDay=1&ageMonth=January&ageYear=1970' % gameID
|
|
||||||
self.report_age_confirmation()
|
videourl = self._VIDEO_PAGE_TEMPLATE % gameID
|
||||||
webpage = self._download_webpage(videourl, gameID)
|
webpage = self._download_webpage(videourl, gameID)
|
||||||
game_title = re.search(r'<h2 class="pageheader">(?P<game_title>.*?)</h2>', webpage).group('game_title')
|
|
||||||
|
if re.search('<h2>Please enter your birth date to continue:</h2>', webpage) is not None:
|
||||||
|
videourl = self._AGECHECK_TEMPLATE % gameID
|
||||||
|
self.report_age_confirmation()
|
||||||
|
webpage = self._download_webpage(videourl, gameID)
|
||||||
|
|
||||||
|
self.report_extraction(gameID)
|
||||||
|
game_title = self._html_search_regex(r'<h2 class="pageheader">(.*?)</h2>',
|
||||||
|
webpage, 'game title')
|
||||||
|
|
||||||
urlRE = r"'movie_(?P<videoID>\d+)': \{\s*FILENAME: \"(?P<videoURL>[\w:/\.\?=]+)\"(,\s*MOVIE_NAME: \"(?P<videoName>[\w:/\.\?=\+-]+)\")?\s*\},"
|
urlRE = r"'movie_(?P<videoID>\d+)': \{\s*FILENAME: \"(?P<videoURL>[\w:/\.\?=]+)\"(,\s*MOVIE_NAME: \"(?P<videoName>[\w:/\.\?=\+-]+)\")?\s*\},"
|
||||||
mweb = re.finditer(urlRE, webpage)
|
mweb = re.finditer(urlRE, webpage)
|
||||||
namesRE = r'<span class="title">(?P<videoName>.+?)</span>'
|
namesRE = r'<span class="title">(?P<videoName>.+?)</span>'
|
||||||
|
|
Loading…
Reference in a new issue