1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-20 23:17:50 +08:00

[steam] Modernize

This commit is contained in:
Philipp Hagemeister 2014-04-19 19:51:04 +02:00
parent 3c50b99ab4
commit 3fa6b6e293

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
@ -17,22 +19,24 @@ class SteamIE(InfoExtractor):
_VIDEO_PAGE_TEMPLATE = 'http://store.steampowered.com/video/%s/' _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' _AGECHECK_TEMPLATE = 'http://store.steampowered.com/agecheck/video/%s/?snr=1_agecheck_agecheck__age-gate&ageDay=1&ageMonth=January&ageYear=1970'
_TEST = { _TEST = {
u"url": u"http://store.steampowered.com/video/105600/", "url": "http://store.steampowered.com/video/105600/",
u"playlist": [ "playlist": [
{ {
u"file": u"81300.flv", "md5": "f870007cee7065d7c76b88f0a45ecc07",
u"md5": u"f870007cee7065d7c76b88f0a45ecc07", "info_dict": {
u"info_dict": { 'id': '81300',
u"title": u"Terraria 1.1 Trailer", 'ext': 'flv',
u'playlist_index': 1, "title": "Terraria 1.1 Trailer",
'playlist_index': 1,
} }
}, },
{ {
u"file": u"80859.flv", "md5": "61aaf31a5c5c3041afb58fb83cbb5751",
u"md5": u"61aaf31a5c5c3041afb58fb83cbb5751", "info_dict": {
u"info_dict": { 'id': '80859',
u"title": u"Terraria Trailer", 'ext': 'flv',
u'playlist_index': 2, "title": "Terraria Trailer",
'playlist_index': 2,
} }
} }
] ]
@ -73,7 +77,7 @@ class SteamIE(InfoExtractor):
video_url = vid.group('videoURL') video_url = vid.group('videoURL')
video_thumb = thumb.group('thumbnail') video_thumb = thumb.group('thumbnail')
if not video_url: if not video_url:
raise ExtractorError(u'Cannot find video url for %s' % video_id) raise ExtractorError('Cannot find video url for %s' % video_id)
info = { info = {
'id':video_id, 'id':video_id,
'url':video_url, 'url':video_url,
@ -82,4 +86,4 @@ class SteamIE(InfoExtractor):
'thumbnail': video_thumb 'thumbnail': video_thumb
} }
videos.append(info) videos.append(info)
return [self.playlist_result(videos, gameID, game_title)] return self.playlist_result(videos, gameID, game_title)