Using Beautiful Soup to entangle bookmarks.html

George Sakkis george.sakkis at gmail.com
Thu Sep 7 20:58:31 EDT 2006


Francach wrote:
> Hi,
>
> I'm trying to use the Beautiful Soup package to parse through the
> "bookmarks.html" file which Firefox exports all your bookmarks into.
> I've been struggling with the documentation trying to figure out how to
> extract all the urls. Has anybody got a couple of longer examples using
> Beautiful Soup I could play around with?
>
> Thanks,
> Martin.

from BeautifulSoup import BeautifulSoup
urls = [tag['href'] for tag in
        BeautifulSoup(open('bookmarks.html')).findAll('a')]

Regards,
George




More information about the Python-list mailing list