Minor formatting changes to satify flake8

This commit is contained in:
Jan Hoek 2017-03-25 20:56:45 +01:00
parent f106284a5e
commit 421ac9e822

View File

@ -478,11 +478,11 @@ class HetKlokhuisIE(NPODataMidEmbedIE):
} }
} }
class NPORecentsIE(NPOIE): class NPORecentsIE(NPOIE):
IE_Name = 'npo:recents' IE_Name = 'npo:recents'
_VALID_URL = r'(?:https?://)?(?:www\.)?npo\.nl/(?P<alt_id>[^/]+)/(?P<program_id>\w+_\d+)' _VALID_URL = r'(?:https?://)?(?:www\.)?npo\.nl/(?P<alt_id>[^/]+)/(?P<program_id>\w+_\d+)'
_TESTS = [ _TESTS = [{
{
# Example of an npo3 program # Example of an npo3 program
'url': 'https://www.npo.nl/keuringsdienst-van-waarde/KN_1678993', 'url': 'https://www.npo.nl/keuringsdienst-van-waarde/KN_1678993',
'info_dict': { 'info_dict': {
@ -491,8 +491,7 @@ class NPORecentsIE(NPOIE):
'description': u'md5:5ffaf131f175d8a771e7a7884833dad2' 'description': u'md5:5ffaf131f175d8a771e7a7884833dad2'
}, },
'playlist_mincount': 8 'playlist_mincount': 8
}, }, {
{
# Example of an npo1/npo2 program # Example of an npo1/npo2 program
'url': 'https://www.npo.nl/jinek/KN_1676589', 'url': 'https://www.npo.nl/jinek/KN_1676589',
'info_dict': { 'info_dict': {
@ -501,8 +500,7 @@ class NPORecentsIE(NPOIE):
'description': u'md5:6998986899b4903395f0cdd0670cedaf' 'description': u'md5:6998986899b4903395f0cdd0670cedaf'
}, },
'playlist_mincount': 8 'playlist_mincount': 8
}, }, {
{
# Example of a program for which there will be only one available episode (if any) # Example of a program for which there will be only one available episode (if any)
'url': 'https://www.npo.nl/midsomer-murders/POW_00828660', 'url': 'https://www.npo.nl/midsomer-murders/POW_00828660',
'info_dict': { 'info_dict': {
@ -511,8 +509,7 @@ class NPORecentsIE(NPOIE):
'description': u'md5:a8b6e9d3e3bd367be88766e3ce8e8362' 'description': u'md5:a8b6e9d3e3bd367be88766e3ce8e8362'
}, },
'playlist_maxcount': 1 'playlist_maxcount': 1
} }]
]
def _extract_entries(self, webpage, program_id, program_url): def _extract_entries(self, webpage, program_id, program_url):
is_npo3 = 'www-assets.npo.nl/uploads/tv_channel/265/logo/smaller_npo3-logo.png' in webpage is_npo3 = 'www-assets.npo.nl/uploads/tv_channel/265/logo/smaller_npo3-logo.png' in webpage
@ -528,15 +525,15 @@ class NPORecentsIE(NPOIE):
for element in tree.findall('.//div'): for element in tree.findall('.//div'):
if 'span4' in element.get('class'): if 'span4' in element.get('class'):
hyperlink = element.find('.//a') hyperlink = element.find('.//a')
# Note: ElementTree in Python 2.6+ doesn't support # Note: ElementTree in Python 2.6+ doesn't support
# the required XPath constructs # the required XPath constructs
inactive = False inactive = False
divs = hyperlink.findall('div') divs = hyperlink.findall('div')
for div in divs: for div in divs:
if div.attrib.get('class') == 'program-not-available': if div.attrib.get('class') == 'program-not-available':
inactive = True inactive = True
if not inactive: if not inactive:
yield self.url_result( yield self.url_result(
url='http://npo.nl%s' % hyperlink.get('href'), url='http://npo.nl%s' % hyperlink.get('href'),
@ -559,8 +556,8 @@ class NPORecentsIE(NPOIE):
'description': description, 'description': description,
'entries': entries 'entries': entries
} }
class NPOPlaylistBaseIE(NPOIE): class NPOPlaylistBaseIE(NPOIE):
def _real_extract(self, url): def _real_extract(self, url):
playlist_id = self._match_id(url) playlist_id = self._match_id(url)