How can I read from a website? [closed]

若如初见. 提交于 2019-12-31 07:49:06

问题


I'm trying to make a bot, how can I read the value like the 1800 / 1800 from a website?

            Console.WriteLine("Health: ")
            Console.WriteLine("Energy: ")
            Console.WriteLine("Cash: ")
            Console.WriteLine("Level: ")

I'm making a console application, trying to get the value. Like if the health is lower then 1000/1800 then it's going to execute a send key. Like send the key "0" to the website.

Thanks, Prince


回答1:


HTML Agility Pack is a good and popular toolkit to scrape information from web pages.

This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allows you to parse "out of the web" HTML files. The parser is very tolerant with "real world" malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).

For an introduction to using it have a look at:

http://runtingsproper.blogspot.com/2009/09/htmlagilitypack-article-series.html

If you get stuck at a particular step using it, by all means ask a new, detailed question on Stack Overflow.



来源:https://stackoverflow.com/questions/21764445/how-can-i-read-from-a-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!