Archive: Parsing File Links on a Webpage

Parsing File Links on a Webpage

I've been working on making a "latest Sourcemod + Metamod" installer, but reading their RSS was a misery and thought to grab the url instead from one of their mirrors.

But I just don't know how to read it the file versions ( ) and compare them in-order to get the latest version.


If the numbers in version strings go from 0 to 9 then simply do this (pseudo-code):

declare_variable MaxVersion is 0

while(not end)
read_line into Variable // line - ""
declare_variable Version

// Now parse read Variable:
for(I is 0 to length of Line)
get_character at position I
if character_is_numeral // allow only 0 .. 9
Append Character to Version
// In this point you have number - "192"
if MaxVersion is less or equal Version
set MaxVersion to Version

// Now you have found the largest version - 192

As you can see it is pretty simple but you should store e.g. whole string "" or do additional steps to recognize mac/linux/windows edition and so on.