Skip to content
登录 注册

渲染JavaScript

单页应用以及在初始 HTML 加载后才渲染内容的网站,需要真实浏览器才能完整渲染。传入 render_js=1 即可通过无头浏览器运行抓取,并获得完整渲染后的 HTML。

GET https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=<TARGET_URL>&render_js=1
ParameterTypeRequiredDescription
api_keystringyes您的 Web Scraping API 密钥
urlstringyes要抓取的目标 URL
render_jsintegerno0(默认)或 1。设置为 1 以使用无头浏览器进行渲染。
Terminal window
curl "https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=https://example.com&render_js=1"
<!doctype html>
<html>
<head>
<title>Example Domain</title>
</head>
<body>
<div>
<h1>Example Domain</h1>
<p>This domain is for use in illustrative examples in documents.</p>
<p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>