tags:

views:

34

answers:

2

I posted about this sort of earlier, but I am not sure how to post back to my original question as I can only comment or answer my own question.

Anyways, I need to get 4 links from a website, the latest stable build links for windows and linux, and the latest development build links for windows and linux (4 links total) within my C++ application.

I can download the page (http://www.sourcemod.net/snapshots.php) with LibCURL which is already implemented in the project, but after that I am not sure. I was looking at parsers, but I can't think of how I am going to discern link from link. Obviously using a parser I could get the first link from each table, but this does not seem efficient and would only provide me with the links to windows builds.

It looks like the links I need will be in the fourth in both tables, but I am just very familiar with a good way to go about this, so any help would be appreciated.

+1  A: 

Maybe you'll find the location of the actual downloads, http://www.sourcemod.net/smdrop/, easier to parse.

Thomas
Wow, somehow I didn't look there. That pretty much makes this a walk in the park compared to having to sort through all of the HTML. Still going to be an issue when the versions change (1.4 becomes stable, 1.5 becomes dev, etc) but for the time being this is great, thank you!
Brett Powell
Sorry it won't let me accept answer for 5 more minutes, I will make sure to get it shortly.
Brett Powell
Well, maybe you can assume that the highest number is the development version and the second-highest is the stable. Parsing unsemantic data is always going to rely on such assumptions anyway...
Thomas
A: 

I'm not too familiar with c++, but if you don't come across any better solutions there's BeautifulSoup for Python that is really nice for parsing Html and even deals with malformed documents well. And here's an highly rated CodeProject article on embedding Python in C/C++ that claims "This is written for programmers who are more experienced in C/C++ than in Python, the tutorial takes a practical approach and omits all theoretical discussions."

(I haven't read through it personally, as I mentioned, not terribly familiar with C++)

Davy8