parsing web pages

C

Carl

With python I can pull a web page using urllib2 and then parse it
using BeautifulSoup. Is there any similar functionality in javascript
that will allow me to do the same thing?
 
T

Thomas 'PointedEars' Lahn

Carl said:
With python I can pull a web page using urllib2 and then parse it
using BeautifulSoup. Is there any similar functionality in javascript
that will allow me to do the same thing?

Server-side: yes. Client-side: Yes, when using XHR with the same protocol,
domain, and port (Same Origin Policy).

What do you want to achieve?


PointedEars
 
R

Richard Cornford

Carl said:
With python I can pull a web page using urllib2 and then
parse it using BeautifulSoup. Is there any similar
functionality in javascript that will allow me to do
the same thing?

Yes and no. There is nothing built into the language directly for that task.
Indeed there is nothing built into the language directly for any task except
URI encoding. You certainly could write an HTML tag soup parser with
javascript, though most would probably prefer not to (and it would be
unrealistic to expect the result to perform at all well).

On the other hand, most javascript is used in web browser environments, and
if there is one thing that web browsers are good at it is loading HTML given
URLs, parsing the result and building an HTML DOM with it.

Richard.
 

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

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,371
Latest member
Brkaa

Latest Threads

Top