Jump to content

Have here more Fast possibility to read HTML


6105
 Share

Recommended Posts

Hi there,

to read page and go next i always use this function:

#include <Array.au3>
#include <IE.au3>
$oIE = _IECreate('http://autoitscript.com/forum')
$sHTML = _IEBodyReadHTML($oIE) ; read Body
$aFile = @TempDir&'au3test.tmp' ; create File
$wFile = FileWrite($aFile,$sHTML) ; write Body to File
$oFile = FileOpen($aFile, 0) ; open File

and then make some function to use site information like:

While 1
Local $aRead = FileReadLine($oFile)
If @error then ExitLoop
$aSearch = StringInStr($aRead,'<LI><SPAN')
If $aSearch > 0 Then
  $aArray = _StringBetween($aRead, 'href="', '"')
  _ArrayDisplay($aArray)
EndIf
WEnd

But this method i think is too slow, can someone give me some tips how i can make this function more fast?

Thanks if advance for any tips.. :oops:

EDIT: Fix code

Edited by 6105

[center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]

Link to comment
Share on other sites

What are you trying to accomplish exactly? Be more clear with your requests, I've noticed this trend in your posts. Not trying to be rude, and I would like to help, but you can help yourself with better posting practices. Define the issue and what you want as the outcome as a minimum.

EDIT:

For instance, what do you mean by this?

to read page and go next i always use this function:

Edited by danwilli
Link to comment
Share on other sites

Dear danwill,

i think here is my trouble,

i have take a look in Help file and found all what i need

_IELinkGetCollection, _IELinkClickByText and many.

Sorry for my question.. that is true spam :oops:

[center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]

Link to comment
Share on other sites

Well, i have remembered my question, question is how to simplify my code..

always i write body or text to file, have here some possibility to make it in memory?

i have _IEBodyReadText($oIE) or _IEBodyReadHTML($oIE)

how i can read each line without writing it to file?

Thank you and sorry for misunderstandings.

EDIT: with bold

Edited by 6105

[center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]

Link to comment
Share on other sites

Check out the example for _IELinkGetCollection()

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Thank you Dale,

by the way, i have resolved it using StringRegExp, now code is in 2 times faster))

EDIT: no more write,read,stringbetween. Just StringRegExp :oops:

Edited by 6105

[center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...