Skip to content
登录 注册

等待CSS

将 CSS 选择器传递给 wait_for_css,API 会在返回页面之前最多等待 10 秒,等待该元素出现。如果选择器始终没有出现,请求会失败且不会计费。

GET https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=<TARGET_URL>&wait_for_css=<CSS_SELECTOR>&render_js=1
ParameterTypeRequiredDescription
api_keystringyes您的 Web Scraping API 密钥
urlstringyes要抓取的目标 URL
wait_for_cssstringyes要等待的 CSS 选择器。
render_jsintegeryes必须为 1
timeoutintegerno最长等待时间(毫秒)。默认值为 10000。
Terminal window
curl "https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=https://example.com&wait_for_css=.firstHeading&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>
</div>
</body>
</html>