๐ท๏ธ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev
ํ๋์ ์ธ ์น์ ๊ฐํธํ๊ฒ ์คํฌ๋ํํ์ธ์
์์ ์ฐพ๊ธฐ ยท Fetcher ์ ํ ๊ฐ์ด๋ ยท Spider ยท ํ๋ก์ ๊ต์ฒด ยท CLI ยท MCP ์๋ฒ
Scrapling์ ๋น ๋ฅธ HTTP ์์ฒญ, ์คํ ์ค ๋ธ๋ผ์ฐ์ , ๊ฐ๋ ฅํ ํ์ฑ, ๋์ ํฌ๋กค๋ง์ ํ๋๋ก ๋ฌถ์ Python ์น ์คํฌ๋ํ ํ๋ ์์ํฌ์ ๋๋ค.
์ ์ ํ์ด์ง๋ฅผ ๊ฐ์ ธ์ค๊ณ , JavaScript๋ฅผ ์คํํ๊ณ , ์ฌ์ดํธ๋ฅผ ์กฐ์ํ๊ณ , ์ฌ์ดํธ๊ฐ ํธ์ถํ๋ API์์ ๋ฐ์ดํฐ๋ฅผ ์ถ์ถํ์ธ์. ์ธ์ ์ฌ์ฌ์ฉ, ํ๋ก์ ๊ต์ฒด, ์๋ ์ฌ์๋, ์ผ์ ์ ์ง์ ์ฌ๊ฐ, ๋ฐ์ดํฐ ๋ด๋ณด๋ด๊ธฐ๋ฅผ ์ง์ํ๋ ํฌ๋กค๋ฌ๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค.
Python์ด๋ ํฐ๋ฏธ๋์์ ์ฌ์ฉํ ์ ์์ผ๋ฉฐ, MCP ์๋ฒ์ Agent Skill์ ํตํด AI ์์ด์ ํธ์์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋ช ๊ฐ์ ํ๋๋ฅผ ์ถ์ถํ๋ ์์ ๋ถํฐ ์ฌ์ดํธ ์ ์ฒด๋ฅผ ๊น๋ํ Markdown ํ์ผ๋ก ์ ์ฅํ๋ ์์ ๊น์ง ์ง์ํฉ๋๋ค.
Scrapling์ผ๋ก ํ ์ ์๋ ์ผ
- ํ์ด์ง ๊ฐ์ ธ์ค๊ธฐ์ ์กฐ์: ๋น ๋ฅธ HTTP ์์ฒญ, ์คํ ์ค ๋ธ๋ผ์ฐ์ , JavaScript ์คํ, Cloudflare Turnstile๊ณผ Interstitial ์ฒ๋ฆฌ, ์ง์ ์ธ์ , ๋ฐฑ๊ทธ๋ผ์ด๋ API ์๋ต ๊ธฐ๋ก.
- ํ์ฑ๊ณผ ๋ฐ์ดํฐ ์ถ์ถ: CSS, XPath, ํ ์คํธ์ ์ ๊ท์ ๊ฒ์, ํ์ด์ง๊ฐ ๋ฐ๋ ๋ค์๋ ์์ ์ถ์ , ๋น์ทํ ์์ ์ฐพ๊ธฐ, ๊น๋ํ Markdown ์ถ๋ ฅ.
- ํฌ๋กค๋ง๊ณผ ๋ด๋ณด๋ด๊ธฐ: ๋์ ํฌ๋กค๋ง, ํ๋ก์ ๊ต์ฒด, ์ฌ์๋, AutoThrottle, ์ผ์ ์ ์ง์ ์ฌ๊ฐ, ์คํธ๋ฆฌ๋ฐ, ๋ฐ๋ก ์ธ ์ ์๋ ํ ํ๋ฆฟ, JSONยทJSONLยทCSVยทXML ๋ด๋ณด๋ด๊ธฐ.
- AI๋ ํฐ๋ฏธ๋์์ ์คํฌ๋ํ: AI ์์ด์ ํธ๊ฐ ์ฌ์ดํธ๋ฅผ ํ์ํ๊ณ ๋ฐ์ดํฐ๋ฅผ ์ถ์ถํ๋ MCP ์๋ฒ, Agent Skill, CLI ๋ช ๋ น์ด, ๋ํํ ์ ธ.
ํ ํ์ด์ง๋ถํฐ ์์ํ์ธ์:
from scrapling.fetchers import Fetcher
page = Fetcher.get('https://quotes.toscrape.com/')
quotes = page.css('.quote .text::text').getall()
print(quotes)
์คํ์ด๋๋ก ์ฌ๋ฌ ํ์ด์ง๋ฅผ ์์งํ ์๋ ์์ต๋๋ค:
from scrapling.spiders import Spider, Response
class QuotesSpider(Spider):
name = "quotes"
start_urls = ["https://quotes.toscrape.com/"]
async def parse(self, response: Response):
for quote in response.css('.quote'):
yield {
"text": quote.css('.text::text').get(),
"author": quote.css('.author::text').get(),
}
result = QuotesSpider().start()
print(len(result.items))
result.items.to_json("quotes.json")
์ด ์ฝ๋๋ 10์ ์ถ๋ ฅํ๊ณ ๋ช
์ธ๊ณผ ์ ์๋ฅผ quotes.json์ ์ ์ฅํฉ๋๋ค.
ํ๋ํฐ๋ ์คํฐ์
|
NodeMaven - ์น ์คํฌ๋ํ๊ณผ ์๋ํ๋ฅผ ์ํ ๊ฐ์ฅ ํจ์จ์ ์ธ ํ๋ก์ ์ ๊ณต์ ์ฒด๋ก, ์์ฅ์์ ๊ฐ์ฅ ๋์ ํ์ง์ IP๋ฅผ ์ ๊ณตํฉ๋๋ค. ์ฝ๋ SCRAPLING35๋ฅผ ์ฌ์ฉํ๋ฉด 35% ํ ์ธ์ ๋ฐ์ ์ ์์ต๋๋ค. |
|
Scrapling์ Cloudflare Turnstile์ ์ฒ๋ฆฌํฉ๋๋ค. ๊ธฐ์ ์ฉ ๋ณดํธ ๊ธฐ๋ฅ์ ์ฐํํด์ผ ํ๋ค๋ฉด, Hyper Solutions ๊ฐ Akamai, DataDome, Kasada, Incapsula์ฉ ์ ํจํ ์ํฐ๋ด ํ ํฐ์ ์์ฑํ๋ API ์๋ํฌ์ธํธ๋ฅผ ์ ๊ณตํฉ๋๋ค. ๊ฐ๋จํ API ํธ์ถ๋ง์ผ๋ก ์ฌ์ฉํ ์ ์์ผ๋ฉฐ ๋ธ๋ผ์ฐ์ ์๋ํ๋ ํ์ ์์ต๋๋ค. |
|
Evomi
: ๋ ์ง๋ด์
ํ๋ก์๋ฅผ GB๋น $0.49๋ถํฐ ์ ๊ณตํฉ๋๋ค. ๋ธ๋ผ์ฐ์ ์ง๋ฌธ์ ์์ ํ ์์ฅํ Chromium ๊ธฐ๋ฐ ์คํฌ๋ํ ๋ธ๋ผ์ฐ์ , ๋ ์ง๋ด์
IP, ์๋ CAPTCHA ์ฒ๋ฆฌ, ๋ด ์ฐจ๋จ ์ฐํ๋ฅผ ์ง์ํฉ๋๋ค. Scraper API๋ก ๋ฒ๊ฑฐ๋ก์ ์์ด ๊ฒฐ๊ณผ๋ฅผ ์ป์ผ์ธ์. MCP ๋ฐ N8N ์ฐ๋๋ ์ง์ํฉ๋๋ค. |
|
The Web Scraping Club์์ Scrapling์ ์ ์ฒด ๋ฆฌ๋ทฐ(2025๋ 11์)๋ฅผ ์ฝ์ด๋ณด์ธ์. ์น ์คํฌ๋ํ ์ ๋ฌธ No.1 ๋ด์ค๋ ํฐ์ ๋๋ค. |
|
Swiftproxy๋ 195๊ฐ๊ตญ ์ด์์์ 8์ฒ๋ง ๊ฐ ์ด์์ IP๋ฅผ ๊ฐ์ถ ํ์ฅ ๊ฐ๋ฅํ ์ฃผ๊ฑฐ์ฉ ํ๋ก์๋ฅผ ์ ๊ณตํ๋ฉฐ, ๋น ๋ฅด๊ณ ์์ ์ ์ธ ์ฐ๊ฒฐ, ์๋ ํ๋ก์ ๊ต์ฒด, ๊ฐ๋ ฅํ ์ฐจ๋จ ๋ฐฉ์ง ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค. ๋ฌด๋ฃ๋ก ์ฒดํํ ์ ์์ต๋๋ค. |
|
Byteful์ ์ค๋ฆฌ์ ์ผ๋ก ํ๋ณดํ ์ฃผ๊ฑฐ์ฉ, ๋ชจ๋ฐ์ผ, ISP ๋ฐ ๋ฐ์ดํฐ์ผํฐ ํ๋ก์์ ์คํฌ๋ํ ๋ฐ AI ์๋ํ ๋๊ตฌ๋ฅผ ์ ๊ณตํฉ๋๋ค. ์ฝ๋ SCRAPLING10์ ์ฌ์ฉํ๋ฉด ์ฃผ๊ฑฐ์ฉ ํ๋ก์๋ฅผ 10% ํ ์ธ๋ฐ์ ์ ์์ต๋๋ค. |
|
ProxyLane: Scrapling ์คํ ์ CAPTCHA๋ฅผ 90% ์ค์ ๋๋ค. ์ค์ P2P ์ฃผ๊ฑฐ์ฉ ๊ธฐ๊ธฐ 2,800๋ง ๋, ํด๋ฆฐ IP ๋น์จ 98.7%, 195๊ฐ ๊ตญ๊ฐ. ๋์/ISP/์ฐํธ๋ฒํธ(ZIP) ์ง์ ๊ณผ ๊ณ ์ /์ํ IP ์ธ์ ์ ์ง์ํ๋ฉฐ ํธ๋ํฝ์ ๋ง๋ฃ๋์ง ์์ต๋๋ค. $1.95๋ก 350 MB๋ฅผ ์ฌ์ฉํด ๋ณด์ธ์. ์ฝ๋ SCRAPEANDTAKE๋ฅผ ์ฌ์ฉํ๋ฉด 25% ํ ์ธ์ ๋ฐ์ ์ ์์ต๋๋ค. |
|
LundProxy: GB๋น ์๊ธ์ ๋ด์ง ์์๋ ๋ฉ๋๋ค. ๋ฌด์ ํ ์ฃผ๊ฑฐ์ฉ ํ๋ก์ ํธ๋ํฝ๊ณผ 1์ต ๊ฐ ์ด์์ IP๋ฅผ ์ ๊ณตํ๋ฉฐ 190๊ฐ ์ด์์ ๊ตญ๊ฐ๋ฅผ ์ง์ํฉ๋๋ค. ๋์ญํญ์ ๋ฐ๋ผ ์๊ธ์ ์ง๋ถํ์ธ์. 50 Mbps ์ฃผ๊ฑฐ์ฉ ํ๋ก์ ๋ฌด๋ฃ ์ฒดํ์ ์ ์ฒญํ์ธ์. |
|
Resolvr: ๋๊ท๋ชจ ์คํฌ๋ํ์๋ ๋ง์ CAPTCHA๊ฐ ๋ค๋ฐ๋ฆ ๋๋ค. Resolvr๋ ํ๋์ API๋ฅผ ํตํด ์ค์ ๊ธฐ๊ธฐ์์ reCAPTCHA์ Cloudflare ์ฑ๋ฆฐ์ง๋ฅผ ํด๊ฒฐํฉ๋๋ค. ์ง๊ธ ๋ฒ ํ ๋ฒ์ ์ ๋ฌด๋ฃ๋ก ์ด์ฉํ ์ ์์ต๋๋ค. |
|
Scrapling ์คํ ์ค hCaptcha๊ฐ ๋ํ๋๋์? NoneCap์ ํ๋์ API๋ฅผ ํตํด ์ ํจํ hCaptcha ํ ํฐ์ ๋ฐํํ๋ฉฐ Enterprise ์ฌ์ดํธ ํค๋ ์ง์ํฉ๋๋ค. ๊ฐ์ ํ๋ฉด 1,300 ํฌ๋ ๋ง์ ๋ฌด๋ฃ๋ก ๋ฐ์ ์ ์์ต๋๋ค. |
|
DataImpulse์์ $1/GB๋ก ์ด์ฉํ์ธ์. ์ค๋ฆฌ์ ์ผ๋ก ํ๋ณดํ ์์ฒด ํ๋ก์๋ฅผ ์ ๊ณตํฉ๋๋ค. 9,000๋ง ๊ฐ ์ด์์ IP์ 195๊ฐ ์ด์์ ๊ตญ๊ฐ๋ฅผ ์ง์ํฉ๋๋ค. ์ฃผ๊ฑฐ์ฉ, ๋ฐ์ดํฐ์ผํฐ, ๋ชจ๋ฐ์ผ ํ๋ก์๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ฌ์ฉ๋์ ๋ฐ๋ผ ๊ฒฐ์ ํ๋ฏ๋ก ๊ตฌ๋ ์ด ํ์ ์์ต๋๋ค. ํธ๋ํฝ์ ์ ํจ ๊ธฐ๊ฐ์ด ์์ต๋๋ค. |
์ฌ๊ธฐ์ ๊ด๊ณ ๋ฅผ ๊ฒ์ฌํ๊ณ ์ถ์ผ์ ๊ฐ์? ์ฌ๊ธฐ๋ฅผ ํด๋ฆญํ์ธ์
์คํฐ์
์ฌ๊ธฐ์ ๊ด๊ณ ๋ฅผ ๊ฒ์ฌํ๊ณ ์ถ์ผ์ ๊ฐ์? ์ฌ๊ธฐ๋ฅผ ํด๋ฆญํ๊ณ ์ํ๋ ์๊ธ์ ๋ฅผ ์ ํํ์ธ์!
์ฃผ์ ๊ธฐ๋ฅ
์คํ์ด๋: ๋ณธ๊ฒฉ์ ์ธ ํฌ๋กค๋ง ํ๋ ์์ํฌ
- ๐ท๏ธ Scrapy์ ๋น์ทํ Spider API:
start_urls, ๋น๋๊ธฐparse์ฝ๋ฐฑ,Request/Response๊ฐ์ฒด๋ก ์คํ์ด๋๋ฅผ ์ ์ํฉ๋๋ค. - โก ๋์ ํฌ๋กค๋ง: ๋์์ ์ฒ๋ฆฌํ ์์ฒญ ์, ๋๋ฉ์ธ๋ณ ์ ํ, ๋ค์ด๋ก๋ ์ฌ์ด์ ๋๊ธฐ ์๊ฐ์ ์ค์ ํฉ๋๋ค.
- ๐ ์ฌ๋ฌ ์ธ์ ์ง์: ํ ์คํ์ด๋์์ HTTP ์์ฒญ๊ณผ ์คํ ์ค ํค๋๋ฆฌ์ค ๋ธ๋ผ์ฐ์ ๋ฅผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ์ฌ์ฉํฉ๋๋ค. ์ธ์ ID๋ก ๊ฐ ์์ฒญ์ ๋ณด๋ผ ์ธ์ ์ ๊ณ ๋ฆ ๋๋ค.
- ๐พ ์ผ์ ์ ์ง์ ์ฌ๊ฐ:
crawldir๋ก ๋๊ธฐ ์ค์ธ ์์ฒญ๊ณผ ๋ฐฉ๋ฌธํ URL์ ์ ์ฅํฉ๋๋ค. Ctrl+C๋ก ์์ ํ๊ฒ ๋ฉ์ถ ๋ค ๊ฐ์ ํด๋๋ก ๋ค์ ์์ํ๋ฉด ์ด์ด์ ์คํ๋ฉ๋๋ค. - ๐ก ์คํธ๋ฆฌ๋ฐ:
async for item in spider.stream()์ผ๋ก ์ถ์ถํ ํญ๋ชฉ์ ๋ฐ๋ก ๋ฐ๊ณ ์ค์๊ฐ ํต๊ณ๋ฅผ ํ์ธํฉ๋๋ค. ํ๋ฉด ํ์, ๋ฐ์ดํฐ ์ฒ๋ฆฌ, ๊ธด ํฌ๋กค๋ง ์์ ์ ์ ํฉํฉ๋๋ค. - ๐ก๏ธ ์ฐจ๋จ ๊ฐ์ง: ์ฐจ๋จ๋ ์์ฒญ์ ์๋์ผ๋ก ๊ฐ์งํ๊ณ ์ฌ์๋ํฉ๋๋ค. ์ฒ๋ฆฌ ๋ฐฉ์๋ ๋ฐ๊ฟ ์ ์์ต๋๋ค.
- ๐ฆ AutoThrottle: ๋๊ธฐ ์๊ฐ์ ์ง์ ์ถ์ธกํ ํ์๊ฐ ์์ต๋๋ค. ์คํ์ด๋๊ฐ ์๋ต ์๋์ ๋ง์ถฐ ๋๋ฉ์ธ๋ณ ๋๊ธฐ ์๊ฐ์ ์กฐ์ ํฉ๋๋ค. ์ฐจ๋จ์ด๋ ์์ฒญ ๋น๋ ์ ํ์ด ์์๋๋ฉด ๋ ๋ฐฐ๋ก ๋๋ฆฌ๊ฑฐ๋
Retry-After๊ฐ ์ง์ ํ ์๊ฐ๋งํผ ๊ธฐ๋ค๋ฆฌ๊ณ , ๋ฌธ์ ๊ฐ ์ฌ๋ผ์ง๋ฉด ๋ค์ ์๋๋ฅผ ๋์ ๋๋ค. - ๐ค robots.txt ์ค์:
robots_txt_obey๋ฅผ ์ผ๋ฉดDisallow,Crawl-delay,Request-rate๊ท์น์ ๋ฐ๋ฆ ๋๋ค. ๊ท์น์ ๋๋ฉ์ธ๋ณ๋ก ์บ์ํฉ๋๋ค. - ๐งช ๊ฐ๋ฐ ๋ชจ๋: ์ฒซ ์คํ์์ ์๋ต์ ๋์คํฌ์ ์ ์ฅํ๊ณ ๋ค์ ์คํ๋ถํฐ ๋ค์ ์ฌ์ฉํฉ๋๋ค. ์๋ฒ์ ๋ค์ ์์ฒญํ์ง ์๊ณ
parse()๋ฅผ ์์ ํ๋ฉฐ ์ํํ ์ ์์ต๋๋ค. - ๐งฉ ๋ฐ๋ก ์ฐ๋ ์คํ์ด๋ ํ
ํ๋ฆฟ:
CrawlSpider๋ ๊ท์น์ ๋ฐ๋ผ ๋งํฌ๋ฅผ ๋ฐ๋ผ๊ฐ๊ณ ,SitemapSpider๋ sitemap๊ณผ robots.txt๋ฅผ ์ฌ์ฉํฉ๋๋ค.XMLFeedSpider/CSVFeedSpider๋ XMLยทRSSยทCSV ํผ๋๋ฅผ ์ฝ์ต๋๋ค.ShopifySpider๋ ๊ณต๊ฐ Shopify ์คํ ์ด์์ ์ํ์ ์์งํ๋ฉฐ, ์ํ ์ต์ ์กฐํฉ๋ง๋ค ํ ํญ๋ชฉ์ ๋ง๋ญ๋๋ค. - ๐ ๋งํฌ ์ถ์ถ:
LinkExtractor๋ ํ์ฉยท์ ์ธ ํจํด, ๋๋ฉ์ธ ํํฐ, CSSยทXPath ๋ฒ์ ์ง์ , ํ์ฅ์ ํํฐ, URL ์ ๊ทํ๋ฅผ ์ง์ํฉ๋๋ค. ํ ํ๋ฆฟ ์์์ ๋๋ ๋จ๋ ์ผ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค. - ๐ฆ ๋ฐ์ดํฐ ๋ด๋ณด๋ด๊ธฐ: ํ
๊ณผ ์์ฒด ์ฒ๋ฆฌ ๊ณผ์ ์ผ๋ก ๊ฒฐ๊ณผ๋ฅผ ์ ์ฅํ๊ฑฐ๋ ๋ด์ฅ JSONยทJSONLยทCSVยทXML ๊ธฐ๋ฅ์ ์ฌ์ฉํ์ธ์.
result.items.to_json(),to_jsonl(),to_csv(),to_xml()์ ํธ์ถํ๋ฉด ๋ฉ๋๋ค.
์ธ์ ์ ์ฌ์ฉํ ์ฌ์ดํธ ๊ฐ์ ธ์ค๊ธฐ
- HTTP ์์ฒญ:
Fetcher๋ก ๋น ๋ฅด๊ณ ํ์งํ๊ธฐ ์ด๋ ค์ด HTTP ์์ฒญ์ ๋ณด๋ ๋๋ค. ๋ธ๋ผ์ฐ์ ์ TLS ์ง๋ฌธ๊ณผ ํค๋๋ฅผ ํ๋ด ๋ด๊ณ HTTP/3๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. - ๋์ ํ์ด์ง:
StealthyFetcher๋ก ๋ธ๋ผ์ฐ์ ๋ฅผ ์๋ ์กฐ์ํ๋ฉฐ ๋์ ์ฌ์ดํธ๋ฅผ ๊ฐ์ ธ์ต๋๋ค. Playwright์ Chromium๊ณผ Google Chrome์ ์ง์ํฉ๋๋ค. - ๋ด ์ฐจ๋จ ์ฐํ:
StealthyFetcher๋ ์๋ํ ํ์ ์ ์จ๊ธฐ๊ณ ๋ธ๋ผ์ฐ์ ์ง๋ฌธ์ ์์ฅํฉ๋๋ค. ๋ชจ๋ ์ ํ์ Cloudflare Turnstile๊ณผ Interstitial ๊ฒ์ฌ๋ฅผ ์๋์ผ๋ก ํต๊ณผํ ์ ์์ต๋๋ค. - ์ธ์
๊ด๋ฆฌ:
FetcherSession๊ณผStealthySession์ ์์ฒญ ์ฌ์ด์ ์ฟ ํค์ ์ํ๋ฅผ ์ ์งํฉ๋๋ค. - ํ๋ก์ ๊ต์ฒด:
ProxyRotator๋ ๋ชจ๋ ์ธ์ ์์ ํ๋ก์๋ฅผ ์์๋๋ก ๋๋ ์ ํ ๊ท์น์ ๋ฐ๋ผ ๊ต์ฒดํฉ๋๋ค. ์์ฒญ๋ง๋ค ๋ค๋ฅธ ํ๋ก์๋ฅผ ์ง์ ํ ์๋ ์์ต๋๋ค. - ๋๋ฉ์ธ๊ณผ ๊ด๊ณ ์ฐจ๋จ: ํน์ ๋๋ฉ์ธ๊ณผ ํ์ ๋๋ฉ์ธ์ผ๋ก ๋ณด๋ด๋ ์์ฒญ์ ๋ง์ ์ ์์ต๋๋ค. ๋ธ๋ผ์ฐ์ Fetcher์ ๊ด๊ณ ์ฐจ๋จ ๊ธฐ๋ฅ์ ์ฝ 3,500๊ฐ์ ๊ด๊ณ ยท์ถ์ ๋๋ฉ์ธ์ ์ฐจ๋จํฉ๋๋ค.
- DNS ์ ์ถ ๋ฐฉ์ง: DNS-over-HTTPS๋ฅผ ์ผ๋ฉด Cloudflare์ DoH๋ฅผ ํตํด DNS๋ฅผ ์กฐํํฉ๋๋ค. ํ๋ก์๋ฅผ ์ธ ๋ DNS๊ฐ ์์ด ๋๊ฐ๋ ๊ฒ์ ๋ง์ต๋๋ค.
- ์๊ฒฉ ๋ธ๋ผ์ฐ์ :
cdp_url๋ก CDP๋ฅผ ํตํด ์ด๋ฏธ ์คํ ์ค์ธ ๋ธ๋ผ์ฐ์ ์ ์ฐ๊ฒฐํฉ๋๋ค. ๊ฐ์ ์ปดํจํฐ, ๋ค๋ฅธ ์๋ฒ, ๋ธ๋ผ์ฐ์ ์ ๊ณต ์๋น์ค ์ด๋์์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค.executable_path๋ก ์ง์ ๋ง๋ Chromium์ ๋ธ๋ผ์ฐ์ Fetcher์ ์ง์ ํ ์๋ ์์ต๋๋ค. - ๋ฐฑ๊ทธ๋ผ์ด๋ API ์๋ต ๊ธฐ๋ก: ๋ธ๋ผ์ฐ์ ์ธ์
์์
record_requests=True๋ฅผ ์ผ๊ณsession.network.search(limit=None)์ผ๋ก ์ ์ฅ๋ ์๋ต์ ๊ฒ์ํ์ธ์. ์์ฒญ์ ๋ค์ ๋ณด๋ด์ง ์๊ณ ์ฌ๋ฌ ํ์ด์ง์์ ๋ฐ์ํ API ๋ฐ์ดํฐ์ HTTP ์ค๋ฅ๋ฅผ ์ฝ์ ์ ์์ต๋๋ค. ๊ธฐ๋ก์๋ ํฌ๊ธฐ ์ ํ์ด ์์ผ๋ฉฐ ํ ์คํธ ์๋ต ๋ณธ๋ฌธ์ ์ ์ฅํฉ๋๋ค. - ๋น๋๊ธฐ ์ง์: ๋ชจ๋ Fetcher์์ ๋น๋๊ธฐ ํธ์ถ์ ์ง์ํ๋ฉฐ, ์ ์ฉ ๋น๋๊ธฐ ์ธ์ ํด๋์ค๋ ์ ๊ณตํฉ๋๋ค.
ํ์ฑ๊ณผ ๋ฐ์ดํฐ ์ถ์ถ
- ๐ ์์ ์ถ์ : ์ฌ์ดํธ๊ฐ ๋ฐ๋์ด๋ ์ ์ฌ๋ ์๊ณ ๋ฆฌ์ฆ์ผ๋ก ์์๋ฅผ ๋ค์ ์ฐพ์ต๋๋ค.
- ๐ฏ ์ ์ฐํ ์ ํ: CSS, XPath, ํํฐ, ํ ์คํธ, ์ ๊ท์ ๋ฑ ์ฌ๋ฌ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
- ๐ ๋น์ทํ ์์ ์ฐพ๊ธฐ: ์ด๋ฏธ ์ฐพ์ ์์์ ๋น์ทํ ์์๋ฅผ ์๋์ผ๋ก ์ฐพ์ต๋๋ค.
AI ๊ธฐ๋ฅ
- ๐ค MCP ์๋ฒ: Claude๋ Cursor ๊ฐ์ AI ์ฑ๋ด๊ณผ ์์ด์ ํธ๊ฐ Scrapling์ผ๋ก ๋ฐ์ดํฐ๋ฅผ ์์งํฉ๋๋ค. HTTP ์์ฒญ, ๋ธ๋ผ์ฐ์ ์กฐ์, ์คํฌ๋ฆฐ์ท, ์ ์ฅ๋ ๋ก๊ทธ์ธ ์ํ, ๋ฐฑ๊ทธ๋ผ์ด๋ API ์๋ต์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์คํ ์ค ๋ธ๋ผ์ฐ์ ์ ๋๊ตฌ๋ฅผ ํตํด ์ถฉ๋ถํ ๋ฅ๋ ฅ์ ๊ฐ์ง AI ๋ชจ๋ธ์ด ์์ ์ค ๋ง์ฃผ์น๋ ๋ชจ๋ CAPTCHA๋ฅผ ์ฒ๋ฆฌํ๋๋ก ๋์ต๋๋ค. Cloudflare ์ฒ๋ฆฌ ๊ธฐ๋ฅ๋ ๋ด์ฅ๋์ด ์์ต๋๋ค. ๋ชจ๋ธ์ ๋ณด๋ด๋ ๋ด์ฉ์ ์ค์ด๊ณ ๊ด๊ณ ๋ฅผ ์ฐจ๋จํ๋ฉฐ ํ๋กฌํํธ ์ธ์ ์ ์ผ๋ก๋ถํฐ ๋ชจ๋ธ์ ๋ณดํธํฉ๋๋ค. CDP ์๊ฒฉ ๋ธ๋ผ์ฐ์ ์ ์ธ์ฆ์ ์ง์ํ๋ HTTP ์ฐ๊ฒฐ๋ ์ ๊ณตํฉ๋๋ค. (๋ฐ๋ชจ ์์)
- ๐ง Agent Skill: ์ค์นํด์ ์ฐ๋ Agent Skill์ด ์ฝ๋ฉ ์์ด์ ํธ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ ์ฒด ์ฌ์ฉ๋ฒ์ ์๋ ค ์ค๋๋ค. ์์ด์ ํธ๊ฐ ์ถ์ธก ๋์ ํ์ฌ API์ ๋ง๋ ์ฝ๋๋ฅผ ์์ฑํ๋๋ก ๋์ต๋๋ค.
- ๐ RAG์ฉ Markdown: ํ ์ค(
page.markdown())๋ก ํ์ด์ง๋ฅผ ์ ๋ฆฌํ๊ณ ์ํํ ๋ด์ฉ์ ์ ๊ฑฐํด LLM์ฉ Markdown์ผ๋ก ๋ง๋ญ๋๋ค.ContentSpiderํ ํ๋ฆฟ์ผ๋ก ์ฌ์ดํธ ์ ์ฒด๋ฅผ Markdown ํ์ผ๋ก ์ ์ฅํ ์๋ ์์ต๋๋ค. ์ด ๊ณผ์ ์๋ LLM์ด ํ์ํ์ง ์์ต๋๋ค. (๋ฌธ์)
๋น ๋ฅด๊ณ ์ค๋ฌด์์ ๊ฒ์ฆ๋ ๊ตฌ์กฐ
- ๐ ๋น ๋ฅธ ์ฒ๋ฆฌ: ์ต์ ํ๋ฅผ ํตํด ๋๋ถ๋ถ์ Python ์คํฌ๋ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ณด๋ค ๋น ๋ฅด๊ฒ ๋์ํฉ๋๋ค.
- ๐ ์ ์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ: ์ต์ ํํ ์๋ฃ ๊ตฌ์กฐ๋ฅผ ์ฌ์ฉํ๊ณ ํ์ํ ์์ ์๋ง ๋ฐ์ดํฐ๋ฅผ ๋ถ๋ฌ์ต๋๋ค.
- โก ๋น ๋ฅธ JSON ๋ณํ: ํ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ณด๋ค 10๋ฐฐ ๋น ๋ฆ ๋๋ค.
- ๐๏ธ ์ค๋ฌด ๊ฒ์ฆ: ํ ์คํธ ์ปค๋ฒ๋ฆฌ์ง 92%์ ์ ์ฒด ์ฝ๋์ ํ์ ํํธ๋ฅผ ๊ฐ์ท์ต๋๋ค. ์ง๋ 1๋ ๋์ ์๋ฐฑ ๋ช ์ด ๋งค์ผ ๋ฐ์ดํฐ๋ฅผ ์์งํ๋ ๋ฐ ์ฌ์ฉํ์ต๋๋ค.
๊ฐ๋ฐ์๋ฅผ ์ํ ํธ๋ฆฌํ ๋๊ตฌ
- ๐ฏ ๋ํํ ์ ธ: Scrapling์ ํตํฉํ IPython ์ ธ์ ์ถ๊ฐํ ์ ์์ต๋๋ค. ๋จ์ถ ๋ช ๋ น๊ณผ ๋๊ตฌ๋ก ์คํฌ๋ฆฝํธ๋ฅผ ๋น ๋ฅด๊ฒ ๊ฐ๋ฐํ์ธ์. curl ์์ฒญ์ Scrapling ์์ฒญ์ผ๋ก ๋ฐ๊พธ๊ณ ๊ฒฐ๊ณผ๋ฅผ ๋ธ๋ผ์ฐ์ ์์ ๋ณผ ์ ์์ต๋๋ค.
- ๐ ํฐ๋ฏธ๋์์ ๋ฐ๋ก ์ฌ์ฉ: ์ฝ๋๋ฅผ ํ ์ค๋ ์ฐ์ง ์๊ณ URL์์ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ฌ ์ ์์ต๋๋ค!
- ๐ ๏ธ DOM ํ์: ๋ถ๋ชจ, ํ์ , ์์ ์์๋ก ์ด๋ํ๋ ๋ฉ์๋๋ฅผ ์ ๊ณตํฉ๋๋ค.
- ๐งฌ ํ ์คํธ ์ฒ๋ฆฌ: ์ ๊ท์, ํ ์คํธ ์ ๋ฆฌ, ๋น ๋ฅธ ๋ฌธ์์ด ์ฐ์ฐ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
- ๐ ์ ํ์ ์์ฑ: ์ด๋ค ์์๋ ์์ ์ ์ธ CSSยทXPath ์ ํ์๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค.
- ๐ ์ต์ํ API: Scrapy์ BeautifulSoup์ ์ต์ํ๋ค๋ฉด ์ฝ๊ฒ ์ฌ์ฉํ ์ ์์ต๋๋ค. ScrapyยทParsel๊ณผ ๊ฐ์ ๊ฐ์ ์์๋ฅผ ์ง์ํฉ๋๋ค.
- ๐ค Scrapy ํตํฉ: ์ฝ๋ฐฑ์
scrapling_response๋ฐ์ฝ๋ ์ดํฐ๋ฅผ ๋ถ์ด๋ฉด ์ด๋ฏธ ๊ฐ์ ธ์จ ์๋ต์ Scrapling ํ์๋ก ์ฒ๋ฆฌํ ์ ์์ต๋๋ค. ์ฝ๋๋ฅผ ์๋ก ์์ฑํ ํ์๊ฐ ์์ต๋๋ค. - ๐ ์ ์ฒด ํ์ ํํธ: ํธ์ง๊ธฐ ์ง์๊ณผ ์ฝ๋ ์๋ ์์ฑ์ ๋์ต๋๋ค. ์ฝ๋๊ฐ ๋ฐ๋ ๋๋ง๋ค PyRight์ MyPy๊ฐ ์ ์ฒด ์ฝ๋๋ฅผ ์๋์ผ๋ก ๊ฒ์ฌํฉ๋๋ค.
- ๐ ๋ฐ๋ก ์ฐ๋ Docker ์ด๋ฏธ์ง: ์ ๋ฒ์ ๋ง๋ค ๋ชจ๋ ๋ธ๋ผ์ฐ์ ๊ฐ ํฌํจ๋ Docker ์ด๋ฏธ์ง๋ฅผ ์๋์ผ๋ก ๋ง๋ค๊ณ ๋ฐฐํฌํฉ๋๋ค.
์์ํ๊ธฐ
์์ฃผ ์ฐ๋ ๊ธฐ๋ฅ์ ๋ช ๊ฐ์ง ์ดํด๋ณด๊ฒ ์ต๋๋ค.
๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ
์ธ์ ์ ์ง์ํ๋ HTTP ์์ฒญ
from scrapling.fetchers import Fetcher, FetcherSession
with FetcherSession(impersonate='chrome') as session: # Chrome์ ์ต์ TLS fingerprint ์ฌ์ฉ
page = session.get('https://quotes.toscrape.com/', stealthy_headers=True)
quotes = page.css('.quote .text::text').getall()
# ๋๋ ์ผํ์ฑ ์์ฒญ ์ฌ์ฉ
page = Fetcher.get('https://quotes.toscrape.com/')
quotes = page.css('.quote .text::text').getall()
๊ณ ๊ธ ์คํ ์ค ๋ชจ๋
from scrapling.fetchers import StealthyFetcher, StealthySession
with StealthySession(headless=True, solve_cloudflare=True) as session: # ์์
์ด ๋๋ ๋๊น์ง ๋ธ๋ผ์ฐ์ ๋ฅผ ์ด์ด๋ก๋๋ค
page = session.fetch('https://nopecha.com/demo/cloudflare', google_search=False)
data = page.css('#padded_content a').getall()
# ๋๋ ์ผํ์ฑ ์์ฒญ ์คํ์ผ - ์ด ์์ฒญ์ ์ํด ๋ธ๋ผ์ฐ์ ๋ฅผ ์ด๊ณ , ์๋ฃ ํ ๋ซ์ต๋๋ค
page = StealthyFetcher.fetch('https://nopecha.com/demo/cloudflare', solve_cloudflare=True)
data = page.css('#padded_content a').getall()
์์ ํ ๋ธ๋ผ์ฐ์ ์๋ํ
from scrapling.fetchers import StealthyFetcher, StealthySession
with StealthySession(headless=True, disable_resources=False, network_idle=True) as session: # ์์
์ด ๋๋ ๋๊น์ง ๋ธ๋ผ์ฐ์ ๋ฅผ ์ด์ด๋ก๋๋ค
page = session.fetch('https://quotes.toscrape.com/', load_dom=False)
data = page.xpath('//span[@class="text"]/text()').getall() # ์ํ์๋ฉด XPath selector๋ ์ฌ์ฉ ๊ฐ๋ฅ
# ๋๋ ์ผํ์ฑ ์์ฒญ ์คํ์ผ - ์ด ์์ฒญ์ ์ํด ๋ธ๋ผ์ฐ์ ๋ฅผ ์ด๊ณ , ์๋ฃ ํ ๋ซ์ต๋๋ค
page = StealthyFetcher.fetch('https://quotes.toscrape.com/')
data = page.css('.quote .text::text').getall()
์คํ์ด๋
๋์ ์์ฒญ, ์ฌ๋ฌ ์ธ์ , ์ผ์ ์ ์ง์ ์ฌ๊ฐ๋ฅผ ์ง์ํ๋ ํฌ๋กค๋ฌ๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค:
from scrapling.spiders import Spider, Response
class QuotesSpider(Spider):
name = "quotes"
start_urls = ["https://quotes.toscrape.com/"]
concurrent_requests = 10
async def parse(self, response: Response):
for quote in response.css('.quote'):
yield {
"text": quote.css('.text::text').get(),
"author": quote.css('.author::text').get(),
}
next_page = response.css('.next a')
if next_page:
yield response.follow(next_page[0].attrib['href'])
result = QuotesSpider().start()
print(f"{len(result.items)}๊ฐ์ ์ธ์ฉ๊ตฌ๋ฅผ ์คํฌ๋ ์ดํํ์ต๋๋ค")
result.items.to_json("quotes.json")
ํ ์คํ์ด๋์์ ์ฌ๋ฌ ์ข ๋ฅ์ ์ธ์ ์ ์ฌ์ฉํฉ๋๋ค:
from scrapling.spiders import Spider, Request, Response
from scrapling.fetchers import FetcherSession, AsyncStealthySession
class MultiSessionSpider(Spider):
name = "multi"
start_urls = ["https://example.com/"]
def configure_sessions(self, manager):
manager.add("fast", FetcherSession(impersonate="chrome"))
manager.add("stealth", AsyncStealthySession(headless=True), lazy=True)
async def parse(self, response: Response):
for link in response.css('a::attr(href)').getall():
# ๋ณดํธ๋ ํ์ด์ง๋ ์คํ
์ค ์ธ์
์ ํตํด ๋ผ์ฐํ
if "protected" in link:
yield Request(link, sid="stealth")
else:
yield Request(link, sid="fast", callback=self.parse) # ๋ช
์์ ์ฝ๋ฐฑ
์งํ ์ํ๋ฅผ ์ ์ฅํ๋ฉด ๊ธด ํฌ๋กค๋ง ์์ ์ ๋ฉ์ท๋ค๊ฐ ์ด์ด์ ์คํํ ์ ์์ต๋๋ค. ๋ค์์ฒ๋ผ ์คํ์ด๋๋ฅผ ์์ํ์ธ์:
QuotesSpider(crawldir="./crawl_data").start()
crawldir๋ฅผ ์ค์ ํ ๋ค Ctrl+C๋ฅผ ๋๋ฅด๋ฉด ๋๊ธฐ ์ค์ธ ์์ฒญ๊ณผ ๋ฐฉ๋ฌธํ URL์ด ์ ์ฅ๋ฉ๋๋ค. ๊ฐ์ crawldir๋ก ๋ค์ ์์ํ๋ฉด ์ด์ด์ ์คํ๋ฉ๋๋ค. ์ถ์ถํ ๋ฐ์ดํฐ๋ ๋ฐ๋ก ์ ์ฅํ์ธ์.
๋ฐ๋ก ์ธ ์ ์๋ ํ ํ๋ฆฟ๋ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด Shopify ์คํ ์ด์ ์ ์ฒด ์ํ์ ๊ฐ์ ธ์ฌ ์ ์์ต๋๋ค:
from scrapling.spiders import ShopifySpider
class MyStore(ShopifySpider):
target_website = "example.com"
result = MyStore().start() # ์คํ ์ด์ ๋ชจ๋ ์ํ์ ๋ณํ๋น ํ ํญ๋ชฉ์ฉ ์์ง
์ด ํ ํ๋ฆฟ์ ๊ณต๊ฐ ์ปฌ๋ ์ API์์ ์ํ์ ์ฝ๊ณ , ์ํ ์ต์ ์กฐํฉ๋ง๋ค ํ ํญ๋ชฉ์ ๋ง๋ญ๋๋ค.
๊ณ ๊ธ ํ์ฑ๊ณผ ์์ ํ์
from scrapling.fetchers import Fetcher
# ํ๋ถํ ์์ ์ ํ๊ณผ ๋ด๋น๊ฒ์ด์
page = Fetcher.get('https://quotes.toscrape.com/')
# ์ฌ๋ฌ ์ ํ ๋ฉ์๋๋ก ์ธ์ฉ๊ตฌ ๊ฐ์ ธ์ค๊ธฐ
quotes = page.css('.quote') # CSS selector
quotes = page.xpath('//div[@class="quote"]') # XPath
quotes = page.find_all('div', {'class': 'quote'}) # BeautifulSoup ์คํ์ผ
# ์๋์ ๋์ผ
quotes = page.find_all('div', class_='quote')
quotes = page.find_all(['div'], class_='quote')
quotes = page.find_all(class_='quote') # ๋ฑ๋ฑ...
# ํ
์คํธ ๋ด์ฉ์ผ๋ก ์์ ์ฐพ๊ธฐ
quotes = page.find_by_text('Albert Einstein', first_match=False)
# ๊ณ ๊ธ ๋ด๋น๊ฒ์ด์
quote_text = page.css('.quote')[0].css('.text::text').get()
quote_texts = page.css('.quote').css('.text::text').getall() # ์ฒด์ด๋ ์
๋ ํฐ
first_quote = page.css('.quote')[0]
author = first_quote.css('.author::text').get()
next_quote = first_quote.next
parent_container = first_quote.parent
# ์์ ๊ด๊ณ์ ์ ์ฌ๋
similar_elements = first_quote.find_similar()
below_elements = first_quote.below_elements
ํ์ด์ง๋ฅผ ๊ฐ์ ธ์ค์ง ์๊ณ ํ์๋ฅผ ์ง์ ์ฌ์ฉํ ์๋ ์์ต๋๋ค:
from scrapling.parser import Selector
page = Selector("<html>...</html>")
์ฌ์ฉ๋ฒ์ ๊ฐ์ต๋๋ค!
๋น๋๊ธฐ ์ธ์ ์์
import asyncio
from scrapling.fetchers import FetcherSession, AsyncStealthySession
async def main():
async with FetcherSession(http3=True) as http_session: # `FetcherSession`์ ์ปจํ
์คํธ์ ๋ฐ๋ผ ๋๊ธฐ/๋น๋๊ธฐ ๋ฐฉ์ ๋ชจ๋๋ก ๋์ํฉ๋๋ค
page1 = await http_session.get('https://quotes.toscrape.com/')
page2 = await http_session.get('https://quotes.toscrape.com/page/2/', impersonate='chrome')
print(len(page1.css('.quote')), len(page2.css('.quote')))
async with AsyncStealthySession(max_pages=2) as browser_session:
urls = ['https://quotes.toscrape.com/js/', 'https://quotes.toscrape.com/js/page/2/']
pages = await asyncio.gather(*(browser_session.fetch(url, wait_selector='.quote') for url in urls))
print([len(page.css('.quote')) for page in pages])
asyncio.run(main())
CLI์ ๋ํํ ์ ธ
ํฐ๋ฏธ๋์์๋ Scrapling์ ์ฌ์ฉํ ์ ์์ต๋๋ค:
์คํฌ๋ํ์ฉ ๋ํํ ์ ธ์ ์คํํฉ๋๋ค:
pip install "scrapling[shell]"
scrapling shell
ํ๋ก๊ทธ๋๋ฐ ์์ด ํ์ด์ง๋ฅผ ํ์ผ๋ก ๋ฐ๋ก ์ถ์ถํฉ๋๋ค. --css-selector๋ก ๋ด์ฉ์ ๊ณ ๋ฅด๊ฑฐ๋ --ai-targeted๋ก body ๋ด์ฉ์ ์ ํํ๊ณ ์ ๋ฆฌํ์ธ์. ํ
์คํธ๋ .txt, Markdown์ .md, HTML์ .html์ ์ฌ์ฉํ์ธ์.
scrapling extract get 'https://quotes.toscrape.com/' quotes.md
scrapling extract get 'https://quotes.toscrape.com/' quotes.txt --css-selector '.quote' --impersonate 'chrome'
scrapling extract fetch 'https://quotes.toscrape.com/js/' quotes.md --css-selector '.quote' --wait-selector '.quote' --no-headless
scrapling extract fetch 'https://nopecha.com/demo/cloudflare' captchas.html --css-selector '#padded_content a' --solve-cloudflare
[!NOTE] MCP ์๋ฒ์ ๋ํํ ์ ธ ๋ฑ ๋ค๋ฅธ ๊ธฐ๋ฅ์ ๋ฌธ์์์ ํ์ธํ์ธ์.
์ฑ๋ฅ ํ ์คํธ
Scrapling์ ๊ฐ๋ ฅํ ๋ฟ ์๋๋ผ ๋งค์ฐ ๋น ๋ฆ ๋๋ค. ๋ค์ ํ ์คํธ๋ Scrapling ํ์์ ๋๋ฆฌ ์ฐ์ด๋ ๋ค๋ฅธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ต์ ๋ฒ์ ์ ๋น๊ตํฉ๋๋ค.
ํ ์คํธ ์ถ์ถ ์๋: ์ค์ฒฉ ์์ 5,000๊ฐ
| # | ๋ผ์ด๋ธ๋ฌ๋ฆฌ | ์๊ฐ(ms) | Scrapling ๋๋น |
|---|---|---|---|
| 1 | Scrapling | 1.99 | 1.0x |
| 2 | Parsel/Scrapy | 2.06 | 1.035 |
| 3 | Lxml ๋จ๋ | 2.56 | 1.286 |
| 4 | PyQuery | 23.98 | ~12x |
| 5 | Selectolax | 197.02 | ~99x |
| 6 | MechanicalSoup | 1545.15 | ~776.5x |
| 7 | BS4 + Lxml | 1562.1 | ~785.0x |
| 8 | BS4 + html5lib | 3412.73 | ~1714.9x |
๋น์ทํ ์์ ์ฐพ๊ธฐ์ ํ ์คํธ ๊ฒ์
Scrapling์ ์ ์ํ ์์ ๊ฒ์์ ๋ค๋ฅธ ๋ฐฉ๋ฒ๋ณด๋ค ํจ์ฌ ๋น ๋ฆ ๋๋ค:
| ๋ผ์ด๋ธ๋ฌ๋ฆฌ | ์๊ฐ(ms) | Scrapling ๋๋น |
|---|---|---|
| Scrapling | 2.3 | 1.0x |
| AutoScraper | 12.58 | 5.47x |
๊ฐ ๊ฒฐ๊ณผ๋ 100ํ ์ด์ ์คํํ ํ๊ท ์ ๋๋ค. ์ธก์ ๋ฐฉ๋ฒ์ benchmarks.py๋ฅผ ํ์ธํ์ธ์.
์ค์น
Scrapling์๋ Python 3.10 ์ด์์ด ํ์ํฉ๋๋ค:
pip install scrapling
[!IMPORTANT] ์ด ๋ช ๋ น์ ํ์์ ํ์ํ ํจํค์ง๋ง ์ค์นํฉ๋๋ค. Fetcher๋ ๋ช ๋ น์ค ๋๊ตฌ๋ ํฌํจ๋์ง ์์ต๋๋ค. ๋ฐ๋ผ์ ์ ์์ ์ฒ๋ผ
scrapling.fetchers๋scrapling.spiders์์ ๊ฐ์ ธ์ค๋ฉดModuleNotFoundError๊ฐ ๋ฐ์ํฉ๋๋ค. Fetcher๋ ์คํ์ด๋๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ๋จผ์ ์๋ ๋ฐฉ๋ฒ์ผ๋ก Fetcher์ ํ์ํ ํจํค์ง๋ฅผ ์ค์นํ์ธ์.
์ถ๊ฐ ํจํค์ง
Fetcher, ๊ด๋ จ ํด๋์ค, ์๋ ์ถ๊ฐ ๊ธฐ๋ฅ์ ์ฌ์ฉํ๋ ค๋ฉด Fetcher์ ๋ธ๋ผ์ฐ์ ์ ํ์ํ ํจํค์ง๋ฅผ ์ค์นํ์ธ์:
pip install "scrapling[fetchers]" scrapling install # ์ผ๋ฐ ์ค์น scrapling install --force # ๊ฐ์ ์ฌ์ค์น๋ชจ๋ ๋ธ๋ผ์ฐ์ , ํ์ํ ์์คํ ํจํค์ง, ๋ธ๋ผ์ฐ์ ์ง๋ฌธ์ ๋ฐ๊พธ๋ ๋๊ตฌ๋ฅผ ๋ค์ด๋ก๋ํฉ๋๋ค.
๋ช ๋ น์ด ๋์ ์ฝ๋์์ ์ค์นํ ์๋ ์์ต๋๋ค:
from scrapling.cli import install install([], standalone_mode=False) # ์ผ๋ฐ ์ค์น install(["--force"], standalone_mode=False) # ๊ฐ์ ์ฌ์ค์น์ถ๊ฐ ๊ธฐ๋ฅ:
- MCP ์๋ฒ ์ค์น:
pip install "scrapling[ai]" - RAG ์์คํ
๋ง๋ค๊ธฐ์ ํ์ํ ํจํค์ง ์ค์น:
pip install "scrapling[rag]" - ๋ํํ ์
ธ๊ณผ
extract๋ช ๋ น์ด ์ค์น:pip install "scrapling[shell]" - ๋ชจ๋ ๊ธฐ๋ฅ ์ค์น:
๋ธ๋ผ์ฐ์ Fetcher๋ฅผ ์ฌ์ฉํ๋ ค๋ฉดpip install "scrapling[all]"scrapling install์ ์คํํ์ธ์. HTTP ์์ฒญ์๋ ๋ธ๋ผ์ฐ์ ์ค์น๊ฐ ํ์ํ์ง ์์ต๋๋ค.
- MCP ์๋ฒ ์ค์น:
Docker
๋ชจ๋ ์ถ๊ฐ ๊ธฐ๋ฅ๊ณผ ๋ธ๋ผ์ฐ์ ๊ฐ ํฌํจ๋ Docker ์ด๋ฏธ์ง๋ฅผ DockerHub์์ ๋ฐ์ ์๋ ์์ต๋๋ค:
docker pull pyd4vinci/scrapling
๋๋ GitHub ๋ ์ง์คํธ๋ฆฌ์์ ๋ฐ์ผ์ธ์:
docker pull ghcr.io/d4vinci/scrapling:latest
์ด ์ด๋ฏธ์ง๋ ์ ์ฅ์์ main ๋ธ๋์น๋ฅผ ๋ฐํ์ผ๋ก GitHub Actions์์ ์๋์ผ๋ก ๋ง๋ค๊ณ ๋ฐฐํฌํฉ๋๋ค.
๊ฐ๋ฐ์ ์ฐธ์ฌํ๊ธฐ
๊ฐ๋ฐ ์ฐธ์ฌ๋ฅผ ํ์ํฉ๋๋ค! ์์ํ๊ธฐ ์ ์ ์ฐธ์ฌ ์๋ด๋ฅผ ์ฝ์ด ์ฃผ์ธ์.
๋ฉด์ฑ ์กฐํญ
[!CAUTION] ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ํ์ต๊ณผ ์ฐ๊ตฌ ๋ชฉ์ ์ผ๋ก ์ ๊ณตํฉ๋๋ค. ์ฌ์ฉํ๋ฉด ๊ตญ๋ด์ธ ๋ฐ์ดํฐ ์์ง๊ณผ ๊ฐ์ธ์ ๋ณด ๋ณดํธ ๊ด๋ จ ๋ฒ๋ฅ ์ ๋ฐ๋ฅด๋ ๋ฐ ๋์ํ ๊ฒ์ผ๋ก ๋ด ๋๋ค. ์์ฑ์์ ์ฐธ์ฌ์๋ ์ํํธ์จ์ด์ ์ค์ฉ์ ์ฑ ์์ง์ง ์์ต๋๋ค. ์ฌ์ดํธ์ ์ด์ฉ ์ฝ๊ด๊ณผ robots.txt๋ฅผ ์ง์ผ ์ฃผ์ธ์.
๐ ์ธ์ฉ
์ฐ๊ตฌ์ ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ค๋ฉด ๋ค์ ํ์์ผ๋ก ์ธ์ฉํด ์ฃผ์ธ์:
@misc{scrapling,
author = {Karim Shoair},
title = {Scrapling},
year = {2024},
url = {https://github.com/D4Vinci/Scrapling},
note = {A Python Web Scraping framework for everything from a single request to a full-scale crawl!}
}
๋ผ์ด์ ์ค
์ด ํ๋ก์ ํธ๋ BSD-3-Clause ๋ผ์ด์ ์ค๋ก ๋ฐฐํฌํฉ๋๋ค.
๊ฐ์ฌ์ ๋ง
๋ค์ ํ๋ก์ ํธ๋ฅผ ๋ฐํ์ผ๋ก ํ ์ฝ๋๊ฐ ํฌํจ๋์ด ์์ต๋๋ค:
- Parsel (BSD ๋ผ์ด์ ์ค) - translator ์๋ธ๋ชจ๋์ ์ฌ์ฉ






