- thumbnail = self._html_search_regex(r'(?m)title: "NDR PLAYER",\s*poster: "([^"]+)",',
- page, 'thumbnail', fatal=False)
- if thumbnail:
- thumbnail = 'http://www.ndr.de' + thumbnail
- for format_id in ['lo', 'hi', 'hq']:
+ thumbnails = re.findall(r'''\d+: \{src: "([^"]+)"(?: \|\| '[^']+')?, quality: '([^']+)'}''', page)
+ if thumbnails:
+ quality_key = qualities(['xs', 's', 'm', 'l', 'xl'])
+ largest = max(thumbnails, key=lambda thumb: quality_key(thumb[1]))
+ thumbnail = 'http://www.ndr.de' + largest[0]
+
+ for format_id in 'lo', 'hi', 'hq':