[Bug]: When extracting data with scroll_full_page, only the final elements get parsed
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #1877 của @hafezparast — đã đóng, không merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 47/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 85.4k
- Fork
- 8.9k
- Merge trung bình
- 5 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 23
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của unclecode/crawl4ai
-
[Bug]: Since 0.9.1, Linux launches chrome-headless-shell instead of ChromiumCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: BestFirstCrawlingStrategy fetches a full batch past max_pagesCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
unclecode/crawl4ai#2381 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: CrawlerRunConfig.clone() drops fallback_fetch_function, so deep crawls never use itCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Docker memory guard reads host RAM when no container limit is set — cgroup v2 "max" defeats get_container_memory_percentCó thể đã có người làm @Battleplus đã nhận 56 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
unclecode/crawl4ai#2123 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: After a streamed deep crawl is stopped early, the next deep crawl returns only the start pageCó thể đã có người làm @PiUnknown đã nhận 3 ngày trước. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 12/100
unclecode/crawl4ai#2380 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của unclecode/crawl4ai
Issue tương tự
-
debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/vscode-flake8#601 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
nonews refactor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Uninett/nav#4255 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Claiming namespace `codearcade`Đang mởnamespace operations
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
EclipseFdn/open-vsx.org#14421 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ubuntu/ubuntu-project-docs#850 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày