[Bug]: When extracting data with scroll_full_page, only the final elements get parsed
维护者通常 1 天内回复
还没有人认领这个 Issue。
- #1877 来自 @hafezparast —— 已关闭,未合并
评估
调研方向
Reproduce the issue with AsyncWebCrawler and CrawlerRunConfig against the supplied X URL, comparing scroll_full_page on and off. Inspect how result.html, screenshots, and JsonCssExtractionStrategy process the scrolled page. Done means extraction retains the full set of visible profiles rather than only the final elements, with the existing reproduction succeeding.
由索引模型根据 Issue 内容生成。
描述
crawl4ai version
0.4.248
Expected Behavior
I'm crawiling Twitter, specifically the "following" section of a profile. I have a css selector for the relevant data (user's names and bios) and set up a JsonCssExtractionStrategy. If I don't use scroll_full_page, I understandably only expect to get the first N user profiles. But if I do enable scroll_full_page, I expect the returned data to contain the list to the fullest extent as visible when browsing manually.
Current Behavior
When not using scroll_full_page, I do get the first 16 profiles in this case. However, when setting scroll_full_page, I only get the LAST 12. It's important to note that there are over 40 profiles listed, so none of the 12 profiles intersect with the first 16. I checked the result's html property and it does only contain information about the last 12. However, strangely the screenshot saved contains all the profiles.
Is this reproducible?
Yes
Inputs Causing the Bug
https://x.com/SomeTwitterProfile/following
Steps to Reproduce
Execute the following snippet with both scoll_full_page on and off.
Code snippets
site_url = "https://x.com/elonmusk/following"
import asyncio
from crawl4ai import AsyncWebCrawler, CacheMode, BrowserConfig, CrawlerRunConfig
from crawl4ai.markdown_generation_strategy import DefaultMarkdownGenerator
from crawl4ai.extraction_strategy import JsonCssExtractionStrategy
import json
async def main():
schema = {
"name": "Followers",
"baseSelector": "button[data-testid='UserCell']",
"fields": [
{
"name": "name",
"selector": "span",
"type": "text"
},
{
"name": "handle",
"selector": 'a[role="link"] > div > div[dir="ltr"]:only-child > span ',
"type": "text"
},
{
"name": "bio",
"selector": "div[dir='auto'] > span",
"type": "html",
}
]
}
extraction_strategy = JsonCssExtractionStrategy(schema, verbose=True)
browser_conf = BrowserConfig(
extra_args=['--disable-web-security'],
cookies=[
{"name": "auth_token", "value": "YOURAUTHTOKEN", "domain": ".x.com", "path": "/"},
],
)
crawler_config = CrawlerRunConfig(
cache_mode=CacheMode.BYPASS, # cache_mode=CacheMode.BYPASS/DISABLED,
screenshot=True,
wait_for="css:button[data-testid='UserCell']:nth-child(1)",
page_timeout=5000,
extraction_strategy=extraction_strategy,
# scan_full_page=True,
scroll_delay=1.5,
)
try:
async with AsyncWebCrawler(
config=browser_conf,
verbose=True,
) as crawler:
result = await crawler.arun(
url=site_url ,
config=crawler_config,
)
from base64 import b64decode
with open("screenshot.png", "wb") as f:
f.write(b64decode(result.screenshot))
with open("index.html", "w") as f:
f.write(result.html)
data = json.loads(result.extracted_content)
print(f"Extracted {len(data)} users")
print(json.dumps(data, indent=2) if data else "No data found")
except Exception as e:
print(f"Something happened: {e}")
raise e
if __name__ == "__main__":
asyncio.run(main())
OS
Linux
Python version
3.12.9
Browser
Default
Browser version
No response
Error logs & Screenshots (if applicable)
No response
- 主要语言
- Python
- 星标
- 85.4k
- 派生
- 8.9k
- 平均合并
- 5 天 7 小时
- 30 天内合并 PR
- 23
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
unclecode/crawl4ai 的其他 Issue
-
[Bug]: Since 0.9.1, Linux launches chrome-headless-shell instead of Chromium可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
[Bug]: BestFirstCrawlingStrategy fetches a full batch past max_pages可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
unclecode/crawl4ai#2381 · 1 条评论 ·
维护者通常 1 天内回复
-
[Bug]: CrawlerRunConfig.clone() drops fallback_fetch_function, so deep crawls never use it可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
[Bug]: Docker memory guard reads host RAM when no container limit is set — cgroup v2 "max" defeats get_container_memory_percent可能已有人在做 @Battleplus 于 56 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
unclecode/crawl4ai#2123 · 1 条评论 ·
维护者通常 1 天内回复
-
[Bug]: After a streamed deep crawl is stopped early, the next deep crawl returns only the start page可能已有人在做 @PiUnknown 于 4 天前认领。 未关闭
难度 4/5 1-2 天 新手友好度 12/100
unclecode/crawl4ai#2380 · 1 条评论 ·
维护者通常 1 天内回复
查看 unclecode/crawl4ai 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
mohitmishra786/readprism#322 ·
维护者通常 1 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 1/5 1 小时以内 新手友好度 75/100
维护者通常 1 天内回复
-
API-key credentials accept a blank key: empty via the API, spaces-only via the builder's Add API key dialog可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
Significant-Gravitas/AutoGPT#15727 ·
维护者通常 1 天内回复