nolenfelten / xbmc-addons

Automatically exported from code.google.com/p/xbmc-addons
0 stars 0 forks source link

TED plugin can't detect video URL for some talks #90

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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%2Ff4a34816481a61de1
6753f720db4d7609dc4eb9e_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.

Original issue reported on code.google.com by moregin...@gmail.com on 22 Jan 2012 at 3:23

GoogleCodeExporter commented 9 years ago
Patch for git://xbmc.git.sourceforge.net/gitroot/xbmc/plugins

Original comment by moregin...@gmail.com on 27 Jan 2012 at 12:01

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Patch was applied in 2.2.5.

Original comment by moregin...@gmail.com on 31 Jan 2012 at 12:27