IronWebScraper'ı GitHub Copilot ile Kullanma

Curtis Chau
Curtis Chau
Güncellendi: 26 Ekim 2026

Bir sinema seansları toplayıcı, birkaç yerin gösterimlerini bir dosyada toplar ve bu dosya her gece bir listeleme uygulaması tarafından okunur. Her mekan, programını kendi sayfalarında yayınlar ve aynı film üç mekanda birden oynayabilir. Tarama kaçırdığı bir gösterim uygulamada hiç görünmez.

GitHub Copilot, Visual Studio ve VS Code'da sohbet ve ajan modu ile ve bir terminalde Copilot CLI aracılığıyla depo ile çalışır. GitHub üzerindeki bulut ajanı, atanmış bir sorunu bir pull request'e dönüştürür. IronWebScraper, .NET'ten bir WebScraper sınıfı aracılığıyla web sitelerini tarar ve Init ve Parse'i geçersiz kılar. Depoya işlenen talimat dosyaları, tarayıcının kurallarını bu yüzeylerin her birine taşır.

Bu kılavuz, Copilot'u tarayıcıyı oluşturmak ve sürdürmek için yönlendirmeyi kapsar. film web sitesi kılavuzu, tarayıcının takip ettiği liste sayfası, detay sayfası ve MetaData modelini açıklar. Burada tanımlanan her tarama, yerel makinede sunulan bir test sitesini hedefler, asla bir sinemanın canlı web sitesini değil.

Hızlı Başlangıç
NuGetNuGet ile Yükle

PM > Install-Package IronWebScraper

Yukarıdaki komutu NuGet Paket Yöneticisi Konsolunda çalıştırarak veya NuGet Paket Yöneticisinde arama yaparak IronWebScraper'u yükleyin.

Depo kökünde bir terminal açın, Copilot CLI başlatın ve istemi gönderin. @ belirtileri, adlandırılmış dosyaları Copilot CLI'ye ekler ve Visual Studio'daki Copilot Chat bunun yerine # referanslarını alır.

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.
Text

Komut isimlendirmesi hiçbir seçiciyi belirtmez, çünkü docs/output-format.md her alanın kaynak elemanını listeler.

Copilot'un çalıştığı ortama IRONWEBSCRAPER_LICENSE_KEY ayarlayın ve programın bunu License.LicenseKey'e kopyalamasını sağlayın. hub kılavuzu, IronWebScraper'ın kendisinin okuduğu değişkenleri adlandırırken, lisans anahtarı kılavuzu, diğer desteklenen konumları listeler.



Copilot için IronWebScraper geleneklerini nasıl belirlersiniz?

Proje çapındaki kuralları .github/copilot-instructions.md içine yerleştirin. GitHub'un destek referansı, bu dosyayı Visual Studio, VS Code ve JetBrains IDE'lerindeki Copilot Sohbeti için ve bulut ajanı ve Copilot kod incelemesi için listeler. Copilot CLI onu aynı konumdan okur.

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
Markdown

Hız sınırlama kuralı, her taramadaki istekler arasındaki aralığı belirler. 50 milisaniyelik varsayılan RateLimitPerHost'de, bir deneme taraması, 0,048 ile 0,064 saniye arasında isteklerle test sitesine ulaştı. Bir saniyede, boşluklar 1,02 ile 1,10 saniye arasında ölçüldü.

Tarayıcıya kendi kurallarını nasıl verirsiniz?

.github/instructions/scraper.instructions.md gibi bir dosya, ağacın applyTo modellerinin adını taşıdığı kısımları için kurallar tutar, burada tarayıcı ve testleridir. GitHub belgelerine göre, Copilot CLI, yalnızca bu desenlerden biriyle eşleşen bir dosyayla çalışırken dosyayı dahil eder.

---
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 &eacute; 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.
Markdown

O dosyada listelenen her davranış, test sitesine karşı yapılan bir sonda gelir.

IronWebScraper üç mekanın bağlantı verdiği bir film sayfası ile ne yapar?

Mekan sayfaları her filmi bir film sayfasına bağlar, bu nedenle Harbour Lights'ı gösteren üç mekan aynı URL'ye bağlantı verir.

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.
Text

IronWebScraper, bir taramanın tamamı için her ayrıştırma metodu başına bir URL getirir. Denemede, üç mekan aynı ayrıştırma yöntemi ve farklı MetaData ile Harbour Lights sayfasını talep etti ve site bir istek aldı. Ayrıştırma metodu yalnızca ilk mekanın MetaData'unu gördü, bu yüzden diğer iki mekanın gösterimleri hiçbir zaman ayrıntı almadı. Farklı bir ayrıştırma yöntemi ile talep edilen aynı URL yeniden getirildi ve farklı bir sorgu dizgesi ile sayfa da öyle.

Film kılavuzunun detay ayrıştırıcısı, kılavuzun kendi işaretlerinde başarısız oldu. Tür seçicisi div > p > a ve oyuncu seçicisi div > p:nth-child(2) > a, IronWebScraper iki çocuk kombinatori ile bir seçiciyi reddettiği için bir XPathException attı. Tek bir kombinator ile seçiciler, div.mvici-left > p gibi, çalıştı.

IronWebScraper, yüklenemeyen bir sayfa gibi bir ayrıştırma metodu atan bir sayfayı yeniden dener. Denemede, ayrıştırma metodu bir sayfa için 9 kez çağrıldı ve atma öncesinde yapılan bir Scrape çağrısı 9 satır yazdı.

Çıktı

Bir tarayıcıda, Riverside mekan sayfası adını aksanlı bir harfle göstermektedir. Sayfa kaynağı o harfi adlandırılmış bir HTML varlığı olarak yazar ve TextContentClean varlığı değişmeden döndürdü.

Üç film ve gösterim saatleri ile yerel test sitesinin Riverside mekan sayfası

Microsoft Edge'de yakalanan yerel test sitesinde Riverside mekanının 1. sayfası. Sitedeki tüm filmler ve mekanlar kurgusaldır.

Harbour Lights'ın üç mekanda ve Night Train to Arles'ın boş film alanlarına sahip olduğu showtimes JSONL dosyasının yedi satırı

out/details/showtimes.jsonl'ın Harbour Lights ve Night Train to Arles satırları, ikinci promptun onları yazdığı şekilde, dosyadaki satır numaraları ile birlikte.

Tarayıcıyı canlı site olmadan nasıl test edersiniz?

Plan moduna geçmek için Shift+Tab kullanarak Copilot CLI'yı döndürün, ardından bu istemi gönderin.

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.
Text

TestData/site içindeki robots.txt bir test taraması üzerinde etkili değildir. IronWebScraper robots.txt'yi başlangıç URL'sinin portu olmadan talep eder, bu nedenle rastgele bir portta bir dinleyici asla bu kuralları sunmaz. Port 80'de bir dinleyici ile bir deneme taraması onları okudu ve izin verilmeyen /booking/sayfasını atladı. Claude Code kılavuzu bu davranışı tam olarak kapsar.

Bir mekan bazı çalışmalarda neden kaybolur?

Bu senaryoda, bir takım arkadaşı, nightly taramasından önce üç mekan sayfasını tools/VenueCheck talep eder ve yanıt vermeyen herhangi bir mekanı bildirir.

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.
Text

IronWebScraper her yapılan isteği Init'da saklamaz. Init'den istenen üç mekan URL'si ile, tarama 26 deneme çalışmasının 1'inde üçünü de indirdi ve kalan 25'inde bir ya da ikisini. Bu 26 çalışma, düzeltme öncesi işlenmiş haliyle bir deneme tarayıcısının 18 çalışmasını tools/VenueCheck'in 8 çalışması ile birleştirir. Günlük üç isteği listeledi ve iki tamamlandıktan sonra taramanın tamamlandığını bildirdi, atlanan URL'ler asla sunucuya ulaşmadı. Bir ayrıştırma metodundan yapılan istekler asla kaybolmadı. Init'dan ilk mekanı ve diğer ikisini ayrıştırma metodundan talep etmek, 8 çalışmanın 8'inde tüm üç mekanı geri döndürdü.

Bulut ajanının etkili olduğu bir sorun ne yapar?

GitHub'a göre, Copilot'a atanan bir sorun ajana başlığını, tanımını, atama sırasında mevcut olan yorumları ve o noktada verilen talimatları aktarır. Sonradan eklenen yorumlar ajana ulaşmaz, bu nedenle sorun gövdesi tüm isteği içermelidir.

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.
Markdown

Bulut ajanının testleri neden bir IronWebScraper projesinde başarısız olur?

Tarayıcı ihtiyaç duyan testlerin bulut ajanının ortamında lisans anahtarını ihtiyacı vardır. GitHub'ın belgeleri o ortamı varsayılan olarak Ubuntu Linux olarak tanımlar ve .github/workflows/copilot-setup-steps.yml içindeki copilot-setup-steps işi onu hazırlayabilir. İş GitHub Actions'ta Copilot çalışmaya başlamadan önce çalışır ve dosya varsayılan dalda olmadıkça iş akışı tetiklenmez. Bir kurulum adımı başarısız olduğunda, Copilot kalan kurulum adımlarını atlar ve mevcut haliyle ortamında çalışmaya başlar.

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.
Text

Anahtarı bir Agents gizli olarak saklayın: GitHub'a göre bulut ajanın Actions, Codespaces veya Dependabot gizlilerine erişimi yoktur. Depo Ayarlarında, Güvenlik bölümünde Gizlilik ve değişkenleri açın, Ajanlar'ı seçin ve Gizlilik sekmesinde IRONWEBSCRAPER_LICENSE_KEY ekleyin. GitHub, bu gizlilerin "ortam değişkenleri olarak Copilot'a açıldığını" belirtir ve Copilot'un çalıştırdığı scriptler ve araçlar tarafından kullanılabileceğini söyler, "copilot-setup-steps.yml iş akışı dahil." Belgeler, üstteki komutun varsaydığı bir env eşlemesi olmadan bir iş akışı adımının birini okuduğunu söylemiyor.

Birleştirmeden önce neyi kontrol etmelisiniz?

Kodun yazıldığı oturumun dışında ayrı bir copilot -p komutu olarak incelemeyi çalıştırın.

/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.
Text

Gerçek bir çalıştırmada istemler ne üretti?

Yedi komut, bu kılavuz için oluşturulmuş test sitesi ve showtimes deposuna karşı Copilot CLI ile denetimsiz şekilde çalıştı. Aşağıdaki her rakam, çıktı dosyalarından, sitenin istek günlüğünden ve depodan gelir, Copilot'un yanıtlarından değil.

  • Çalıştırmadan önce CLI bir kullanım satırı yazdırdı ve 1 kodu ile çıkış yaptı.
  • İlk komuttan sonra, out/showtimes.jsonl 24 gösterime sahipti, Northgate Picturehouse'da 10 ve diğer iki mekanda 7'şer.
  • İkinci komutun taramasında, her film sayfası bir istek aldı, Night Train to Arles dışında, o 9 istek aldı ve her birine 500 yanıtı verdi.
  • İkinci komuttan gelen dosya 24 satır içeriyordu ve 23'ünde bir çalışma süresi vardı.
  • Night Train to Arles gösterimi, boş bir çalışma süresi, tür listesi ve derecelendirmesi ile kaldı.
  • Harbour Lights'ın üç mekanda, 6 gösteriminin tamamı 112 dakikalık çalışma süresine sahipti.
  • Plan modunda, Copilot bir plan yazdı, dosya değiştirmedi ve onay mesajını bekledi.
  • Üçüncü komuttan 4 test, hiçbir test sitesine yapılan istek olmadan geçti.
  • Düzeltmeden önce, VenueCheck 5 kontrol çalışmasının 4'ünde bir ya da iki mekanı kapalı olarak bildirdi.
  • Düzeltme, Init'te bir İstek çağrısı bıraktı ve her bir sonraki mekanı ayrıştırma metodundan talep etti.
  • Sabit kontrolün 10 çalışmasının 10'unda üç mekan da yanıt verdi.
  • İlk mekan 500 yanıt verdiğinde, sabit VenueCheck, üç mekanın da kapalı olduğunu 3 çalışmanın 3'ünde bildirdi.
  • O çalışmalarda diğer iki mekan sayfası hiç istek almadı.
  • Sorun oturumu yeni testi ekledi ve tarayıcı değişmeden kaldı, çünkü ilk komuttan bu yana Init, eski çıkışı silmişti.
  • Son depodaki 5 test, anahtar ayarlandığında geçti ve ayarlanmadan başarısız oldu.
  • İnceleme oturumu hiçbir uyumsuzluk bildirmedi ve hiçbir dosyayı değiştirmedi. Aradığı iki model, daha önceki komutlardan sonra kalmadı, bu nedenle bu çalıştırma, incelemenin onları bulup bulamadığını test etmedi.
  • Bazı adımlar sayfadan farklı çalıştı. Sorunun gövdesi, test deposunun hiçbir GitHub uzaktan erişimi olmaması nedeniyle yeni bir Copilot CLI oturumuna gitti. Kurulum iş akışı yazıldı ama çalıştırılmadı, aynı nedenle.

Cursor ayrıca adlandırdığı yollar için işlenmiş kuralları kapsamaktadır ve Claude Code, projeyi düzenlemeden önce onay için bir plan da tutar. paylaşımlı çalışma kaydı, Copilot CLI sürümünü, Otomatik seçilen modeli, süresini ve test makinesini listeler.


Hata Ayıklama


Sorular?

Herhangi bir sorunuz varsa, support@ironsoftware.com adresinden bize ulaşın

Curtis Chau, Bilgisayar Bilimleri alanında Lisans Derecesine (Carleton Üniversitesi) sahip ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirmeyle ilgileniyor. Sezgisel ve estetik açıdan hoş kullanıcı arayüzleri oluşturma tutkunu, Curtis modern çerçevelerle çalışmayı ve iyi yapılandırılmış, görsel olarak çekici kılavuzlar oluşturmayı seviyor.

Daha Fazla Oku

Başlamaya Hazır mısınız?

NuGet İndirmeleri 150,061Sürüm:2026.11yeni çıktı