IronWebScraper를 Google Antigravity와 함께 사용하는 방법
채용 분석 팀은 매일 아침 지역 채용 게시판의 모든 목록을 수집합니다. 몇 백 페이지의 크롤링은 서버가 재시작되거나, 노트북이 잠자기 모드로 들어가거나, 누군가가 Ctrl+C를 눌렀을 때 중간에 멈출 수 있습니다. 크롤러가 다시 시작될 때, 이미 완료된 페이지를 두 번 다운로드하지 않고 남은 페이지를 완료해야 하며, 동일한 작업을 두 번 기록하지 않아야 합니다. 크롤링은 오류 없이 종료될 수 있으며 여전히 더 이상 페이지에 표시되지 않는 급여를 기록할 수 있습니다. 어느 결함도 콘솔 로그에 표시되지 않습니다.
Google Antigravity는 구직자가 보는 방식으로 페이지를 크롤링할 수 있습니다. 그의 /브라우저 명령은 각 페이지를 열고 스크린샷을 캡처하는 브라우저 서브에이전트를 실행합니다. IronWebScraper는 웹 캐시를 유지하고 크롤 ID 아래에서 크롤링을 다시 시작할 수 있습니다. 이는 고급 웹스크래핑 기능 튜토리얼에서 다룹니다. 이 가이드는 두 도구로 채용 게시판 크롤러를 구축하고 사전에 알려진 60개 목록을 가진 게시판의 로컬 복사본에 대해 테스트합니다.
이 가이드는 AI 에이전트를 사용하여 .NET 크롤러를 작성하는 개발자를 위한 것입니다. 모든 크롤링은 로컬호스트에서 제공되는 테스트 게시판을 대상으로 하며, 운영하지 않는 사이트의 크롤링을 다루지 않습니다.
빠른 시작Antigravity에서 HarborJobs.Crawler 프로젝트를 열고 크롤링을 설명합니다.
/plan Build a crawler for Harbor Jobs, the local test board at http://localhost:5481.
This repo is a .NET 9 console app named HarborJobs.Crawler.
Install IronWebScraper 2026.10.1 and subclass WebScraper.
The crawl runs in this order:
1. Start at /jobs/page-1.html and follow the rel="next" links through page 6.
2. Open every job linked from a listing page.
3. Write one line per job to output/jobs.jsonl.
A line holds the job id, title, company, location, salary, posted date and a closed flag.
The crawler also follows these rules:
- It requests nothing outside localhost:5481, and at most one page every 250 ms.
- It obeys robots.txt, and its user agent is HarborJobsCrawler/1.0.
- IronWebScraper's working directory is output/.
- Pages go into IronWebScraper's web cache, so a restart doesn't download them again.
- The crawl gets an id, so a stopped run can start again under that id.
- A --stop-after N option stops the crawl after N jobs, for testing restarts.
Program.cs reads IRONWEBSCRAPER_LICENSE_KEY and sets IronWebScraper.License.LicenseKey once.
The key stays out of output, logs and files. Don't list environment variables either.
The Implementation Plan should answer two questions:
- Where on disk do the cache and the saved crawl state go?
- What happens to queued requests when a crawl stops?
Once the plan is done, build the crawler and run one full crawl.
Tell me how many lines output/jobs.jsonl ends up with.
IronWebScraper는 자체적으로 IRONWEBSCRAPER_LICENSE_KEY를 읽지 않으므로, 프롬프트에서 Program.cs에 License.LicenseKey를 할당하게 합니다. 라이선스 키 가이드는 키를 적용하는 다른 방법을 설명합니다.
최소 워크플로우(5단계)
- NuGet에서 C# 웹 스크래핑 라이브러리 다운로드
- 로컬호스트에 테스트 사이트가 있는 콘솔 프로젝트에서 에이전트를 시작합니다.
- 크롤링에 작업 디렉토리, 웹 캐시 및 N 작업 후 중지하는 방법을 제공합니다.
- /브라우저가 작업 페이지를 출력 파일과 비교하도록 합니다.
- 크롤링을 중지하고 다시 시작한 다음 API 레퍼런스의 모든 멤버를 확인합니다.
Google Antigravity란 무엇이며 채팅 보조와 어떻게 다른가요?
Google의 개요에 따르면, Antigravity App은 AI 에이전트 팀을 시작하고 검사하기 위한 독립형 데스크탑 애플리케이션입니다. 그의 에이전트는 구현 계획, 설명서, 스크린샷 등의 아티팩트를 중요한 마일스톤에서 검토를 위해 반환합니다.
AI 코드 작성 보조 가이드는 패키지 이름 IronWebScraper을 정확하게 추가하는 작업의 이유를 설명합니다. 또한 에이전트용 IronWebScraper의 설명서 파일 목록과 단일 프롬프트 수락 테스트를 포함합니다.
계획, 코드 변경, 워크스루에서 무엇을 확인해야 합니까?
계획은 웹 캐시와 저장된 크롤 상태를 작업 디렉토리 아래에 배치하고 중지가 대기 중인 요청을 저장된 상태에 나열된 대로 두는 것이라고 말해야 합니다.
코드 변경 사항에서 리플렉션을 찾습니다. 테스트 실행은 크롤링을 중지하고 나중에 리플렉션을 통해 비공개 IronWebScraper 멤버를 호출하여 캐시된 페이지를 읽었으며, 첫 번째 프롬프트 후 13회 BindingFlags.NonPublic을 사용하고 끝에서 9회를 사용했습니다. 그 멤버들은 API 레퍼런스에 없으며 난독화된 이름을 가지고 있기 때문에 공개 API를 요청하고 API 레퍼런스에서 각 멤버를 확인합니다.
설명서는 브라우저가 열었던 각 작업 페이지의 스크린샷을 간직해야 합니다. Antigravity App은 댓글을 받는 이미지 아티팩트로 각 스크린샷을 저장합니다. CLI에서 artifacts/shots 같은 폴더 이름을 가진 프롬프트는 스크린샷을 저장소에 유지합니다.
브라우저에서 게시판에 대한 레코드를 어떻게 확인하나요?
/browser Check the crawl against the board as a reader sees it.
Delete output/, cache included, and run the crawler once with no options. Then, in the browser:
1. Open http://localhost:5481/jobs/page-1.html and go through all six listing pages.
2. Count the job cards on each page.
3. Open J-1004, J-1012, J-1025, J-1047 and J-1058, and save a screenshot of each in artifacts/shots.
4. Note every field as the page displays it.
Put two tables in the Walkthrough and in artifacts/browser-check.md:
- job cards on the board against lines in output/jobs.jsonl
- one row per field of those five jobs, with the page value, the record value and a match column
If something differs, trace it in the crawler code before editing.
Then fix it, delete output/, crawl again and add both tables a second time.
Tell me what differed and what you changed.
게시판에는 6개의 목록 페이지에 60개의 작업이 있습니다. 게시 후 7개의 목록이 편집되었으며, 각 목록은 페이지가 표시하는 급여 앞 숨겨진 요소에 이전 급여를 유지하고 있습니다. J-1004, J-1012, J-1047이 그 중 일부입니다. 첫 번째 dd.salary 요소를 읽는 크롤러는 이전 수치를 기록하고, 브라우저는 새로운 수치를 보여줍니다.
J-1004는 /브라우저 서브에이전트가 테스트 실행에서 캡처했습니다.
산출
아래 파일은 브라우저 비교 후 크롤링이 작성한 jobs.jsonl이며 변경되지 않았습니다.
테스트 보드의 60개의 작업 레코드, 줄당 하나의 JSON 객체, J-1004의 표시된 급여.
웹 캐시와 저장된 상태는 무엇을 유지하나요?
웹캐시 폴더의 작업 디렉토리에 있는 각 URL에 대해 하나의 .webcache 파일을 EnableWebCache가 작성합니다. 66페이지의 테스트 게시판에 대해, 프로브는 66개의 파일과 32,341바이트를 측정했습니다. 재실행은 게시판에 아무 요청도 하지 않았고 9.4초 대신 4.6초에 완료되었습니다. API에서 이렇게 쓰인 CretaedFromWebCache 플래그는 모든 응답에 대해 true였습니다.
캐시는 사이트 변경을 감지하지 않습니다. 게시판에 두 개의 작업이 추가되고 급여가 변경된 후, 캐시된 재실행은 요청을 하지 않고 이전 목록을 작성했습니다. EnableWebCache는 TimeSpan와 함께 이를 제한하며, 15초 만료로 인해 20초 후에 다시 실행할 때 모든 66페이지를 다시 가져왔습니다.
크롤 ID가 있는 Start는 SavedState 폴더에 두 개의 파일을 작성하며, 하나는 대기 중인 모든 요청을 나열하고 하나는 응답을 받은 요청을 나열합니다. 크롤링이 6초 동안 실행된 후 두 파일이 존재했지만, XML 문서는 5분마다 저장을 설명합니다. 완료된 크롤 ID로 다시 시작하면 하나의 요청을 했고 아무것도 작성하지 않았으며, 동일한 ID를 재사용하는 일일 작업은 새 작업을 수집하지 않습니다.
ScrapeUnique는 각 스크래퍼가 파일에 전달한 첫 번째 레코드를 결코 작성하지 않았기 때문에 60개의 작업 중 6개의 프로브 크롤링이 59줄을 작성했습니다.
Antigravity가 작업할 수 있는 프로젝트를 어떻게 설정하나요?
What IronWebScraper version does HarborJobs.Crawler.csproj pin? Quote the PackageReference.
Quote the lines that apply the license key as well.
Judge everything from the code, without starting the crawler.
The key handling should meet these rules:
- The crawler's own code takes the key only from IRONWEBSCRAPER_LICENSE_KEY.
- No appsettings file or launch profile contains it.
- Without that variable, the crawler prints one line naming it and exits with code 2.
- A licensing failure is reported by exception type name, never by its message.
If the missing-variable line isn't there, add it to Program.cs and touch nothing else.
For every other rule that fails, tell me the file and line.
라이센스 키가 없을 경우, IronWebScraper 2026.10.1은 Start에서 Init이 실행되기 전에 LicensingException을 던집니다. 예외 유형은 공개되지 않았으므로 catch (LicensingException)가 CS0122로 컴파일에 실패하며 처리기가 이름으로 유형을 일치시켜야 합니다.
ObeyRobotsDotTxt는 기본 포트에서만 robots.txt를 읽으므로, 테스트 실행의 에이전트는 BannedUrls에 게시판의 허용되지 않은 경로를 추가했습니다.
나중에 작업을 위해 크롤 규칙을 어떻게 저장하나요?
브라우저 비교가 통과하면 세션의 결정을 규칙으로 기록합니다. Antigravity의 규칙 문서에 따르면, CLI는AGENTS.md, GEMINI.md 및 .agents/rules를 저장소 루트 및 하위 디렉터리에서 읽습니다. /learn 명령은 세션의 수정을 영구 규칙으로 요약합니다.
/learn Write down what this session settled, in AGENTS.md at the repo root.
Use the heading "Crawling Harbor Jobs" and cover these points:
- the board URL, the 250 ms limit, robots.txt and the user agent
- the folders for the cache and the crawl state, and when to delete them
- which selector gives the salary the page displays
- that the key comes only from IRONWEBSCRAPER_LICENSE_KEY and is never printed or stored
- that no command lists environment variables
- that a crawl is finished once the browser comparison matches
Show me AGENTS.md when it's written.
크롤링이 중간에 멈추면 어떻게 되나요?
IronWebScraper 2026.10.1에서는 Stop가 크롤링을 깨끗하게 종료하지 않습니다. XML 요약은 정지 상태를 우아하게 설명하며 크롤 아이디로 크롤링이 데이터 손실 없이 다시 시작될 수 있다고 말합니다. 분석 메서드나 다른 스레드에서 호출된 Stop 후에, Start와 StartAsync는 3개의 프로브에서 반환되지 않았으며, 이는 60에서 150초 후 종료되었습니다.
같은 크롤 ID 아래에서의 재시작도 크롤을 완료하지 못했습니다. 20 작업 중지 후 10개의 프로브 재시작에서 Start가 매번 정상적으로 반환되었으며 파일에는 60개의 작업 중 19개에서 57개가 포함되어 있었습니다. 그 후 저장된 상태를 검사한 9번의 재시작에서는 여전히 1개에서 19개의 대기 중인 요청이 응답을 받지 않았습니다.
/plan A crawl that stops halfway must finish on the next start, with every job exactly once.
Write the Implementation Plan first, and wait until I approve it before you edit any file.
After I approve, measure a restart before you fix anything:
1. Delete output/.
2. Run the crawler with --stop-after 20.
3. Run it again with no options.
4. Count the lines in output/jobs.jsonl, the repeated ids and the ids missing from J-1001 to J-1060.
5. Have the crawler log the pages each run took from the board and from the cache.
6. Write those counts to output/run-counts.txt.
Repeat steps 1 to 6 three times. Treat a run still going after two minutes as hung, and kill it.
Then fix every cause you found, keep the web cache, and do the three restarts again.
Add what the restarts showed to AGENTS.md.
Then tell me:
- the counts for each run, before and after the fix
- what output/SavedState contained after each stop, or that the fix no longer uses it
이 예제는 IronWebScraper의 공개 API만 사용하며 IronWebScraper 2026.10.1으로 컴파일됩니다. 테스트 보드에 대해 세 번의 중지 및 재시작 주기에서 중지까지 22페이지를 요청하고 재시작 시 나머지 44페이지를 요청하며 파일에는 한 번씩 60개의 모든 작업이 포함되었습니다. 세 번째 주기 후에 출력 폴더에는 jobs.jsonl과 웹 캐시의 66페이지가 있었고, 예제는 이를 삭제하지 않았습니다.
using System.Text.Json;
using IronWebScraper;
var key = Environment.GetEnvironmentVariable("IRONWEBSCRAPER_LICENSE_KEY");
if (string.IsNullOrWhiteSpace(key))
{
Console.WriteLine("Missing required environment variable: IRONWEBSCRAPER_LICENSE_KEY");
return 2;
}
License.LicenseKey = key;
int stopAfter = args.Length == 2 && args[0] == "--stop-after" ? int.Parse(args[1]) : 0;
new HarborJobsScraper(stopAfter).Start();
return 0;
public sealed class HarborJobsScraper(int stopAfter) : WebScraper
{
private const string Board = "http://localhost:5481";
private readonly object _fileLock = new();
private readonly HashSet<string> _written = new();
private int _jobsThisRun;
public override void Init()
{
WorkingDirectory = "output";
RateLimitPerHost = TimeSpan.FromMilliseconds(250);
ObeyRobotsDotTxt = true;
AllowedDomains.Add("localhost");
Identities.Add(new HttpIdentity { UserAgent = "HarborJobsCrawler/1.0" });
// Pages fetched before a stop come back from output/WebCache on the next start.
EnableWebCache(TimeSpan.FromHours(12));
string jobsFile = Path.Combine(WorkingDirectory, "jobs.jsonl");
if (File.Exists(jobsFile))
{
foreach (var line in File.ReadLines(jobsFile))
{
_written.Add(JsonDocument.Parse(line).RootElement.GetProperty("id").GetString()!);
}
}
Request(Board + "/jobs/page-1.html", Parse);
}
public override void Parse(Response response)
{
foreach (var link in response.Css("article.job-card h2 a"))
{
Request(response.ToAbsoluteUrl(link.Attributes["href"]), ParseJob);
}
foreach (var next in response.Css("a[rel=next]"))
{
Request(response.ToAbsoluteUrl(next.Attributes["href"]), Parse);
}
}
public void ParseJob(Response response)
{
// The page carries an old salary in a hidden element ahead of the one it displays.
var salary = response.Css("dd.salary").Last(n => n.GetAttribute("style") is not { } s || !s.Contains("display:none"));
var job = new
{
id = response.Css("dd.job-id")[0].TextContentClean,
title = response.Css("h1.job-title")[0].TextContentClean,
company = response.Css("dd.company")[0].TextContentClean,
location = response.Css("dd.location")[0].TextContentClean,
salary = salary.TextContentClean,
postedDate = response.Css("time")[0].GetAttribute("datetime"),
closed = response.CssExists("p.closed"),
};
lock (_fileLock)
{
// ScrapeUnique drops the first record of each process, so the crawler writes the file itself.
if (_written.Add(job.id))
{
File.AppendAllText(Path.Combine(WorkingDirectory, "jobs.jsonl"), JsonSerializer.Serialize(job) + "\n");
}
if (stopAfter > 0 && ++_jobsThisRun >= stopAfter)
{
// Start never returns after Stop() in 2026.10.1, so a test stop ends the process.
Environment.Exit(0);
}
}
}
}
언제 한 에이전트 이상을 파견해야 하나요?
Harbor Jobs adds jobs every morning, and the crawler is scheduled once a day.
Divide the next part between two agents.
Agent A builds an xUnit project, HarborJobs.Crawler.Tests:
- Save the J-1004, J-1012, J-1021, J-1047 and J-1061 pages from today's board into TestData.
- Test the record each saved page produces, salary and closed flag included.
- The tests read only those files and send no request.
- Keep the test project out of the crawler's compile items.
- Run it with dotnet test HarborJobs.Crawler.Tests.
If the tests fail, stop there and tell me why.
Otherwise Agent B takes these steps:
1. Run the crawler with today's command and the existing output/ folder, as tomorrow's run would.
2. Use /browser to open page 1 of the board and each job it links to.
3. Check that every one of those jobs has a line in jobs.jsonl with the same values.
If the board and the file disagree, explain why before changing anything.
A restart on the same day still reads the cache, and the fix has to keep that.
Save screenshots in artifacts/shots-day2.
Write how many page 1 jobs matched before and after to artifacts/day2-check.md.
Tell me what each agent found.
이 프롬프트 이전에 테스트 보드는 다음 아침 목록으로 이동했으며, 페이지 1 상단에는 새 작업 2개가 있고, 급여가 변경된 일자 1개와 닫힌 작업 1건이 있었습니다.
실제 실행에서 프롬프트가 무엇을 생성했습니까?
모든 여섯 프롬프트는 주요 Antigravity CLI 대화에서 무단으로 실행되었으며, 권한 프롬프트는 건너뛰었습니다. 아래의 모든 수치는 타이밍 로그와 실행의 커밋, 요청 로그 및 재실행의 독립적인 체크에서 유래합니다.
- 첫 번째 프롬프트 전에 저장소에는 이름만 출력하는 콘솔 프로젝트가 있었습니다.
- 계획 중에 에이전트는 자체 PowerShell 요청으로 작업 페이지를 가져와 숨겨진 급여를 찾았습니다.
- 첫 번째 전체 크롤링에서는 60라인이 작성되었고, 모두 60개가 보드와 일치했습니다.
- 정지 옵션의 첫 번째 테스트는 종료되지 않았으며, 운영자가 23분 후 종료했습니다.
- 첫 번째 프롬프트에서는 크롤러 요청 간 273개의 간격 중 64개가 240ms 이내였으며 최단은 8ms였습니다.
- 두 번째 프롬프트 이후부터는 크롤러 간격이 292ms 미만으로 떨어지지 않았습니다.
- 브라우저 비교는 60개의 작업 카드를 60줄에 대해 세고 필드 차이를 찾지 못하여 수정 단계에서는 변경할 것이 없었습니다.
- 브라우저 서브에이전트의 Chrome은 robots.txt에서 불허하는 /apply/아래 125페이지를 요청했으며, 크롤러는 요청하지 않았습니다.
- 키 변수가 없을 경우 최종 크롤러는 하나의 줄을 출력하고 코드 2로 종료했습니다.
- 유효하지 않은 키로는 LicensingException이 처리되지 않고 끝났으며, 설정 프롬프트는 이를 보고하고 유지했습니다.
- 재시작 수정은 크롤 ID를 삭제하고 대기 페이지의 자체 큐를 유지했습니다.
- 세 번의 독립적인 정지 및 재시작 주기에서 최종 크롤러는 각 정지 전에 23개의 요청과 이후에 44개의 요청으로 한 번씩 60개의 작업을 모두 썼습니다.
- 다음 날의 게시판에서 첫 번째 프롬프트의 크롤러는 요청을 하지 않아 두 개의 새 작업을 놓쳤습니다.
- 그 크롤러의 파일은 새 페이지 1의 10개 작업 중 7개와 일치했습니다.
- Agent B의 수정 후 최종 크롤러는 그 게시판의 모든 60개의 작업과 일치했습니다.
- Agent A의 다섯 테스트는 게시판에 연락하지 않고 통과했습니다.
- 일부 단계는 페이지와 달리 작동했습니다. 첫 번째 프롬프트의 57.2분은 중단된 정지 테스트를 기다리는 시간을 포함했습니다. 두 번째 프롬프트부터의 모든 프롬프트는 전체 답변 후 이상한 함수 호출로 인해 ERROR 상태의 agy로 끝났습니다. Agent A는 별도의 서브에이전트로 실행되었으며, 주요 대화는 브라우저 서브에이전트와 함께 Agent B의 단계를 실행했습니다. /브라우저 서브에이전트는 실행이 시작한 헤드리스 Chrome을 사용했으며, CLI는 사용자의 프로필에서 Chrome의 DevTools 포트 파일을 찾습니다. 최종 크롤러는 완전한 크롤링 이후 캐시를 비워, 완료 후의 재실행은 모든 페이지를 다시 요청했습니다.
ChatGPT Codex는 이 가이드와 마찬가지로 AGENTS.md에서 그로잉 룰을 읽고 탐색기와 작업자 에이전트에게 작업의 명명된 부분을 위임합니다. GitHub Copilot도 요청 없이 저장된 페이지에 대해 크롤러를 테스트합니다. Antigravity의 버전, 모델, 실행 시간, 테스트 기계는 공유 실행 기록에 기록됩니다.
문제 해결
- 웹 캐시, 크롤 ID 및 제한을 위한 고급 웹스크래핑 기능
Start가 첫 요청 전에 던질 때 라이센스 키 적용- 브라우저가 크롤러로부터 절대 받지 않는 값을 표시할 때 IronWebScraper & JavaScript
- IronWebScraper가 크롤 스레드를 관리하는 방법에 대한 스레드 안전성
질문?
질문이 있으시면 support@ironsoftware.com으로 문의하세요.
커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.