取得固定頁面内容
用Google Chrom打開需要的頁面,比如
http://news.sina.com.cn/c/nd/2017-05-08/doc-ifyeycfp9368908.shtml
網頁空白處右擊“檢查”,選“Network”, 選“Doc”,在“Response”中可以找到正文标題,比如“國土部:5月到9月實行汛期地質災害日報告制度”
然後選“Headers”
确定http://news.sina.com.cn/c/nd/2018-06-06/doc-ihcqccip0158262.shtml是我們需要的網頁
打開網頁 http://news.sina.com.cn/c/nd/2018-06-06/doc-ihcqccip0158262.shtml
然後,選最左邊的 Select an element in the page to inspect in. 然後,選Elements,再點選網頁标題,可以看到Elements中的内容自動跳到了 <h1 class="main-title">這三家晶片巨頭突遭反壟斷調查 中國亮劍了</h1>
來源與時間
打開網頁http://news.sina.com.cn/c/nd/2017-05-08/doc-ifyeycfp9368908.shtml
同以上例方法,點選右上角時間,在elements中找到time-source
接下來我們需要想辦法将時間和來源分開來,這時需要使用到contents; 我們先在後面加上.contents,運作下後會看到上面的内容會在清單中分為如下2個元素
轉載于:https://blog.51cto.com/2290153/2126860