S
S
Sanya Hihi Haha2020-06-13 17:11:56
C++ / C#
Sanya Hihi Haha, 2020-06-13 17:11:56

How to search for an element in a c# tree?

Good afternoon, there is such a piece of Python code, it works fine for me, there are no problems with it, but I would like to rewrite it in c#

if 'Сменить интерфейс' in main_page.text and 'iframe-topline-table' in main_page.text:  # если активирована полная версия игры\
            print('была полная версия сайта,сменили')
            web_page = html.fromstring(main_page.content)
            for i in web_page.xpath('//a/@href'):

                if '?sr_method=changeInterface' in i:
                    change_i_link = i


What libraries do I need in this case?

As long as I don't have anything
var url = "https://steamcommunity.com/?l=russian";
            var httpClient = new HttpClient();
            var html = await httpClient.GetStringAsync(url);
            Console.WriteLine(html);


How can I go through the source (html) and extract the entire url from the href, for example, where it is - "browsefilter=mostrecent"

I'm not asking you to write for me, I need a kick (libraries, etc.)
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
edward_freedom, 2020-06-13
@ValarMayar

Use Html Agility Pack to work with html.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question