The html on the site is as follows
Code: Select all
<a class="title" href="http://www.businessinsider.com/ap-the-latest-mnuchin-says-us-china-putting-trade-war-on-hold-2018-5">MNUCHIN: The US-China trade war is 'on hold'</a>
The issue is I need to be able to get it at once to store it my db
so im hoping the loop runs and gives me one variable that has the title the other the url
I suspect this has to be one of the most common things people do, but I tried hard to find a ahk solution but couldn't.
Thanks for your time
Code: Select all
FileDelete, TempFile96.txt
Output := ""
UrlDownloadToFile, % "http://www.businessinsider.com/", TempFile96.txt
FileRead, HTML, TempFile96.txt
Needle := "<a class=""title[^>]+>(?P<Name>[^<]+)"
Pos := 1
While (Pos := RegExMatch(HTML, Needle, Match, Pos + StrLen(Match)))
Output .= MatchName "`r`n"
msgbox, % output
Needle2 := "<a class=""title"" href=""(?P<Name2>[^""]+)"
Pos2 := 1
While (Pos2 := RegExMatch(HTML, Needle2, Match2, Pos2 + StrLen(Match2)))
Output2 .= Match2Name2 "`r`n"
msgbox, % output2
ExitApp