[khanacademy] Add support (Fixes #2066)
This commit is contained in:
parent
0cdad20c75
commit
3d3538e422
4 changed files with 93 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
import base64
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
|
@ -260,6 +261,15 @@ class InfoExtractor(object):
|
|||
xml_string = transform_source(xml_string)
|
||||
return xml.etree.ElementTree.fromstring(xml_string.encode('utf-8'))
|
||||
|
||||
def _download_json(self, url_or_request, video_id,
|
||||
note=u'Downloading JSON metadata',
|
||||
errnote=u'Unable to download JSON metadata'):
|
||||
json_string = self._download_webpage(url_or_request, video_id, note, errnote)
|
||||
try:
|
||||
return json.loads(json_string)
|
||||
except ValueError as ve:
|
||||
raise ExtractorError('Failed to download JSON', cause=ve)
|
||||
|
||||
def report_warning(self, msg, video_id=None):
|
||||
idstr = u'' if video_id is None else u'%s: ' % video_id
|
||||
self._downloader.report_warning(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue