Commits

Simon Meers  committed 898f580

Use largest YouTube thumbnail URL instead of '240' which doesn't always exist any more.

  • Participants
  • Parent commits dcfc8bb

Comments (0)

Files changed (1)

File syncr/app/youtube.py

 	    'url': filter(lambda x: x.attrib['rel'] == 'alternate',
 			  result.findall('{%s}link' %
 					 ATOM_NS))[0].attrib['href'],
-	    'thumbnail_url': filter(lambda x: x.attrib['height'] == '240',
-				    result.findall('{%s}group/{%s}thumbnail' % (MRSS_NS, MRSS_NS)))[0].attrib['url'],
+            'thumbnail_url': sorted(
+                result.findall('{%s}group/{%s}thumbnail' % (MRSS_NS, MRSS_NS)),
+                lambda x, y: int(y.attrib['height']) - int(x.attrib['height']))[0].attrib['url'],
 	    'length': result.find('{%s}group/{%s}duration' %
 				  (MRSS_NS, YOUTUBE_NS)).attrib['seconds'],
 	    }