forked from minhngoc25a/yt-dlc
DotsubIE: simplify and extract the upload date
Do not declare variables for fields in the info dictionary.
This commit is contained in:
parent
16ea58cbda
commit
41bece30b4
|
@ -1,5 +1,7 @@
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
import time
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +15,8 @@ class DotsubIE(InfoExtractor):
|
||||||
u"title": u"Pyramids of Waste (2010), AKA The Lightbulb Conspiracy - Planned obsolescence documentary",
|
u"title": u"Pyramids of Waste (2010), AKA The Lightbulb Conspiracy - Planned obsolescence documentary",
|
||||||
u"uploader": u"4v4l0n42",
|
u"uploader": u"4v4l0n42",
|
||||||
u'description': u'Pyramids of Waste (2010) also known as "The lightbulb conspiracy" is a documentary about how our economic system based on consumerism and planned obsolescence is breaking our planet down.\r\n\r\nSolutions to this can be found at:\r\nhttp://robotswillstealyourjob.com\r\nhttp://www.federicopistono.org\r\n\r\nhttp://opensourceecology.org\r\nhttp://thezeitgeistmovement.com',
|
u'description': u'Pyramids of Waste (2010) also known as "The lightbulb conspiracy" is a documentary about how our economic system based on consumerism and planned obsolescence is breaking our planet down.\r\n\r\nSolutions to this can be found at:\r\nhttp://robotswillstealyourjob.com\r\nhttp://www.federicopistono.org\r\n\r\nhttp://opensourceecology.org\r\nhttp://thezeitgeistmovement.com',
|
||||||
u'thumbnail': u'http://dotsub.com/media/aed3b8b2-1889-4df5-ae63-ad85f5572f27/p'
|
u'thumbnail': u'http://dotsub.com/media/aed3b8b2-1889-4df5-ae63-ad85f5572f27/p',
|
||||||
|
u'upload_date': u'20101213',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,20 +26,16 @@ class DotsubIE(InfoExtractor):
|
||||||
info_url = "https://dotsub.com/api/media/%s/metadata" %(video_id)
|
info_url = "https://dotsub.com/api/media/%s/metadata" %(video_id)
|
||||||
webpage = self._download_webpage(info_url, video_id)
|
webpage = self._download_webpage(info_url, video_id)
|
||||||
info = json.loads(webpage)
|
info = json.loads(webpage)
|
||||||
video_url = info['mediaURI']
|
date = time.gmtime(info['dateCreated']/1000) # The timestamp is in miliseconds
|
||||||
uploader = info['user']
|
|
||||||
description = info['description']
|
|
||||||
view_count = info['numberOfViews']
|
|
||||||
title = info['title']
|
|
||||||
thumbnail_url = info['screenshotURI']
|
|
||||||
ext = 'flv'
|
|
||||||
return [{
|
return [{
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': info['mediaURI'],
|
||||||
'ext': ext,
|
'ext': 'flv',
|
||||||
'title': title,
|
'title': info['title'],
|
||||||
'thumbnail': thumbnail_url,
|
'thumbnail': info['screenshotURI'],
|
||||||
'description': description,
|
'description': info['description'],
|
||||||
'uploader': uploader,
|
'uploader': info['user'],
|
||||||
'view_count': view_count,
|
'view_count': info['numberOfViews'],
|
||||||
|
'upload_date': u'%04i%02i%02i' % (date.tm_year, date.tm_mon, date.tm_mday),
|
||||||
}]
|
}]
|
||||||
|
|
Loading…
Reference in New Issue