BeautifulSoup - extract the <object tag

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gcmartijn@gmail.com

    #1

    BeautifulSoup - extract the <object tag

    I'm trying to extract something like this:

    <object classid=clsid:D 27CDB6E-AE6D-11cf-96B8-444553540000
    codebase="http://download.macrom edia.com/pub/shockwave/cabs/flash/
    swflash.cab#ver sion=7,0,19,0" width=640 height=400>
    <param name=movie value=url>
    <param name=quality value=high><par am name=SCALE value=showall>
    <embed src=url quality=highplu ginspage=http://www.macromedia. com/go/
    getflashplayer type=applicatio n/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('obj ect'):
    print test # nothing

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

    # nothing
    print soup.findAll('o bject')

    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

  • Marc 'BlackJack' Rintsch

    #2
    Re: BeautifulSoup - extract the &lt;object tag

    In <1182192028.173 189.168910@u2g2 000hsc.googlegr oups.com>, gcmartijn
    wrote:
    I'm trying to extract something like this:
    >
    <object classid=clsid:D 27CDB6E-AE6D-11cf-96B8-444553540000
    codebase="http://download.macrom edia.com/pub/shockwave/cabs/flash/
    swflash.cab#ver sion=7,0,19,0" width=640 height=400>
    <param name=movie value=url>
    <param name=quality value=high><par am name=SCALE value=showall>
    <embed src=url quality=highplu ginspage=http://www.macromedia. com/go/
    getflashplayer type=applicatio n/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('obj ect'):
    print test # nothing
    There's no `fetch()`.

    In [15]: soup.fetch('obj ect')
    ---------------------------------------------------------------------------
    exceptions.Type Error Traceback (most recent call last)

    /home/new/<ipython console>

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

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

    In [17]: soup.findAll('o bject')
    Out[17]:
    [<object classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macrom edia.com/pub/shockwave/cabs/flash/
    swflash.cab#ver sion=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="highpl uginspage=http://www.macromedia. com/go/" getflashplayer= "getflashplayer " type="applicati on/x-shockwave-flash" width="640" height="400" bgcolor="#00000 0" scale="showall" >
    </embed>
    </param></object>]

    Ciao,
    Marc 'BlackJack' Rintsch

    Comment

    Working...