how can i use lxml with win32com?

Michiel Overtoom motoom at
Sun Oct 25 14:52:55 CET 2009

elca wrote:

> that is korea portal site and i was search keyword using 'korea times'
> and i want to scrap resulted to text name with 'blogscrap_save.txt'

Aha, now we're getting somewhere.

Getting and parsing that page is no problem, and doesn't need JavaScript 
or Internet Explorer.

import urllib2
import BeautifulSoup

By analyzing the structure of that page you can see that the articles 
are presented in an unordered list which has class "type01".  The 
interesting bit in each list item is encapsulated in a <dd> tag with 
class "sh_news_passage".  So, to parse the articles:

for li in ul.findAll("li"):
     print dd.renderContents()

This example prints them, but you could also save them to a file (or a 
database, whatever).


"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Valloppillil

More information about the Python-list mailing list