Forums > Javascript

js to read html source


Ad.
May 24, 2010 | 3:53 pm

Hi, Iam a beginer in javascript in max.
I would like to include in max some daily thoughts from html site, here’s the script :

Could you give me some clues to see those daylies sentences in js object ?

Thx in advance.

Ad.



Ad.
May 30, 2010 | 9:18 am

anybody ?


June 3, 2010 | 10:35 am

You don’t need JavaScript, but Jitter:

– Pasted Max Patch, click to expand. –


Ad.
June 3, 2010 | 12:01 pm

Thx Patrick.
Can you explain a little bit the " @re (.*) ? " (mean the entire @re, but I can’t paste it to my post…).

Thx.
Ad


June 3, 2010 | 1:20 pm

If you double click in jit.textfile, you’ll see the file received.

As you can see, the text you want is surrounded by a html tag.

So, what we want is between and

In regexp‘s syntax, blahblah can be represented by .*, which means "0 or more characters".
Then comes (.*), which mean: let’s memorize a string with "0 or more characters" followed by

This memorized string is sent thru jit.str.regexp‘s third outlet.

Et voilà.

p



Ad.
June 3, 2010 | 3:26 pm

merci à toi.
Ad÷


June 4, 2010 | 8:17 am

As I see with today’s message, there may be some extra work to do to replace the HTML character encoding (like today’s "ˆ") with ascii char (i.e. î). This can be done with regexp too, but there are a lot of char to convert… I suppose there are some JavaScript sources on the web to do that.



Ad.
June 10, 2010 | 3:40 pm

Hi again.
I’haven’t found any js to make this, so I’m gonna use jit.regexp according to http://www.octadyne.com/html_entity_acsii_table.cfm .

I make a try with the & u c i r c ; When I want to substitute it with the ù, a backreference error occurs…although it does work with "t" for instance………

Is there a way out from this problem ?
thx you in advance.

Ad.

Patch and html source:

Attachments:
  1. My.patch.zip

Viewing 8 posts - 1 through 8 (of 8 total)