471,330 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

BeautifulSoup - extract the <object tag

I'm trying to extract something like this:

<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/
swflash.cab#version=7,0,19,0" width=640 height=400>
<param name=movie value=url>
<param name=quality value=high><param name=SCALE value=showall>
<embed src=url quality=highpluginspage=http://www.macromedia.com/go/
getflashplayer type=application/x-shockwave-flash width=640 height=400
bgcolor=#000000 scale= showall>
</embed>
</object>

====
I don't know how I can get the param

# below don't work
for test in soup.fetch('object'):
print test # nothing

# nothing
print soup.findAll('param',{'name':'movie'})

# nothing
print soup.findAll('object')

Is it possible with BeautifulSoup to extract the object tag with his
child param ?
I have made everything in BeautifulSoup so I hope its possible :S

Thanks anyway,
GCMartijn

Jun 18 '07 #1
1 3230
In <11**********************@u2g2000hsc.googlegroups. com>, gcmartijn
wrote:
I'm trying to extract something like this:

<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/
swflash.cab#version=7,0,19,0" width=640 height=400>
<param name=movie value=url>
<param name=quality value=high><param name=SCALE value=showall>
<embed src=url quality=highpluginspage=http://www.macromedia.com/go/
getflashplayer type=application/x-shockwave-flash width=640 height=400
bgcolor=#000000 scale= showall>
</embed>
</object>

====
I don't know how I can get the param

# below don't work
for test in soup.fetch('object'):
print test # nothing
There's no `fetch()`.

In [15]: soup.fetch('object')
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most recent call last)

/home/new/<ipython console>

TypeError: 'NoneType' object is not callable
# nothing
print soup.findAll('param',{'name':'movie'})
Works for me:

In [16]: soup.findAll('param', {'name': 'movie'})
Out[16]:
[<param name="movie" value="url">
</param>]
# nothing
print soup.findAll('object')
This too:

In [17]: soup.findAll('object')
Out[17]:
[<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/
swflash.cab#version=7,0,19,0" width="640" height="400">
<param name="movie" value="url">
</param><param name="quality" value="high"></param><param name="SCALE" value="showall">
<embed src="url" quality="highpluginspage=http://www.macromedia.com/go/" getflashplayer="getflashplayer" type="application/x-shockwave-flash" width="640" height="400" bgcolor="#000000" scale="showall">
</embed>
</param></object>]

Ciao,
Marc 'BlackJack' Rintsch
Jun 18 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Wolfgang Schwanke | last post: by
6 posts views Thread by Christopher Benson-Manica | last post: by
4 posts views Thread by colson | last post: by
9 posts views Thread by Stephan Steiner | last post: by
4 posts views Thread by Alan Silver | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.