Files
bom-local-service/Services/Interfaces/IScrapingService.cs
T
alex 41e1f6d685 Implement multi-frame radar capture with configurable cropping
- Capture all 7 radar frames (0-6) instead of single screenshot
- Store frames in folder-based cache structure with metadata
- Extract and store minutesAgo for each frame from page display
- Add configurable screenshot cropping (default: 200px left/right)
- Fix step numbering to use whole numbers (1-22)
- Add scrubber position verification before frame capture
- Handle modal overlay blocking step forward button clicks
- Only create debug folders when scraping is actually needed
- Update API endpoints to return JSON with frame URLs
- Add separate endpoints for individual frame images
2025-12-07 12:51:44 +10:00

35 lines
1.8 KiB
C#

using BomLocalService.Models;
using Microsoft.Playwright;
namespace BomLocalService.Services.Interfaces;
/// <summary>
/// Service interface for scraping radar screenshots from the BOM website.
/// Orchestrates the multi-step process of navigating BOM, finding locations, and capturing radar screenshots.
/// </summary>
public interface IScrapingService
{
/// <summary>
/// Scrapes a radar screenshot from the BOM website for a given location.
/// Performs the complete workflow: navigates to BOM, searches for location, navigates to radar page,
/// waits for map to render, captures screenshot, extracts metadata, and saves to cache.
/// </summary>
/// <param name="suburb">The suburb name (e.g., "Pomona", "Brisbane")</param>
/// <param name="state">The Australian state abbreviation (e.g., "QLD", "NSW", "VIC")</param>
/// <param name="debugFolder">Folder path for saving debug files (screenshots, HTML, logs) if debug mode is enabled</param>
/// <param name="page">The Playwright page instance to use for scraping</param>
/// <param name="consoleMessages">List to capture console messages from the browser (for debugging)</param>
/// <param name="networkRequests">List to capture network request information (for debugging)</param>
/// <param name="cancellationToken">Cancellation token to cancel the operation</param>
/// <returns>Radar screenshot response with image path and metadata</returns>
Task<RadarResponse> ScrapeRadarScreenshotAsync(
string suburb,
string state,
string debugFolder,
IPage page,
List<(string type, string text, DateTime timestamp)> consoleMessages,
List<(string method, string url, int? status, string resourceType, DateTime timestamp)> networkRequests,
CancellationToken cancellationToken = default);
}