democracynow: correct syntax

This commit is contained in:
fnord 2015-07-17 02:57:08 -05:00
parent f870544302
commit eb08081330

View File

@ -1,19 +1,7 @@
# coding: utf-8
from __future__ import unicode_literals
import json
import time
import hmac
import hashlib
import itertools
import re
from ..utils import (
ExtractorError,
int_or_none,
parse_age_limit,
parse_iso8601,
)
from ..compat import compat_urllib_request
from .common import InfoExtractor
@ -40,7 +28,6 @@ class DemocracynowIE(InfoExtractor):
'uploader': 'Democracy Now',
'upload_date': None,
},
}]
def _real_extract(self, url):
@ -60,7 +47,7 @@ class DemocracynowIE(InfoExtractor):
for key in ('caption_file', '.......'):
# ....... = pending vtt support that doesn't clobber srt 'chapter_file':
url = js.get(key, '')
if url == '' or url == None:
if url == '' or url is None:
continue
if not re.match(r'^https?://', url):
url = base_host + url
@ -71,14 +58,14 @@ class DemocracynowIE(InfoExtractor):
}]
for key in ('file', 'audio'):
url = js.get(key, '')
if url == '' or url == None:
if url == '' or url is None:
continue
if not re.match(r'^https?://', url):
url = base_host + url
purl = re.search(r'/(?P<dir>[^/]+)/(?:dn)?(?P<fn>[^/]+?)\.(?P<ext>[^\.\?]+)(?P<hasparams>\?|$)', url)
if video_id == None:
if video_id is None:
video_id = purl.group('fn')
if js.get('start') != None:
if js.get('start') is not None:
url += '&' if purl.group('hasparams') == '?' else '?'
url = url + 'start=' + str(js.get('start'))
formats.append({
@ -92,9 +79,7 @@ class DemocracynowIE(InfoExtractor):
'title': js.get('title'),
'description': description,
'uploader': 'Democracy Now',
# 'thumbnails': thumbnails,
'subtitles': subtitles,
'formats': formats,
}
return ret
#