例如,我想在“www.google.com”上显示文本,就像在 chrome 中打开它并按 ctrl+a & ctrl+c:
..
Google PrivacyTermsSettingsAdvertisingBusinessAboutHow Search works
代替:
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta charset="UTF-8"><meta content="origin" name="referrer"><meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for." name="description"><meta content="noodp" name="robots"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><meta content="origin" name="referrer"><title>Google</title><script nonce="kYKSVIWLPxNkDhoVCq276A==">(function(){window.google={kEI:'ZqUZXruXDNfT-
...
我已经尝试过 requests_html 模型,例如:
import requests_html
s = requests_html.HTMLSession()
page = s.get('https://www.google.com')
print(page.html.text)
但它仍然像打击一样显示html:
Google
(function(){window.google={kEI:'y6cZXu3LJ8SkwAPWz6KIBA',kEXPI:'31',authuser:0,kGL:'ZZ',kBL:'JGpW'};google.sn='webhp';google.kHL='en';google.jsfs='Ffpdje';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||google.kEI};google.getLEI=function(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b};
...
那么,我怎样才能在页面上显示所有文本,比如按 ctrl+a 和 ctrl+c?
谢谢。