vlad wrote:
> hello,
>
> thank you to all devs for the new freevo version!
> it looks pretty good! and i really like the video-podcast plugin.
> but it seems that it works only for feeds that have the video link directly on
> the page (like here: http://podcast.rickygervais.com/podcast.xml).
> is the link not on the page (here: http://podcast.wdr.de/quarks.xml)
> freevo crashes.
This may be best parsed using BeautifulStoneSoup as it is quite tolerant
of xml errors and quite easy to use:
There is a little extract:
>>> from BeautifulSoup import BeautifulStoneSoup
>>> soup = BeautifulStoneSoup(open('./quarks.xml','r').read())
>>> items=soup.findAll('item')
>>> len(items)
44
>>> items[0]
<item>
<title>Quarks & Co: 13.11.2007, Orkane, Hurrikane und Tornados</title>
<pubdate>Tue, 13 Nov 2007 21:00:00 +0100</pubdate>
<description>Im Januar 2007 raste der Orkan Kyrill über Europa hinweg
und hinterließ eine Spur der Verwüstung. Im Oktober richtet ein Tornado
auf der Ferieninsel Mallorca großen Schaden an. Sind das die Vorboten
einer stürmischen Zukunft? Quarks & Co zeigt, was Klimaforscher
erwarten.; © WDR VideoPodcast</description>
<guid ispermalink="false">/wdr_fernsehen_quarks_und_co_20071113.mp4</guid>
<enclosure
url="http://medien.wdr.de/m/1194984000/quarks/wdr_fernsehen_quarks_und_co_20071113.mp4"
length="104681664" type="video/mp4">
</enclosure></item>
>>> item = items[0]
>>> enc = item.findChild('enclosure')
>>> enc['url']
u'http://medien.wdr.de/m/1194984000/quarks/wdr_fernsehen_quarks_und_co_20071113.mp4'
Code is:
from BeautifulSoup import BeautifulStoneSoup
soup = BeautifulStoneSoup(open('./quarks.xml','r').read())
items = soup.findAll('item')
item = items[0]
item.findChild('enclosure')
enc = item.findChild('enclosure')
enc.attrs
enc['url']
HTH
Duncan
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-users