Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Dumping to PlainText
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joe  
View profile  
 More options Mar 10 2009, 11:36 pm
From: Joe <qbpro...@gmail.com>
Date: Tue, 10 Mar 2009 20:36:57 -0700 (PDT)
Local: Tues, Mar 10 2009 11:36 pm
Subject: Dumping to PlainText
I'm trying to just dump plaintext from websites.  I was originally
trying to use this function: http://nltk.googlecode.com/svn/trunk/doc/api/nltk.util-module.html#cl...
but it was crashing.

After some googling, I found this:
http://www.experts-exchange.com/Programming/Languages/Regular_Express...

with this code:
import urllib2
from BeautifulSoup import BeautifulSoup as BSoup

page = urllib2.urlopen('http://somedomain/index.html').read()
soup = BSoup(page, convertEntities=BSoup.HTML_ENTITIES)

# only the text nodes between body tags.
print ''.join(soup.body(text=True))

Since BeautifulSoup seems to pride itself in being able to handle any
HTML, I wasn't expecting an error on the same url.  Here is the url
that I'm trying to extract text from: http://www.amazon.com/Pig-Big-Douglas-Florian/dp/0688171265

Any help would be great,
Joe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.