#!/usr/bin/env python3 """调试:查看页面结构""" from scrapling.fetchers import Fetcher url = "https://www.tennessean.com/story/news/local/2026/04/25/tennessee-lottery-results-saturday-april-25-2" page = Fetcher.get(url, follow_redirects=True, timeout=15, stealthy_headers=True, impersonate="chrome") print("status:", page.status) print() selectors_to_test = [ "article", "#article_content", ".article-content", ".art_content", ".article_body", "#artibody", "#mp-editor", ".content-article", ".article-text", "#article-container", ".article-content-wrap", ".article", "#content", ".post-content", ".main-content", ".TRS_Editor", ".text", "[id*='article']", "[class*='article']", "[class*='art_']", "[class*='content']", "[id*='content']", "[class*='detail']", "[class*='news']", "[class*='body']", ".rich-text", ".news-content", ".detail-content", "#js_content", ".content_area", ".main-text", ] for sel in selectors_to_test: el = page.css(sel) if el: text = el.css("::text").getall() joined = " ".join(t.strip() for t in text if t.strip()) print(f"[FOUND] {sel} -> {len(joined)}字: {joined[:200]}") else: print(f"[MISS] {sel}") # 输出 HTML 前8000字符 print("\n\n--- RAW HTML 前8000字 ---") html_text = str(page.html) if hasattr(page, 'html') else page.text print(html_text[:8000])