0

我想知道如何从 http 响应内容中提取特定值。假设我发出 getAsync 请求的页面返回响应,在该响应中我需要提取密码的值。如何在此 getAsync 方法中获取网站密码的值?

这是我的代码:

  async static void DownloadPage(string url)
    {
        CookieContainer cookies = new CookieContainer();
        HttpClientHandler handler = new HttpClientHandler();
        handler.CookieContainer = cookies;

        using (HttpClient client = new HttpClient(handler))
        {
            using (HttpResponseMessage response = client.GetAsync("https://www.kijiji.ca/t-login.html").Result)
            {

                HttpHeaders headers = response.Headers;
                HttpContent content = response.Content;
                string myContent = await content.ReadAsStringAsync();



            }

        }

这是我得到的回复:

    <!DOCTYPE html>
<!--[if lte IE 8]><html id="reset" class="ie8"><![endif]-->
<!--[if IE 9]><html id="reset" class="ie9"><![endif]-->
<!--[if gt IE 9]><!--><html id="reset"><!--<![endif]-->
<!--[if !IE]><!--><html id="reset"><!--<![endif]-->
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Kijiji Canada | Free local classifieds</title>
    <link rel="SHORTCUT ICON" href="//ca.classistatic.com/static/V/2918.2/img/kijijiFavicon.ico" type="image/vnd.microsoft.icon"/>
    <link rel="publisher" href="https://plus.google.com/+KijijiCanada" />
    <meta property="og:site_name" content="Kijiji"/>
    <meta property="og:country-name" content="Canada"/>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>

<meta name="msvalidate.01" content="E03E7C8B4B4E1A0234A8D2042FD326E8" />

<meta name='yandex-verification' content='79bdb66f55dcb3ee' />

    <meta name="google" content="nositelinkssearchbox">

    <meta http-equiv="content-language" content="en">

 ad Here</span></h4></a></li>
        <li class="ie"><a href="http://windows.microsoft.com/en-ca/internet-explorer/download-ie" target="_blank"><h4>Internet Explorer<span>Download Here</span></h4></a></li>
    </ul>
</div>
<![endif]-->

<header class="">
            <div id="TopHeader">
        <div id="HeaderLeft">
            <a href="/" id="Logo" target="_self" title="Kijiji"></a>
            <div id="AdCount">
                Over <span id="AdCountNumber">7,479,986</span> Free Local Classifieds</div>
        </div>

        <div id="HeaderRight">
            <ul id="HeaderRightTop">
                <li><a id="SignInLink" href="/t-login.html" rel="nofollow">Sign In</a></li>
                        <li><a id="register" href="/t-user-registration.html" rel="nofollow">Register</a></li>
                    <li><a href="http://help.kijiji.ca/helpdesk/" rel="nofollow">Help Desk</a></li>

                <li><a id="ChangeLocale" rel="nofollow" href="javascript:void(0);">Français</a></li>
                </ul>

            <div id="HeaderRightBottom">
                <a id="PostAdLink" class="button-open post-ad-begin first" href="/p-select-category.html" data-btn-loc="header" rel="nofollow">
                    Post Ad</a><a class="button-header-nav last" href="/m-my-ads.html" rel="nofollow">
                My Kijiji</a>
            </div>
        </div>

        </div>
<div id="HeaderBar">
                <div id="BrowseContainer">
    <div class="text">
        Browse Categories</div>
    <div class="action"><div></div></div>

    <div id="BrowseCategoriesList" class="drop-down">
        <ul>
            <li><a href="/b-buy-sell/canada/c10l0" class="category-selected" data-id="10">buy and sell</a></li>
            <li><a href="/b-services/canada/c72l0" class="category-selected" data-id="72">services</a></li>
            <li><a href="/b-cars-vehicles/canada/c27l0" class="category-selected" data-id="27">cars &amp; vehicles</a></li>
            <li><a href="/b-pets/canada/c112l0" class="category-selected" data-id="112">pets</a></li>
            <li><a href="/b-vacation-rentals/c800l0" class="category-selected" data-id="800">vacation rentals</a></li>
            <li><a href="/b-community/canada/c1l0" class="category-selected" data-id="1">community</a></li>
            <li><a href="/b-real-estate/canada/c34l0" class="category-selected" data-id="34">real estate</a></li>
            <li><a href="/b-jobs/canada/c45l0" class="category-selected" data-id="45">jobs</a></li>
            <li><a href="/b-canada/l0?ad=wanted" class="" data-id="1000000">Want Ads</a></li>
            <li><a href="/b-canada/l0?ad=offering&price-type=free" class="" data-id="1000001">Free Stuff</a></li>
            <li><a href="/b-canada/l0?price-type=swap-trade" class="" data-id="1000002">Swap / Trades</a></li>
            </ul>
    </div>
</div>

<div id="SearchFormContainer">
    <form id="SearchForm" action="/b-search.html">
        <label class="search-input" for="SearchInput">Search</label>

        <div id="SearchContainer">
            <input type="hidden" id="SearchLocationId" name="locationId"
                   value="0"/>
            <input type="hidden" value=""
            name="categoryId" id="SearchCategoryValue"/>
            <input type="hidden" id="ASOtherLang" value="fr_CA"/>
            <input type="hidden" name="formSubmit" value="true"/>
            <input type="hidden" name="urgentOnly" value="false"/>
            <input type="hidden" name="highlightOnly" value="false"/>
            <input type="hidden" name="gpTopAd" value="false"/>
            <input type="hidden" name="hpGallery" value="false"/>
            <input type="hidden" name="minPrice" value=""/>
            <input type="hidden" name="maxPrice" value=""/>
            <input type="hidden" name="adType" value=""/>
            <input type="hidden" name="adPriceType" value=""/>
            <input type="hidden" name="sortByName" value="dateDesc"/>
            <div class="active" id="InputContainer">
                <input id="SearchInput" type="text" name="keywords" autocomplete="off" autofocus value="">
                <div id="InputClear"><div>X</div></div>
                <div id="SuggestedSearchesContainer" class="drop-down"></div>
                    </div>
        </div>

        <div id="SearchInContainer">
            <label>in</label>
            <div class="action" id="SearchGoButton">GO</div>
            <div id="SearchIn">
                <div id="SearchCategorySelected">
                    All Ads</div>

                <div id="SearchInList" class="drop-down">
                    <ul>
                        <li class="search-category-entry">
                            <a class="c-lnk-mslctbx" href="#" id="0">All Ads</a>
                        </li>
                        <li class="search-category-entry"><a class="c-lnk-mslctbx" href="#" id="10">
                                buy and sell</a>
                            </li>
                        <li class="search-category-entry"><a class="c-lnk-mslctbx" href="#" id="72">
                                services</a>
                            </li>
                        <li class="search-category-entry"><a class="c-lnk-mslctbx" href="#" id="27">
                                cars &amp; vehicles</a>
                            </li>
                        <li class="search-category-entry"><a class="c-lnk-mslctbx" href="#" id="112">
                                pets</a>
                            </li>
                        <li class="search-category-entry"><a class="c-lnk-mslctbx" href="#" id="800">
                                vacation rentals</a>
                            </li>
                        <li class="search-category-entry"><a class="c-lnk-mslctbx" href="#" id="1">
                                community</a>
                            </li>
                        <li class="search-category-entry"><a class="c-lnk-mslctbx" href="#" id="34">
                                real estate</a>
                            </li>
                        <li class="search-category-entry"><a class="c-lnk-mslctbx" href="#" id="45">
                                jobs</a>
                            </li>
                        </ul>
                </div>
            </div>
        </div>
    </form>
</div>

<div id="LocationPickerContainer">
    <label>
                My Location<strong>&nbsp;Canada</strong>
            </label>
        </div>



</div>
        </header>
    <div id="MessageContainer">
        </div>

    <div class="layout-0 fixed-width top-space bottom-space">
        <div class="layout-2">
            <div class="col-2">
                <div class="container-info bottom-space">
                    <h2>Register an account</h2>
                    <p>Make it easier to manage & post Ads.</p>
                    <a href="/t-user-registration.html">
                        <button id="RegisterButton" class="button-open next">Register Now<span class="arrow-next"></span></button>
                    </a>
                </div>
                <div class="container-info">
                    <h2>Don&#39;t have an account?</h2>
                    <p>Manage your ads using just your email address.</p>
                    <ul class="bullet-list">
                        <li><a href="/p-select-category.html" class="post-ad-begin" data-btn-loc="login">Post an Ad</a></li>
                        <li><a href="/m-ad-digest-mail.html">Promote your Ads</a></li>
                        <li><a href="/m-ad-digest-mail.html">Edit your Ad</a></li>
                        <li><a href="/m-ad-digest-mail.html">Remove your Ad</a></li>
                        <li><a href="/m-watch-list.html" id="MyWatchlist">My Watchlist</a></li>
                    </ul>
                </div>
            </div>
            <div class="col-1">
                <div class="container-admin">
                    <div class="container-info">
                        <form id="login-form" class="special track-form-flow" data-action-title="UserLogin" action="/t-login.html" method="post"><input type="hidden" id="" name="ca.kijiji.xsrf.token" value="1470364908850.173dd2f5deb987261b6cfc4c4f5dad22" />
<div class="circles">
                                <h1>Sign In</h1>
                                <input id="targetUrl" name="targetUrl" type="hidden" value="L15udS9JWHhHMURBNmdjdkFuTFJJeUR3PT0-"/><section>
                                    <label for="LoginEmailOrNickname">
                                        Email Address or Nickname:</label>
                                    <input id="LoginEmailOrNickname" name="emailOrNickname" req="req" type="text" value="" maxlength="128"/><span class="field-message" data-for="LoginEmailOrNickname"></span>
                                    </section>


                                <section>
                                    <label for="login-password">
                                        Password:</label>
                                    <input id="login-password" name="password" req="req" type="password" value="" maxlength="64"/><span class="field-message" data-for="login-password"></span>
                                    <a id="LoginForgottenPassword" href="/t-forgot-password.html">
                                        Forgot your password?</a>
                                </section>

                                <section class="input-offset">
                                    <label>
                                        <input id="login-rememberMe" name="rememberMe" class="ext-uncheck" type="checkbox" value="true" checked="checked"/><input type="hidden" name="_rememberMe" value="on"/>Keep me signed in</label>
                                </section>

                                <button id="SignInButton" class="button-task" type="submit">Sign In</button>
                            </div>
                            <div class="fb-login disabled">
                                <p><strong>Did you register for Kijiji through Facebook?</strong></p>
                                        <p>Our Facebook log in has been disabled to make way for a more customized experience on Kijiji. To log in you must change your password. <a href="http://help.kijiji.ca/helpdesk/basics/facebook-login-removal" target="_blank">Learn More</a></p>
                                        <p><a href="/t-forgot-password.html">Change your password</a></p>
                                    </div>
                        </form><p class="safety-message">
                            <strong>Protect your account:</strong>
                            Ensure that whenever you sign in to Kijiji, the Web address in your browser starts with https://www.kijiji.ca/</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div> 
          <div class="fes-pagelet">
            <div id=footer><div id="Footer" class="container--jss-0-703" data-reactid=".282hd8ogglc"><div class="innerWrapper--jss-0-704" data-reactid=".282hd8ogglc.0"><div id="FooterLinkColumns" class="container--jss-0-680" data-reactid=".282hd8ogglc.0.0"><div data-reactid=".282hd8ogglc.0.0.0"><div class="column--jss-0-681" width="20%" style="width:20%;" data-reactid=".282hd8ogglc.0.0.0.$=10"><h3 class="columnTitle--jss-0-682" data-reactid=".282hd8ogglc.0.0.0.$=10.0">Kijiji Information</h3><ul class="columnList--jss-0-683" data-reactid=".282hd8ogglc.0.0.0.$=10.1"><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=10.1.0"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/policies/kijiji-terms-of-use" data-reactid=".282hd8ogglc.0.0.0.$=10.1.0.0">Terms of Use</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=10.1.1"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/policies/kijiji-privacy-policy" data-reactid=".282hd8ogglc.0.0.0.$=10.1.1.0">Privacy Policy</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=10.1.2"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/policies/" data-reactid=".282hd8ogglc.0.0.0.$=10.1.2.0">Posting Policy</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=10.1.3"><a class="link--jss-0-686" rel="nofollow" href="http://www.kijijiforbusiness.ca" data-reactid=".282hd8ogglc.0.0.0.$=10.1.3.0">Advertise with Us</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=10.1.4"><a class="link--jss-0-686 adChoice--jss-0-685 ad-choice" rel="" href="javascript:void(0)" data-reactid=".282hd8ogglc.0.0.0.$=10.1.4.0">AdChoice</a></li></ul></div><div class="column--jss-0-681" width="20%" style="width:20%;" data-reactid=".282hd8ogglc.0.0.0.$=11"><h3 class="columnTitle--jss-0-682" data-reactid=".282hd8ogglc.0.0.0.$=11.0">Kijiji Support</h3><ul class="columnList--jss-0-683" data-reactid=".282hd8ogglc.0.0.0.$=11.1"><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=11.1.0"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/" data-reactid=".282hd8ogglc.0.0.0.$=11.1.0.0">Help Desk</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=11.1.1"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/safety/safety-at-kijiji" data-reactid=".282hd8ogglc.0.0.0.$=11.1.1.0">Online Safety Tips</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=11.1.2"><a class="link--jss-0-686" rel="nofollow" href="http://www.kijiji.ca/pages/pricechecker/" data-reactid=".282hd8ogglc.0.0.0.$=11.1.2.0">Price Checker</a></li></ul></div><div class="column--jss-0-681" width="20%" style="width:20%;" data-reactid=".282hd8ogglc.0.0.0.$=12"><h3 class="columnTitle--jss-0-682" data-reactid=".282hd8ogglc.0.0.0.$=12.0">Kijiji Autos</h3><ul class="columnList--jss-0-683" data-reactid=".282hd8ogglc.0.0.0.$=12.1"><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=12.1.0"><a class="link--jss-0-686" rel="nofollow" href="/t-dealer-registration.html" data-reactid=".282hd8ogglc.0.0.0.$=12.1.0.0">New Dealer Signup</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=12.1.1"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/policies/why-use-kijiji-autos" data-reactid=".282hd8ogglc.0.0.0.$=12.1.1.0">Dealer Help Pages</a></li></ul></div><div class="column--jss-0-681" width="20%" style="width:20%;" data-reactid=".282hd8ogglc.0.0.0.$=13"><h3 class="columnTitle--jss-0-682" data-reactid=".282hd8ogglc.0.0.0.$=13.0">Explore Kijiji</h3><ul class="columnList--jss-0-683" data-reactid=".282hd8ogglc.0.0.0.$=13.1"><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=13.1.0"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/basics/benefits-of-registering" data-reactid=".282hd8ogglc.0.0.0.$=13.1.0.0">Kijiji Member Benefits</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=13.1.1"><a class="link--jss-0-686" rel="nofollow" href="http://kijijiblog.ca/about-us/" data-reactid=".282hd8ogglc.0.0.0.$=13.1.1.0">About Kijiji</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=13.1.2"><a class="link--jss-0-686" rel="nofollow" href="https://kijijiportraits.kijiji.ca" data-reactid=".282hd8ogglc.0.0.0.$=13.1.2.0">Kijiji Portraits</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=13.1.3"><a class="link--jss-0-686" rel="nofollow" href="https://jobs.ebayinc.com/jobs?keywords=Kijiji&amp;lng=-79.4163&amp;lat=43.70011&amp;page=1&amp;location=Toronto,%20ON,%20Canada" data-reactid=".282hd8ogglc.0.0.0.$=13.1.3.0">Careers</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=13.1.4"><a class="link--jss-0-686" rel="nofollow" href="http://www.ebayclassifiedsgroup.com/brands.html" data-reactid=".282hd8ogglc.0.0.0.$=13.1.4.0">eBay Classifieds Sites</a></li></ul></div><div class="column--jss-0-681" width="20%" style="width:20%;" data-reactid=".282hd8ogglc.0.0.0.$=14"><h3 class="columnTitle--jss-0-682" data-reactid=".282hd8ogglc.0.0.0.$=14.0">Frequently Asked Questions</h3><ul class="columnList--jss-0-683" data-reactid=".282hd8ogglc.0.0.0.$=14.1"><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=14.1.0"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/basics/benefits-of-promoting-ads" data-reactid=".282hd8ogglc.0.0.0.$=14.1.0.0">How do I get people to see my Ad?</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=14.1.1"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/technical-issue/where-is-my-ad" data-reactid=".282hd8ogglc.0.0.0.$=14.1.1.0">Where is my Kijiji Ad? I can&#x27;t find it.</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=14.1.2"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/basics/editing-my-ad" data-reactid=".282hd8ogglc.0.0.0.$=14.1.2.0">How can I change my Ad?</a></li><li class="columnListItem--jss-0-684" data-reactid=".282hd8ogglc.0.0.0.$=14.1.3"><a class="link--jss-0-686" rel="nofollow" href="http://help.kijiji.ca/helpdesk/basics/deleting-my-ad" data-reactid=".282hd8ogglc.0.0.0.$=14.1.3.0">How do I delete my Ad?</a></li></ul></div></div></div><div id="FooterBadgeColumns" class="container--jss-0-690" data-reactid=".282hd8ogglc.0.1"><div data-reactid=".282hd8ogglc.0.1.0"><div class="column--jss-0-691 storeColumn--jss-0-695" width="20%" style="width:20%;" data-reactid=".282hd8ogglc.0.1.0.$=10"><a class="link--jss-0-692" href="https://itunes.apple.com/ca/app/kijiji-free-local-classifieds/id318979520" target="_blank" rel="nofollow" data-reactid=".282hd8ogglc.0.1.0.$=10.0"><svg class="icon--jss-0-510" width="115" height="40" aria-labelledby="title" role="img" data-reactid=".282hd8ogglc.0.1.0.$=10.0.0"><title data-reactid=".282hd8ogglc.0.1.0.$=10.0.0.0"></title><use xlink:href="#ios-app-store" data-reactid=".282hd8ogglc.0.1.0.$=10.0.0.1"></use></svg><span class="linkText--jss-0-694" data-reactid=".282hd8ogglc.0.1.0.$=10.0.1"></span></a></div><div class="column--jss-0-691 storeColumn--jss-0-695" width="20%" style="width:20%;" data-reactid=".282hd8ogglc.0.1.0.$=11"><a class="link--jss-0-692" href="https://play.google.com/store/apps/details?id=com.ebay.kijiji.ca" target="_blank" rel="nofollow" data-reactid=".282hd8ogglc.0.1.0.$=11.0"><svg class="icon--jss-0-510" width="115" height="40" aria-labelledby="title" role="img" data-reactid=".282hd8ogglc.0.1.0.$=11.0.0"><title data-reactid=".282hd8ogglc.0.1.0.$=11.0.0.0"></title><use xlink:href="#google-play" data-reactid=".282hd8ogglc.0.1.0.$=11.0.0.1"></use></svg><span class="linkText--jss-0-694" data-reactid=".282hd8ogglc.0.1.0.$=11.0.1"></span></a></div><div class="column--jss-0-691" width="20%" style="width:20%;" data-reactid=".282hd8ogglc.0.1.0.$=12"><a class="link--jss-0-692" href="http://kijijiblog.ca/" target="_blank" data-reactid=".282hd8ogglc.0.1.0.$=12.0"><svg class="icon--jss-0-510" width="40" height="40" aria-labelledby="title" role="img" data-reactid=".282hd8ogglc.0.1.0.$=12.0.0"><title data-reactid=".282hd8ogglc.0.1.0.$=12.0.0.0"></title><use xlink:href="#rss-feed" data-reactid=".282hd8ogglc.0.1.0.$=12.0.0.1"></use></svg><span class="linkText--jss-0-694" data-reactid=".282hd8ogglc.0.1.0.$=12.0.1">Visit us on our Blog</span></a></div><div class="column--jss-0-691" width="20%" style="width:20%;" data-reactid=".282hd8ogglc.0.1.0.$=13"><a class="link--jss-0-692" href="http://www.facebook.com/Kijiji.ca" target="_blank" rel="nofollow" data-reactid=".282hd8ogglc.0.1.0.$=13.0"><svg class="icon--jss-0-510" width="40" height="40" aria-labelledby="title" role="img" data-reactid=".282hd8ogglc.0.1.0.$=13.0.0"><title data-reactid=".282hd8ogglc.0.1.0.$=13.0.0.0"></title><use xlink:href="#facebook" data-reactid=".282hd8ogglc.0.1.0.$=13.0.0.1"></use></svg><span class="linkText--jss-0-694" data-reactid=".282hd8ogglc.0.1.0.$=13.0.1">Friend us on Facebook</span></a></div><div class="column--jss-0-691" width="20%" style="width:20%;" data-reactid=".282hd8ogglc.0.1.0.$=14"><a class="link--jss-0-692" href="http://www.youtube.com/kijijicanadacorp" target="_blank" rel="nofollow" data-reactid=".282hd8ogglc.0.1.0.$=14.0"><svg class="icon--jss-0-510" width="40" height="40" aria-labelledby="title" role="img" data-reactid=".282hd8ogglc.0.1.0.$=14.0.0"><title data-reactid=".282hd8ogglc.0.1.0.$=14.0.0.0"></title><use xlink:href="#youtube" data-reactid=".282hd8ogglc.0.1.0.$=14.0.0.1"></use></svg><span class="linkText--jss-0-694" data-reactid=".282hd8ogglc.0.1.0.$=14.0.1">Watch us on YouTube</span></a></div></div></div><div class="copyright--jss-0-705" data-reactid=".282hd8ogglc.0.2"><span data-reactid=".282hd8ogglc.0.2.0">Copyright © 2016 eBay International AG. All rights reserved.</span><span class="fineprint--jss-0-706" data-reactid=".282hd8ogglc.0.2.1">Google, Google Play, YouTube and other marks are trademarks of Google Inc.</span></div></div></div><script type="text/javascript" id=".282hd8ogglc.script">
        if (!document.querySelector) throw new Error("react-dom-stream requires document.querySelector. If using IE8 or IE9, please make sure you are in standards mode by including <!DOCTYPE html>");
        document.querySelector('[data-reactid=".282hd8ogglc"]').setAttribute("data-react-checksum", -1685488400);
        var s = document.getElementById(".282hd8ogglc.script");
        s.parentElement.removeChild(s);
      </script></div>
            <script type="text/javascript">if(rehydrate===undefined){var rehydrate={};}rehydrate["footer"]={componentPath:"Shared/Footer",props:{}};</script>
          </div>
        <div class="modal-overlay"></div>


    <div id="FesLoader">

      <script type="text/javascript">window.__data="[\"~#iM\",[\"config\",[\"^0\",[\"toggleHeader\",false,\"showAdmarktLink\",false,\"showSearch\",true,\"toggleResponsive\",false,\"changeLocationURL\",null,\"searchForm\",[\"^0\",[\"attributeMap\",[\"^0\",[]],\"ll\",null,\"highlightOnly\",false,\"sortByName\",\"dateDesc\",\"adPriceType\",null,\"adIdRemoved\",null,\"maxPrice\",null,\"attributeFiltersMax\",[\"^0\",[]],\"userId\",null,\"origin\",null,\"categoryName\",\"\",\"keywords\",null,\"searchView\",\"LIST\",\"urgentOnly\",false,\"cpoOnly\",false,\"gpTopAd\",false,\"locationId\",0,\"radius\",\"\",\"attributeFiltersMin\",[\"^0\",[]],\"address\",\"Canada\",\"noLocation\",false,\"minPrice\",null,\"pageNumber\",1,\"categoryId\",null,\"locationPath\",\"0\",\"carproofOnly\",false]],\"adCount\",7479986,\"userLoggedIn\",false,\"language\",\"en\",\"targetUrl\",\"L3QtbG9naW4uaHRtbF5hQlNjOXlnVTkyelBsZjROYytCUXV3PT0-\"]],\"locationPicker\",[\"^0\",[]],\"postAd\",[\"^0\",[\"helpOffsetTop\",0,\"focusedStep\",null,\"loaded\",false,\"submitting\",false,\"steps\",[\"~#iL\",[]],\"isAsyncValid\",false,\"packages\",[\"^0\",[\"compare\",[\"^1\",[\"basic\",\"visibility\",\"maxVisibility\"]],\"frozen\",true,\"items\",[\"^0\",[\"basic\",[\"^0\",[\"id\",\"\",\"name\",null,\"heading\",null,\"subheading\",null,\"callout\",false,\"smallestMonthlyPrice\",0,\"showBenefits\",false,\"benefits\",[\"^1\",[]]]],\"hassleFree\",[\"^0\",[\"id\",\"PKG_HASSLE_FREE\",\"name\",null,\"heading\",null,\"subheading\",null,\"callout\",false,\"smallestMonthlyPrice\",null,\"showBenefits\",false,\"benefits\",[\"^1\",[]]]],\"visibility\",[\"^0\",[\"id\",\"PKG_VISIBILITY\",\"name\",null,\"heading\",null,\"subheading\",null,\"callout\",true,\"smallestMonthlyPrice\",null,\"showBenefits\",false,\"benefits\",[\"^1\",[]]]],\"maxVisibility\",[\"^0\",[\"id\",\"PKG_MAX_VISIBILITY\",\"name\",null,\"heading\",null,\"subheading\",null,\"callout\",false,\"smallestMonthlyPrice\",null,\"showBenefits\",false,\"benefits\",[\"^1\",[]]]]]],\"loaded\",false,\"selected\",null]],\"isValid\",false,\"isSyncValid\",false,\"editing\",false,\"fields\",[\"^0\",[\"category\",[\"^0\",[\"syncErrors\",[\"~#iS\",[]],\"errors\",[\"^2\",[]],\"hasErrors\",false,\"isAsyncValid\",true,\"isSyncValid\",true,\"isValid\",true]],\"description\",[\"^0\",[\"syncErrors\",[\"^2\",[]],\"errors\",[\"^2\",[]],\"hasErrors\",false,\"isAsyncValid\",true,\"isSyncValid\",true,\"isValid\",true]],\"postalCode\",[\"^0\",[\"syncErrors\",[\"^2\",[\"ad.validation.postalCode.postalCode\"]],\"errors\",[\"^2\",[\"ad.validation.postalCode.postalCode\"]],\"hasErrors\",false,\"isAsyncValid\",true,\"isSyncValid\",false,\"isValid\",false]],\"price\",[\"^0\",[\"syncErrors\",[\"^2\",[]],\"errors\",[\"^2\",[]],\"hasErrors\",false,\"isAsyncValid\",true,\"isSyncValid\",true,\"isValid\",true]],\"title\",[\"^0\",[\"syncErrors\",[\"^2\",[]],\"errors\",[\"^2\",[]],\"hasErrors\",false,\"isAsyncValid\",true,\"isSyncValid\",true,\"isValid\",true]]]],\"loading\",false,\"l1CategoryId\",null]],\"globalMessage\",null,\"suggestKeyword\",[\"^0\",[\"suggestions\",[\"^1\",[]],\"removed\",false,\"query\",\"\",\"categoryId\",0,\"selected\",false]],\"geolocation\",[\"^0\",[\"locationData\",[\"^1\",[]]]],\"cookies\",[\"^0\",[]],\"experiments\",[\"^0\",[\"optimizely\",[\"^0\",[]]]],\"phoneNumber\",[\"^0\",[\"phone\",null]],\"searchSuggest\",[\"^0\",[\"suggestions\",[\"^1\",[]],\"removed\",false,\"query\",\"\"]],\"i18n\",[\"^ \",\"get\",null,\"__version__\",1,\"data\",[\"^ \",\"en-CA\",[\"^ \",\"footer\",[\"^ \",\"columnTitles\",[\"^ \",\"information\",\"Kijiji Information\",\"support\",\"Kijiji Support\",\"autos\",\"Kijiji Autos\",\"explore\",\"Explore Kijiji\",\"faq\",\"Frequently Asked Questions\"],\"copyright\",[\"^ \",\"main\",\"Copyright © 2016 eBay International AG. All rights reserved.\",\"fineprint\",\"Google, Google Play, YouTube and other marks are trademarks of Google Inc.\"],\"faqLinks\",[\"^ \",\"link1\",[\"^ \",\"text\",\"How do I get people to see my Ad?\",\"href\",\"http:\u002F\u002Fhelp.kijiji.ca\u002Fhelpdesk\u002Fbasics\u002Fbenefits-of-promoting-ads\"],\"link2\",[\"^ \",\"^A\",\"Where is my Kijiji Ad? I can't find it.\",\"^B\",\"http:\u002F\u002Fhelp.kijiji.ca\u002Fhelpdesk\u002Ftechnical-issue\u002Fwhere-is-my-ad\"],\"link3\",[\"^ \",\"^A\",\"How can I change my Ad?\",\"^B\",\"http:\u002F\u002Fhelp.kijiji.ca\u002Fhelpdesk\u002Fbasics\u00
</html>
4

2 回答 2

0

更新:

如果要检索特定元素的值,则需要解析检索到的页面内容。有很多包可以为您解析 HTML,因此您不必手动执行,例如 HTML Agility:http ://www.nuget.org/packages/HtmlAgilityPack

如果您想手动执行此操作,希望这可以帮助您入门:

static void DownloadPage()
{
    CookieContainer cookies = new CookieContainer();
    HttpClientHandler handler = new HttpClientHandler();
    handler.CookieContainer = cookies;

    using (HttpClient client = new HttpClient(handler))
    {
        using (HttpResponseMessage response = client.GetAsync("https://www.kijiji.ca/t-login.html").Result)
        {
            HttpHeaders headers = response.Headers;
            HttpContent content = response.Content;
            string myContent = content.ReadAsStringAsync().Result;

            // Find value of ASOtherLang.
            //  It's in this pattern:
            //  <input type="hidden" id="ASOtherLang" value="fr_CA"/>
            Regex regex = new Regex("id=\"ASOtherLang\" value=\"(.*)\"");
            var otherLang = regex.Match(myContent).Groups[1];
            Console.WriteLine(otherLang);
        }
    }
}

听起来您要求通过向网站发送 GET 请求来检索密码输入的值。这无法完成(除非该输入中有默认值)。

您从 GET 请求中得到的输入是:

<input id="login-password" name="password" req="req" type="password" value="" maxlength="64"/>

您对此无能为力,无法为您提供登录密码。

于 2016-08-05T02:54:31.707 回答
0

尝试这个:

HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(myContent);
var r = doc.DocumentNode.Descendants();
var htmlTextBox = doc.DocumentNode.Descendants().FirstOrDefault(x => x.Name=="input" && x.Id=="login-password");
if (htmlTextBox != null)
{
    var passwordBoxHtml = htmlTextBox.OuterHtml;
}

这为您提供<input id="login-password" name="password" req="req" type="password" value="" maxlength="64">passwordBoxHtml.

为此,您必须使用HtmlAgilityPack可从nuget

于 2016-08-05T03:32:06.480 回答