Copy elements to new file

J

JoJo

Hello:


I am looking for a script that I can use to extract specific pieces of
information from an HTML document.
My document is 100 pages long & is located at
http://www.geocities.com/boomerangtrades/Motherlode.htm

I like the idea of embedding a JavaScript into the HTML code, but I would
welcome any other type of solution.
I am trying to extract the titles of articles (that all begin with the ">>"
characters) and copy them to a new file.


Thanks,
JoJo
 
R

Reventlov

I am looking for a script that I can use to extract specific pieces of
information from an HTML document.
My document is 100 pages long & is located at
http://www.geocities.com/boomerangtrades/Motherlode.htm

I like the idea of embedding a JavaScript into the HTML code, but I would
welcome any other type of solution.
I am trying to extract the titles of articles (that all begin with the ">>"
characters) and copy them to a new file.

You could download the page with

Sub DownloadWithXMLHTTP (sSource,sDest)
'Download a file using activeX Object XMLHTTP
'and save to sDest using ADO Stream
set oHTTP = WScript.CreateObject("Microsoft.XMLHTTP")
oHTTP.open "GET", sSource, False
oHTTP.send
set oStream = createobject("adodb.stream")
Const adTypeBinary = 1
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2
oStream.type = adTypeBinary
oStream.open
oStream.write oHTTP.responseBody
oStream.savetofile sDest, adSaveCreateOverWrite
set oStream = nothing
set oHTTP = nothing
end sub

Where sSource is the url and sDest a filename where to put the htm page.

Then parse the file in search of the >>.
You could split the content and get the lines with >> using instr.
 

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

Top