X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/415fdb62500dca2e22067a05008dfbf87c75b662..81657e6063f6dd0b3ee6243d446b8df1b13adfbc:/youtube_dl/extractor/steam.py?ds=inline diff --git a/youtube_dl/extractor/steam.py b/youtube_dl/extractor/steam.py index 1d8d572..e5ac586 100644 --- a/youtube_dl/extractor/steam.py +++ b/youtube_dl/extractor/steam.py @@ -4,8 +4,10 @@ import re from .common import InfoExtractor from ..utils import ( + extract_attributes, ExtractorError, - unescapeHTML, + get_element_by_class, + js_to_json, ) @@ -22,38 +24,42 @@ class SteamIE(InfoExtractor): _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' _TESTS = [{ - "url": "http://store.steampowered.com/video/105600/", - "playlist": [ + 'url': 'http://store.steampowered.com/video/105600/', + 'playlist': [ { - "md5": "f870007cee7065d7c76b88f0a45ecc07", - "info_dict": { - 'id': '81300', - 'ext': 'flv', - "title": "Terraria 1.1 Trailer", + 'md5': '6a294ee0c4b1f47f5bb76a65e31e3592', + 'info_dict': { + 'id': '2040428', + 'ext': 'mp4', + 'title': 'Terraria 1.3 Trailer', 'playlist_index': 1, } }, { - "md5": "61aaf31a5c5c3041afb58fb83cbb5751", - "info_dict": { - 'id': '80859', - 'ext': 'flv', - "title": "Terraria Trailer", + 'md5': '911672b20064ca3263fa89650ba5a7aa', + 'info_dict': { + 'id': '2029566', + 'ext': 'mp4', + 'title': 'Terraria 1.2 Trailer', 'playlist_index': 2, } } ], + 'info_dict': { + 'id': '105600', + 'title': 'Terraria', + }, 'params': { 'playlistend': 2, } }, { 'url': 'http://steamcommunity.com/sharedfiles/filedetails/?id=242472205', 'info_dict': { - 'id': 'WB5DvDOOvAY', + 'id': 'X8kpJBlzD2E', 'ext': 'mp4', - 'upload_date': '20140329', - 'title': 'FRONTIERS - Final Greenlight Trailer', - 'description': "The final trailer for the Steam Greenlight launch. Hooray, progress! Here's the official Greenlight page: http://steamcommunity.com/sharedfiles/filedetails/?id=242472205", + 'upload_date': '20140617', + 'title': 'FRONTIERS - Trapping', + 'description': 'md5:bf6f7f773def614054089e5769c12a6e', 'uploader': 'AAD Productions', 'uploader_id': 'AtomicAgeDogGames', } @@ -76,48 +82,65 @@ class SteamIE(InfoExtractor): self.report_age_confirmation() webpage = self._download_webpage(videourl, playlist_id) + flash_vars = self._parse_json(self._search_regex( + r'(?s)rgMovieFlashvars\s*=\s*({.+?});', webpage, + 'flash vars'), playlist_id, js_to_json) + + playlist_title = None + entries = [] if fileID: - playlist_title = self._html_search_regex( - r'