IronWebScraper를 GitHub Copilot과 함께 사용하는 방법
영화 상영 일정을 모아 놓은 애그리게이터는 여러 장소의 상영 정보를 한 파일에 모아 매일 밤 목록 앱이 읽도록 합니다. 각 장소는 자체 페이지에 프로그램을 게시하고, 동일한 영화가 동시에 세 곳의 장소에서 상영될 수 있습니다. 크롤이 놓친 상영 정보는 앱에 전혀 나타나지 않습니다.
GitHub Copilot은 Visual Studio 및 VS Code에서 채팅 및 에이전트 모드로, 터미널에서는 Copilot CLI로 저장소와 함께 작동합니다. GitHub의 클라우드 에이전트는 할당된 이슈를 풀 리퀘스트로 변환합니다. IronWebScraper는 WebScraper의 서브클래스를 통해 .NET 웹사이트를 크롤링하며, Init 및 Parse을 재정의합니다. 저장소에 커밋된 지침 파일은 크롤러의 규칙을 해당 모든 영역에 전달합니다.
이 가이드는 Copilot이 크롤러를 빌드하고 유지하도록 지시하는 방법을 설명합니다. 영화 웹사이트 가이드는 크롤러가 따르는 목록 페이지, 세부 페이지 및 MetaData 패턴을 설명합니다. 여기 설명된 모든 크롤은 로컬 머신에서 제공되는 테스트 사이트를 대상으로 하며, 절대 영화관의 라이브 웹사이트가 아닙니다.
저장소 루트에서 터미널을 열고 Copilot CLI를 시작하고 프롬프트를 제출합니다. @ 언급은 Copilot CLI에서 파일을 첨부하고, Visual Studio에서의 Copilot Chat은 # 레퍼런스를 대신 사용합니다.
Build the showtimes crawler in @src/Showtimes.Scraper/ShowtimeScraper.cs.
It collects every screening from the cinema test site at http://localhost:5447/.
Directory.Packages.props already pins IronWebScraper 2026.10.1.
The crawler should do this:
- Start at the site's start page and follow each venue's pages, page 2 included.
- Write one line per screening to out/showtimes.jsonl, using the Screening class.
- Fill the venue-page fields as @docs/output-format.md describes.
- Leave the film-page fields empty for now.
Then do these steps in order:
1. Add a crawl command to @src/Showtimes.Cli/Program.cs that takes --site <url> and --out <path>.
2. Run dotnet build.
3. In the repo root, run crawl --site http://localhost:5447/ --out out/showtimes.jsonl.
Tell me how many screenings each venue has.
프롬프트에는 선택자가 지정되지 않으며, docs/output-format.md에는 모든 필드의 소스 요소가 나열되어 있습니다.
Copilot이 실행되는 환경에 IRONWEBSCRAPER_LICENSE_KEY을 설정하고, 프로그램이 이를 License.LicenseKey에 복사하도록 합니다. 허브 가이드는 IronWebScraper가 자체적으로 읽는 변수들을 명명하며, 라이선스 키 가이드는 다른 지원 위치를 나열합니다.
최소 워크플로우(5단계)
- NuGet에서 C# 웹 스크래핑 라이브러리 다운로드
- 크롤 규칙을 .github/copilot-instructions.md 및 경로별 지침 파일 하나에 작성하세요.
- 각 영화 페이지를 한 번 요청하고 해당 영화의 모든 상영에 세부 정보를 복사합니다.
- Init에서 시작 페이지 하나를 요청하고, 다른 모든 페이지를 파싱 메서드에서 대기열에 추가합니다.
- 다음 변경사항을 클라우드 에이전트에 이슈로 할당하고 IronWebScraper API 레퍼런스를 기준으로 풀 리퀘스트를 확인하세요.
IronWebScraper의 규칙을 Copilot에 어떻게 설정합니까?
프로젝트 전역의 규칙을 .github/copilot-instructions.md에 배치합니다. GitHub의 지원 참조는 Visual Studio, VS Code 및 JetBrains IDE의 Copilot Chat과 클라우드 에이전트 및 Copilot 코드 검토에 해당 파일을 나열합니다. Copilot CLI는 동일한 위치에서 그것을 읽습니다.
This repo holds the showtimes crawler, which gathers cinema screenings into one file.
Follow these rules in every change:
- Use IronWebScraper for all crawling and HTML parsing, never HttpClient.
- Don't add AngleSharp, HtmlAgilityPack or another scraping package.
- Change the IronWebScraper version in Directory.Packages.props only in an upgrade task.
- The showtimes crawler and its tests read IRONWEBSCRAPER_LICENSE_KEY into License.LicenseKey.
- IronWebScraper won't read that variable name on its own, so set the key before Start.
- Keep the key out of all output, logs included.
- Don't list environment variables.
- Crawl only the site a task names, which is http://localhost:5447/ in development.
- Tests crawl TestData/site through a local HTTP listener and never touch that address.
- Keep RateLimitPerHost at one second.
- Write records with WebScraper.Scrape, not with a JSON writer of your own.
- Treat docs/output-format.md as the contract for out/showtimes.jsonl.
- If the contract looks wrong, tell me and leave the file alone.
- Read the IronWebScraper docs for agents at https://ironsoftware.com/webscraper/csharp/llms.txt
비율 제한 규칙은 모든 크롤의 요청 간격을 설정합니다. 기본 RateLimitPerHost 50밀리초에서, 한 프로브 크롤이 0.048에서 0.064초 간격으로 테스트 사이트에 도달했습니다. 1초일 때, 간격은 1.02에서 1.10초로 측정되었습니다.
크롤러에 자체 규칙을 부여하는 방법은?
.github/instructions/scraper.instructions.md과 같은 파일은 applyTo 패턴이 이름을 지정한 트리 부분의 규칙을 보유하며, 여기에는 크롤러와 테스트가 포함됩니다. GitHub의 문서에 따르면, Copilot CLI는 해당 패턴 중 하나와 일치하는 파일에서 작동할 때만 파일을 포함합니다.
---
applyTo: "src/**/*,tests/**/*"
---
The crawler and its tests rely on IronWebScraper 2026.10.1, which behaves like this:
- A crawl fetches each URL once per parse method.
- A second Request for that URL with the same parse method is dropped, even with new MetaData.
- MetaData passes the parse method the same object instance, not a copy.
- When a parse method throws, the page is fetched and parsed again, up to 8 more times.
- Each retry repeats every Scrape call made before the throw.
- A URL that answers 500 is requested 9 times, and its parse method is never called.
- Css throws an XPathException on a selector with two > combinators, such as div > p > a.
- TextContentClean returns entities such as é unchanged.
Follow these rules in this code:
- Request each film page once and copy its details onto every screening of that film.
- Decode text from TextContentClean with WebUtility.HtmlDecode.
해당 파일에 나열된 각 동작은 테스트 사이트에 대한 프로브에서 비롯됩니다.
IronWebScraper는 세 곳의 장소가 링크한 영화 페이지를 어떻게 처리합니까?
장소 페이지는 모든 영화를 한 영화 페이지에 링크하므로, 하버 라이트를 상영하는 세 곳의 장소가 동일한 URL에 링크됩니다.
Fill in the film-page fields on every line the crawler writes.
They are RuntimeMinutes, Genres and Rating, and @docs/output-format.md gives the source of each.
Follow this guide for the detail requests:
https://ironsoftware.com/webscraper/csharp/how-to/scraping-from-an-online-movie-website/
Two things about the test site matter here:
- Harbour Lights plays at all three venues, and all 6 of its screenings need the runtime.
- The Night Train to Arles page answers 500 on purpose.
Keep the Night Train to Arles screening, with its film fields empty.
Then run the crawl again with --out out/details/showtimes.jsonl.
Tell me how many lines got a runtime, and which film's lines didn't.
IronWebScraper는 전체 크롤에 대해 파싱 메서드별로 URL을 한 번 가져옵니다. 프로브에서 세 곳의 장소가 같은 파싱 메서드와 다른 MetaData로 하버 라이트 페이지를 요청했으며, 사이트는 한 번의 요청을 받았습니다. 파싱 메서드는 첫 번째 장소의 MetaData만 봤으므로, 다른 두 장소의 상영은 세부 정보를 받지 못했습니다. 다른 파싱 메서드를 사용하여 요청된 동일 URL은 다시 가져왔으며, 다른 쿼리 스트링이 있는 페이지도 마찬가지였습니다.
영화 가이드의 세부 파서는 가이드 자체의 마크업에서 실패합니다. 그 장르 선택자 div > p > a와 배우 선택자 div > p:nth-child(2) > a 모두 XPathException을 발생시켰습니다. IronWebScraper는 두 개의 자식 결합자가 있는 선택자를 거부하기 때문입니다. 하나의 결합자가 있는 선택자, 예를 들어 div.mvici-left > p는 작동했습니다.
IronWebScraper는 파싱 메서드가 예외를 던지는 페이지를 다시 시도하며, 로드에 실패한 페이지도 마찬가지입니다. 프로브에서, 한 페이지에 대해 파싱 메서드가 9번 호출되었으며, throw 전에 수행된 Scrape 호출은 9줄을 썼습니다.
산출
브라우저에서는 리버사이드 장소 페이지가 악센트가 있는 문자로 그 이름을 표시합니다. 페이지 소스는 그 문자를 명명된 HTML 엔터티로 작성하고, TextContentClean은 엔터티를 변함없이 반환했습니다.

로컬 테스트 사이트에서 Microsoft Edge로 캡처된 리버사이드 장소의 1페이지입니다. 사이트의 모든 영화 및 장소는 허구입니다.

두 번째 프롬프트가 작성한 대로 줄 번호가 있는 하버 라이트 및 아를르행 야간 열차 줄의 out/details/showtimes.jsonl.
실제 사이트 없이 크롤러를 테스트하는 방법은?
Shift+Tab을 사용하여 Copilot CLI를 계획 모드로 전환한 후 이 프롬프트를 제출합니다.
Plan a new xUnit project, tests/Showtimes.Tests, listed in Showtimes.slnx.
Show me the plan, and don't write code until I say go.
The tests' local listener must answer 500 for /film/night-train-to-arles-20790/, like the test site.
Each test runs ShowtimeScraper and checks one of these:
- Northgate Picturehouse has 10 screenings, and the other two venues have 7 each.
- The Riverside venue name has no HTML entity left in it.
- All 6 Harbour Lights screenings have a RuntimeMinutes of 112.
- The Night Train to Arles screening is still there, with a null RuntimeMinutes.
After my go, write the tests and rerun dotnet test until every one passes.
Then give me the number that pass.
TestData/site의 robots.txt는 테스트 크롤에 영향을 미치지 않습니다. IronWebScraper는 시작 URL의 포트 없이 robots.txt를 요청하므로, 임의의 포트에 있는 리스너는 결코 해당 규칙을 제공하지 않습니다. 포트 80에 있는 리스너와 함께, 프로브 크롤이 이것을 읽고 허용되지 않은 /booking/페이지를 건너뛰었습니다. Claude Code 가이드에서 이 동작을 완전히 설명합니다.
왜 어떤 실행에서는 장소가 누락됩니까?
이 시나리오에서는 팀원의 tools/VenueCheck가 야간 크롤 전에 세 장소 페이지를 요청하며 응답하지 않는 장소를 보고합니다.
tools/VenueCheck reports a venue as DOWN on some runs, though the site is up.
It checks the three venue pages listed in tools/VenueCheck/venues.json.
Find out why and fix it.
Before you fix anything, do these steps in order:
1. Run it five times against http://localhost:5447/ and note which venues came back DOWN.
2. Turn on LogLevel.All and find out what IronWebScraper does with the Request calls in Init.
3. Tell me the cause.
Keep the fix within these limits:
- Change files in tools/VenueCheck only.
- Add no sleep, and keep a single call to Start.
Then run it five more times and show me the results.
IronWebScraper는 Init에서 수행된 모든 요청을 유지하지 않습니다. Init에서 세 장소 URL을 요청하여 크롤이 26번의 프로브 실행 중 1번에서 모두 가져왔고, 다른 25번에서는 1개 또는 2개를 가져왔습니다. 이 26번의 실행은 수정 전 커밋된 8번의 tools/VenueCheck 실행과 18번의 프로브 크롤러 실행을 결합합니다. 로그는 세 개의 요청을 나열하고 두 개 후에 크롤이 완료되었다고 보고하였으며, 건너뛴 URL은 서버에 도달하지 못했습니다. 파싱 메서드에서 수행된 요청은 절대 손실되지 않았습니다. Init에서 첫 번째 장소를 요청하고 나머지 두 개의 장소를 해당 파싱 메서드에서 요청하면 8번의 실행 중 8번 모두에서 세 개의 장소가 반환되었습니다.
클라우드 에이전트가 작동할 수 있는 문제는 무엇입니까?
GitHub에 따르면, Copilot에 할당된 이슈는 에이전트에 제목, 설명, 할당 시점의 댓글 및 그 당시 제공된 모든 지침을 전달합니다. 이후에 추가된 댓글은 에이전트에 도달하지 않으므로, 이슈 본문은 전체 요청을 담아야 합니다.
Title: A second crawl must not double out/showtimes.jsonl
Files: src/Showtimes.Scraper and tests/Showtimes.Tests
Versions: net9.0 with IronWebScraper 2026.10.1
Background: IronWebScraper's Scrape appends to the file it writes and never empties it.
Without a cleanup step, a second crawl to the same --out path leaves 48 lines instead of 24.
Expected: after any crawl, the output file holds exactly one line per screening.
Constraint: the crawl command keeps its options.
Acceptance: close the issue once these are true:
- Two crawls in a row leave the same 24 lines, in any order.
- A new test crawls twice into one temp folder and counts the lines.
- dotnet test passes.
Summary: say where the old output gets cleared, and why there.
왜 클라우드 에이전트의 테스트가 IronWebScraper 프로젝트에서 실패합니까?
크롤을 위한 테스트는 클라우드 에이전트의 환경에서 라이선스 키가 필요합니다. GitHub의 문서에서는 해당 환경을 기본적으로 Ubuntu Linux로 설명하고 있으며, .github/workflows/copilot-setup-steps.yml의 copilot-setup-steps 작업이 이를 준비할 수 있습니다. 작업은 Copilot이 시작되기 전에 GitHub Actions에서 실행되며, 해당 파일이 기본 브랜치에 있지 않으면 워크플로우가 트리거되지 않습니다. 설정 단계가 실패하면 Copilot은 남은 설정 단계를 건너뛰고 그대로 환경에서 작업을 시작합니다.
Create the cloud agent's setup workflow in .github/workflows/copilot-setup-steps.yml.
Call its job copilot-setup-steps, because GitHub skips a job with any other name.
The job needs these settings:
- The runner is ubuntu-latest.
- The workflow token has contents: read and nothing else.
- workflow_dispatch triggers it, and so does a pull request that edits the file.
Its steps go in this order:
1. Check out the code.
2. Install .NET 9.
3. Run dotnet restore, then dotnet build -c Release.
4. Look for the license key.
The key is IRONWEBSCRAPER_LICENSE_KEY, saved as an Agents secret.
The job gets it as an environment variable already, so skip the secrets context.
When the key is missing, the last step behaves like this:
- On pull_request or workflow_dispatch, it logs a warning and passes.
- On any other event, it fails with an error naming the secret.
Show me the finished YAML, and don't try to run the workflow.
에이전트 비밀로 키 저장: GitHub에 따르면, 클라우드 에이전트는 Actions, Codespaces 또는 Dependabot 비밀에 접근할 수 없습니다. 저장소의 설정에서 보안 섹션의 비밀 및 변수 열기, 에이전트 선택 및 비밀 탭에 IRONWEBSCRAPER_LICENSE_KEY 추가. GitHub 상태에 따르면 이러한 비밀은 'Copilot에 환경 변수로 노출되며', Copilot이 실행하는 스크립트와 도구, 'copilot-setup-steps.yml 워크플로우'에 의해 사용될 수 있습니다. 문서에서는 프롬프트가 가정한 env 매핑 없이 워크플로 단계가 이를 읽는다는 언급이 없습니다.
병합 전에 무엇을 확인해야 합니까?
코드를 작성한 세션 외부에서 별도의 copilot -p 명령으로 검토를 실행하세요.
/review the changes on this branch compared with main.
Check the code against these three files:
- .github/copilot-instructions.md
- .github/instructions/scraper.instructions.md
- IronWebScraper.xml in the IronWebScraper package of the NuGet cache
Also look for two patterns that neither instructions file covers:
- an Init method that calls Request more than once
- a crawl that starts with an old output file still in place
List every mismatch you find, or say that nothing came up.
Don't change any file.
실제 실행에서 프롬프트가 무엇을 생성했습니까?
7개의 프롬프트가 Copilot CLI에서 이 가이드를 위해 구축한 쇼타임 저장소 및 로컬 테스트 사이트에서 무인 상태로 실행되었습니다. 아래 모든 수치는 Copilot의 응답이 아닌 출력 파일, 사이트의 요청 로그 및 저장소에서 나옵니다.
- 실행 전, CLI는 사용행을 인쇄하고 코드 1로 종료했습니다.
- 첫 번째 프롬프트 후, out/showtimes.jsonl은 24번의 상영 시간을 보유했으며, Northgate Picturehouse에서 10번, 나머지 두 곳에서 각각 7번의 상영이 있었습니다.
- 두 번째 프롬프트의 크롤에서, 각 영화 페이지는 한 번의 요청을 받았으며, 아를르행 야간 열차는 9번의 요청을 받고 각각 500을 응답했습니다.
- 두 번째 프롬프트에서 가져온 파일에는 24줄이 있었고, 그 중 23줄이 러닝타임을 포함했습니다.
- 아를르행 야간 열차의 상영은 러닝타임, 장르 목록 및 평점이 빈 상태로 남았습니다.
- 6번의 하버 라이트 상영 모두, 세 장소에서 112분의 러닝타임을 제공했습니다.
- 계획 모드에서는 Copilot이 계획을 작성했으며 파일을 변경하지 않고 승인 메시지를 기다렸습니다.
- 세 번째 프롬프트에서 4개의 테스트가 단 한 번의 테스트 사이트 요청도 없이 성공했습니다.
- 수정 전 VenueCheck는 5번의 검사 실행 중 4번에서 한 개 또는 두 개의 장소가 다운되어 있다고 보고했습니다.
- 수정에서는 Init에서 한 번의 Request 호출만 남기고 파싱 메서드에서 그 다음 장소를 요청했습니다.
- 고쳐진 검사의 10번 실행 중 10번 모두에서 세 장소 모두 응답했습니다.
- 첫 번째 장소에서 500이 응답될 때, 고쳐진 VenueCheck는 3번의 실행에서 세 장소 모두가 다운되었다고 보고했습니다.
- 다른 두 개의 장소 페이지는 그 실행에서 요청을 받지 못했습니다.
- 이슈 세션은 새로운 테스트를 추가하고 크롤러는 변경하지 않았습니다. 초기 프롬프트 이후에 Init이 이전 출력을 삭제했기 때문입니다.
- 최종 저장소의 5가지 테스트는 키가 설정된 상태에서 통과했으며, 없을 때 실패했습니다.
- 검토 세션은 불일치를 보고하지 않았고 파일을 변경하지 않았습니다. 이전 프롬프트 이후에 찾고 있던 패턴이 남아 있지 않았기 때문에, 이 실행은 검토가 그것들을 찾는지 여부를 테스트하지 않았습니다.
- 일부 단계는 페이지와 달리 작동했습니다. 이슈 본문은 테스트 저장소에 GitHub 원격이 없으므로 새로운 Copilot CLI 세션으로 이동했습니다. 설치 워크플로우는 작성되었지만 동일한 이유로 실행되지 않았습니다.
Cursor는 또한 커밋된 규칙을 이름이 지정된 경로에 맞추고, Claude Code는 또한 프로젝트를 편집하기 전에 승인 계획을 보유합니다. 공유 실행 기록은 Copilot CLI 릴리스, 선택된 모델 Auto, 지속 시간 및 테스트 머신을 나열합니다.
문제 해결
- 온라인 영화 웹사이트 크롤링하는 방법으로
MetaData패턴과 함께 목록 및 세부 페이지 - 라이선스 키 적용으로
Start에서 라이선싱 예외를 던지는 크롤에 대한 내용 - 스레드 안전으로 크롤의 연결 및 비율 제한
질문?
질문이 있으시면 support@ironsoftware.com으로 문의하세요.
커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.