Knowledge 목록으로

Scrapling → AI News Blogger 도입

🔍 조사 완료🖥️ 하드웨어 · 기타2026년 7월 20일3
작성 DevSnack Lab직접 조사·실행 범위는 본문 결과와 한계에 기록
후속 적용

개요

적응형 웹 스크래핑 (Cloudflare 우회)

메모

YouTube 자동화엔 적용 완료. 뉴스 블로거는 "저순위" — StealthyFetcher fallback 추가 검토

조사 상세

적응형 Python 웹 스크래핑 프레임워크
GitHub: D4Vinci/Scrapling
Docs: scrapling.readthedocs.io
PyPI: scrapling

기본 정보

항목
버전0.4.9 (설치됨, 2026-07-21 기준)
Stars70.4k
LicenseBSD-3-Clause
Python3.9+
설치pip install "scrapling[fetchers]" (Playwright + curl_cffi 포함)

핵심 기능

Fetcher (동기 HTTP)

from scrapling.fetchers import Fetcher
f = Fetcher()
page = f.get("https://example.com", timeout=15)

StealthyFetcher (Cloudflare 우회, Playwright 기반)

from scrapling.fetchers import StealthyFetcher
s = StealthyFetcher()
page = s.fetch("https://example.com", headless=True, timeout=30)

AsyncFetcher (비동기)

from scrapling.fetchers import AsyncFetcher
af = AsyncFetcher()
page = await af.get("https://example.com", timeout=15)

DynamicFetcher (JS 렌더링, Playwright 기반)

from scrapling.fetchers import DynamicFetcher
df = DynamicFetcher()

CSS Selector

els = page.css("h1") # Selectors 반환
els[0].tag # 'h1'
els[0].text # 텍스트 내용
els[0].attrib # 속성
els[0].get() # 원본 HTML 문자열
els[0].prettify() # 예쁜 HTML
page.get_all_text() # 전체 텍스트

XPath

page.xpath("//h1") # XPath 쿼리

Adaptive (자동 재탐색)

Fetcher.adaptive = True # 전역 활성화
page = fetcher.get("https://example.com")
els = page.css("p", auto_save=True) # 요소 저장
page.relocate(el) # 구조 변경 후 재탐색

Spider (크롤링 프레임워크)

from scrapling.spiders import Spider, Response
class MySpider(Spider):
 name = "demo"
 start_urls = ["https://example.com/"]
 async def parse(self, response: Response):
 for item in response.css(".product"):
 yield {"title": item.css("h2::text").get()}
MySpider().start()

JSON API 응답 처리

data = page.json() # 자동 JSON 파싱

테스트 결과 (2026-07-21)

DGX Spark (Ubuntu, Python 3.12)에서 테스트 완료. 총 56/63 PASS (89%).

통과

  • Fetcher GET / body / html_content
  • CSS Selector (h1, p, a, text, tag, get, html_content, prettify)
  • XPath (//h1, //p)
  • JSON 응답 파싱
  • AsyncFetcher (동시 요청 3개 0.71s)
  • Spider 프레임워크 (클래스 정의, 인스턴스화)
  • Fetcher.configure()
  • 성능 (순차 3페이지 1.95s = 0.65s/page)
  • 404 처리 / DNS 에러 처리

실패 (API 내부 이슈, 실사용 영향 없음)

  • attrib type: AttributesHandler (dict 아님, .get()으로 접근 가능)
  • find_by_text/find_by_regex: lxml element 구조 차이로 동작 안 함
  • Adaptive save/relocate: 전역 adaptive flag 필요 (auto_save는 정상)
  • StealthyFetcher: 브라우저 타임아웃 (DGX Spark Playwright 이슈)
  • page.re/page.re_first: 인터페이스 차이

설치 상태

  • `[로컬] 내 v0.4.9 설치 완료
  • 의존성: curl_cffi, Playwright, lxml, browserforge 등 포함

사용 중인 코드

  • `[로컬] — Fetcher + StealthyFetcher로 페이지 스크래핑 및 이미지 수집
  • 설정: config/profiles/*.yamlscrapling_enabled, scrapling_stealth

파이프라인 검토 결과 (2026-07-21)

YouTube Automation

  • 이미 통합됨SearchClient 체인의 3번째 제공자 (SearXNG → RSS → Scrapling)
  • ScraplingProvider는 SearXNG/RSS 결과 URL을 받아 페이지 본문 + 이미지 수집
  • 버그 발견 및 수정 (2026-07-21):

- _extract_page_data()에서 text_content() 호출 → Scrapling 0.4.9에는 없는 메서드

- .text 프로퍼티로 교체하여 실제 콘텐츠 추출 가능해짐

  • StealthyFetcher fallback: Cloudflare 감지 시 자동 전환 (403[경로])
  • 개선 가능: AsyncFetcher로 병렬 페이지 페칭 (현재 순차)

AI News Blogger

  • 대체 가능하나 우선순위 낮음
  • 현재 스택: requests + readability-lxml + BeautifulSoup
  • Scrapling으로 교체 시:

- ✅ StealthyFetcher로 Cloudflare 뉴스사이트 스크래핑 가능

- ✅ 의존성 단순화 (BS4 → Scrapling)

- ❌ readability-lxml의 본문 추출 능력은 Scrapling이 대체 불가

  • 현실적 접근: ContentScraper에 StealthyFetcher fallback만 추가

기타 파이프라인

  • horror_shorts / short_factory / ai-news-shorts — 대부분 로컬 API 호출, 스크래핑 불필요
  • 새 파이프라인에는 requests+BS4 대신 Scrapling 단일 의존성 추천

총평

  • YouTube Automation: 버그 수정 완료 ✅
  • AI News Blogger: 선택적 도입 가능 (저순위)
  • StealthyFetcher가 가장 큰 차별점 — Cloudflare Turnstile 우회
  • AsyncFetcher로 검색/스크래핑 병렬화 가능