Commit 3741efa0 authored by liyang's avatar liyang

feat:dcard debug

parent aca6a4e9
......@@ -39,6 +39,10 @@ def reptile(browser=None, search_word=""):
# 打开网页
browser.get(f"{base_url}/search?query={search_word}")
time.sleep(6)
# 滚动一页
# 使用 JavaScript 将网页滚动到底部
browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(3)
base_xpath = "//div[@role='main']//div[@data-key]//article"
# 内容块
element_content_list = browser.find_elements('xpath', base_xpath)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment