I try to parse a html page with PatternFindStr() to get the title/name/version of a Plugin.
But the script hangs in PatternFindStr(), the cpu goes to 100% and the script never ends before the first entry is found.
The script first downloads the Download.html file of the Hollywood plugins.
Maybe the patterns are wrong?
jPV helped me here for my ytSearch program, but sometimes ytSearch hangs in PatternFindStr().
Here it hangs all the time before the first entry with the download.html file.
I want to make a Updater program which shows the online versions of all plugins, then compares it with the local versions.
Code: Select all
@REQUIRE "hurl", {Link=True}
; <td><div id="info"><abbr title="Load and play AHX and HivelyTracker modules with Hollywood" rel="tooltip">i</abbr></div></td>
Local TITLE_START$ = [[<td><div id="info"><abbr title="]]
Local TITLE_END$ = [[" ]]
; <td>AHX</td>
Local NAME_START$ = [[<td>]]
Local NAME_END$ = [[</td>]]
;<td>1.3</td>
Local VERSION_START$ = [[<td>]]
Local VERSION_END$ = [[</td>]]
Local pat$ = TITLE_START$ .. "(.-)" .. TITLE_END$ .. ".-"
pat$ = pat$ .. NAME_START$ .. "(.-)" .. NAME_END$ .. ".-"
pat$ = pat$ .. VERSION_START$ .. "(.-)" .. VERSION_END$ .. ".-"
Function p_GetOnlineVersions()
Local cnt, err, buff$, len
DebugPrint("p_GetOnlineVersions")
buff$, len= DownloadFile("https://www.hollywood-mal.com/download.html", {Adapter = "hurl"})
;err, buff$, len = ?FileToString("download.html")
DebugPrint("len = "..len)
If len <= 0
DebugPrint("Failed to download the PlugIns versions!")
Else
cnt = 0
DebugPrint("pat$ = "..pat$)
For title$, name$, version$ In PatternFindStr(buff$, pat$)
DebugPrint("title$ = >"..title$.."< name$ = >"..name$.."< version$ = >"..version$.."<")
cnt=cnt+1 If cnt > 10 Then Break
Next
EndIf
EndFunction
p_GetOnlineVersions()
Code: Select all
s = 1 cnt = 0
While s > 0
s, e, title$, name$, version$ = PatternFindStrDirect(buff$, pat$, s+1)
If s > 0
DebugPrint("s = "..s.." e = "..e.." title$ = >"..title$.."< name$ = >"..name$.."< version$ = >"..version$.."<")
EndIf
cnt=cnt+1 If cnt > 10 Then Break
Wend