Reputation: 25959
I want to create a web service in ASP.NET that fetches data from a website every hour or so (the storing part I got it covered). In this example, metacritic.com, how can I get the Users score of a movie at any given time interval?
What I know is, I would have to get the source of the website and then find the html element that contains the data I want (by name in the best of the cases) but I don't know how to do it.
Thanks in advance for any help!
alt text http://img354.imageshack.us/img354/9351/200907030136.png
Upvotes: 1
Views: 335
Reputation:
For the HTTP request side of things, WebClient
is probably the easiest.
For a simple, blocking HTTP request, do this:
string page = (new WebClient()).DownloadString("http://foo.bar/page");
Upvotes: 2
Reputation: 10638
Use the HttpWebRequest class to open the site, then search the returned Response for the specific HTML element , probably using something like
responsestring.IndexOf("class=\"scoreelemementclass\"")
Upvotes: 1
Reputation: 12336
You can send an http request and parse the output html to retrieve the value. Otherwise you can try to find out, if MetaCritic has a webservice itself, what I think is reasonable because Steam includes MetaCritic scores too.
Best Regards
Oliver Hanappi
Upvotes: 2
Reputation: 19636
You need to make a HTTP request to the website and then parse the HTML source by identifying unique flags around the variable score.
Upvotes: 1