<label>
<input type="search" class="search-field" placeholder="Search …" value name="s" />
</label>
<button type="submit" class="search-submit">Search</button>
</form>
</div>
</div>
</header><div class="wrapper">
<div class="m_menu"><i class="fa fa-bars" aria-hidden="true"></i></div>
<aside>
<div class="cls"><i class="fa fa-times" aria-hidden="true"></i></div>
<div id="nav_menu-2" class="widget widget_nav_menu"><span class="widgettitle"><span>Categories</span></span>
<article class="loop">
<a href="https://yaho.net/close-up-very-close-up/">
<h2>Close up – </h2>
<noscript><img class="srt" width="500" height="375" src="https://yaho.net/wp-content/uploads/2021/12/1_F252">
<div class="info">
<div>December 2, 2021</div>
<div><i class="idden="true"></i> 165</div>
</div>
</a>
</article>
<article class="loop">
<a href="https://yaho.net/4k-premium-user-request/">
<h2>Amateur – 4k – Premium user Request</h2>
<noscript><img class="srt" width="500" height="375" src="https://yaho.net/uploads/2021/12/1_F25338.jpg" alt="Premium user Request"></noscript><img class="lazyload srt" width="500" height="375" src="https://yaho.net/wp-content/uploads/2021/12/1_F25338.jpg"Premium user Request">
<div class="info">
<div>December 1, 2021</div>
<div><i class="fa fa-eye" aria-hidden="true"></i> 582</div>
</div>
</a>
因為一直取不到東西,後來發現原來是python中返回的原始碼跟瀏覽器中的標籤不一樣
我想自己依照py返回的原始碼去寫一個xpath
但是問題來了.我去看返回的原始碼跟上面提供的一樣
不知道該怎樣去分析層級關係.
這樣根本看不出層級關係
那這樣怎麼寫出xpath呢?
是不是只要取回來的原始碼跟瀏覽器上的原始碼如果不一樣
就沒辦法用xpath取元素了呢?
PS:找到答案了把取回的HTML放到PyCharm Community Edition中
存成html可以在導航條的地方看出階層