BeautifulSoup - extract the <object tag

G

gcmartijn

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
 
M

Marc 'BlackJack' Rintsch

gcmartijn said:
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">
# 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top