Pass in the HTML you already have, then see which pages contributed to each merged contact. No URLs are fetched. The Org helper makes two pages for Example Studio: the home page lists an email and the contact page lists a phone.
dotnet add package RecursiveAI.OneContact.ExtractionRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using RecursiveAI.OneContact.Extraction; var site = new ContactExtractor().ExtractSite([ ContactPage.FromHtml("/", Org("email", "hello@example.com")), ContactPage.FromHtml("/contact", Org( "telephone", "+442079460123"))]); foreach (var record in site.Records) Console.WriteLine(string.Join(", ", record.Pages)); static string Org(string key, string value) => $$""" <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Organization", "name": "Example Studio", "{{key}}": "{{value}}" } </script> """;
The example is the full program below: unzip it and dotnet run. To run only the code above, paste it into Program.cs of a new dotnet new console project and dotnet run.
/, /contactThe full program
using RecursiveAI.OneContact.Extraction; var site = new ContactExtractor().ExtractSite([ ContactPage.FromHtml("/", Org( "email", "hello@example.com")), ContactPage.FromHtml("/contact", Org( "telephone", "+442079460123"))]); foreach (var record in site.Records) { Console.WriteLine(record.Name?.Text); Console.WriteLine(string.Join(", ", record.Pages)); foreach (var field in record.Fields) Console.WriteLine($"{field.PageId}: {field.Text}"); } static string Org(string key, string value) => $$""" <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Organization", "name": "Example Studio", "{{key}}": "{{value}}" } </script> """;
dotnet run prints:
Example Studio /, /contact /: Example Studio /: hello@example.com /contact: +442079460123
record.Pages lists contributing pages for the whole organization; field.PageId identifies the page for that particular field. Use distinct page IDs: a duplicate ID throws ArgumentException.
Variations
If you want to use field spans to highlight the original text, inspect the offset unit for each page. Insert this before the Org helper in the full program:
foreach (var page in site.Pages) Console.WriteLine($"{page.Id}: {page.OffsetUnit}");
/: Chars /contact: Chars
Related recipes
The short answer
Pass a ContactPage for each already-loaded page to ContactExtractor.ExtractSite. Read site.Records for merged contacts and record.Pages for the source pages that contributed. The page ID can be a URL or any other unique label. It is never a request to download the page.
How do you resolve duplicate contact records programmatically?
For pages from one site, OneContact extracts the records from each page, then uses matching keys to decide which records to combine. The organization name in the example joins the home page’s email to the contact page’s phone. Other matching keys include a shared non-role email and, for organizations, a non-social website. Phone numbers never decide a merge. Two organizations that list addresses but have none in common can represent separate branches: a shared email or site alone does not join them in that case, though a shared name does. The cross-page rules spell out the distinctions.
Copying every email and every phone into one list loses that distinction. Keep the result grouped by record, and don’t treat a company’s shared phone as proof that two named people are the same. OneContact doesn’t link a person to an employer just because the two appear on the same page; look at the links the extractor actually returns.
How do you get rid of duplicates without losing their source pages?
One repeated field value stays as one field on the merged record. Read Duplicates if you need the other sightings, including their individual page IDs and spans. If the site gives competing values rather than repeating one, the extractor does not choose a winner: disagreements stay flagged. A phone on one page and a different phone on another are worth reviewing rather than silently overwriting the first.
The span is local to a field’s page. For HTML passed as strings, spans count UTF-16 code units; for byte input, they count bytes. Keep the original inputs under the same IDs if you need to highlight a field later. Use site.Issues to find reported parse problems and their page IDs. An empty or partial result doesn’t imply you searched every page on the site: it only represents the pages you supplied.