Status: New
Owner: ----
Labels: Type-Defect OpSys-All
New issue 90 by
moregin...@gmail.com: TED plugin can't detect video URL for
some talks
http://code.google.com/p/xbmc-addons/issues/detail?id=90
For example, the "Sonaar Luthra: Meet the Water Canary" talk fails to
detect either a normal or youtube link, and fails to play the stream:
---
Playlist Player: skipping unplayable item: 0, path
[plugin://plugin.video.ted.talks/?url=http%3A%2F%
2Fwww.ted.com%2Ftalks%2Fsonaar_luthra_meet_the_water_canary.html&mode=playVideo&name=Sonaar+Luthra%3A+Meet+the+Water+Canary&icon=http%3A%2F%
2Fimages.ted.com%2Fimages%2Fted%2Ff4a34816481a61de16753f720db4d7609dc4eb9e_389x292.jpg]
---
The html does contain at least one usable link:
---
If you are on a mobile device, you may be able to <a
href="
http://download.ted.com/talks/SonaarLuthra_2011G.mp4">download the
video</a>
---
I've modified ted_talks_scraper.py to find it.
---
#get description:
plot = soup.find('p', attrs={'id':'tagline'}).string
#get url
#detectors for link to video in order of preference
linkDetectors = [
lambda l: re.compile('High-res video
\(MP4\)').match(str(l.string)),
lambda l:
re.compile('
http://download.ted.com/talks/.+.mp4').match(str(l['href'])),
]
for link in soup.findAll('a'):
for detector in linkDetectors:
if detector(link):
url = link['href']
linkDetectors =
linkDetectors[:linkDetectors.index(detector)] # Only look for better
matches than what we have
break
---
If I get time later I'll get a checkout and generate a patch.