Ricerca dei profili con suggerimenti e foto (#37)
verifica / controlli (push) Successful in 20s
verifica / prove (push) Failing after 19m40s
verifica / installatore (push) Skipped
verifica / immagine (push) Skipped

«Aggiungi account» ha una sola casella: mentre Alberto scrive compaiono
subito i suggerimenti locali, poi i profili di Instagram con la foto, come
chiesto in #37. Il browser di Febe scrive nella casella «Cerca» di Instagram
con tasti veri da una mappa chiusa (mai Invio, Tab o Esc), controlla prima
il fuoco, legge la risposta della pagina e non clicca mai un risultato.

La ricerca ha una categoria propria nel Governatore, con tetti larghi che
non consumano quelli della raccolta, e si dà il turno con il motore
sull'unica pagina; a fine sessione la pagina torna comunque al riposo. Le
foto passano dal CDN con un permesso ciascuna e restano solo in memoria.

Le risposte di Alberto del 15 novembre (controllo del fuoco, turni, evento
requestWillBeSent, niente foto dei seguiti per ora) sono in §6.1 e in
docs/decisioni.md. Su Instagram vero la ricerca parte quando i bersagli
search-open e search-box saranno raccolti dal vivo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-15 16:30:03 +01:00
1 parent 5e417c666d
commit 9941a2fa1f
98 files changed
+8021 -229

No files matched your search

+69 -3
View File
@@ -9,6 +9,7 @@ using Febe.Core.Collection.Diagnostics;
using Febe.Core.Collection.Downloads;
using Febe.Core.Collection.Readers;
using Febe.Core.Collection.Recipes;
using Febe.Core.Collection.Search;
using Febe.Core.Domain;
using Febe.Core.Engine;
using Febe.Core.Library;
@@ -91,6 +92,18 @@ public sealed record CollectionPipelineOptions
/// recipes, the stop signals and the download queue. Null: nothing is recorded.
/// </summary>
public CollectionDiagnostics? Diagnostics { get; init; }
/// <summary>
/// The turns of the one page shared by the recipes and the profile search (issue #37). Null: no profile search
/// (the pipeline builds no search runner).
/// </summary>
public PageTurns? PageTurns { get; init; }
/// <summary>Times and bounds of the profile search.</summary>
public ProfileSearchOptions SearchOptions { get; init; } = ProfileSearchOptions.Default;
/// <summary>Where the photos of the search results are kept (memory). Null: the search fetches no photo.</summary>
public SearchPhotoCache? SearchPhotos { get; init; }
}
/// <summary>
@@ -101,8 +114,10 @@ public sealed class CollectionPipeline : IAsyncDisposable
{
private readonly List<IDisposable> _subscriptions = [];
private CollectionPipeline(ResponseTap tap, SignalDetector signals, CaptureCollector capture, BrowserPageDriver driver, RecipeRunner runner, DownloadQueue downloads, SiteMap siteMap, TargetMap targets)
private CollectionPipeline(ResponseTap tap, SignalDetector signals, CaptureCollector capture, BrowserPageDriver driver, RecipeRunner runner, DownloadQueue downloads, SiteMap siteMap, TargetMap targets, ProfileSearchRunner? search, SearchPhotoQueue? searchPhotos)
{
Search = search;
SearchPhotos = searchPhotos;
Tap = tap;
Signals = signals;
Capture = capture;
@@ -126,6 +141,12 @@ public sealed class CollectionPipeline : IAsyncDisposable
public DownloadQueue Downloads { get; }
/// <summary>The browser half of the profile search (issue #37); null without <see cref="CollectionPipelineOptions.PageTurns"/>.</summary>
public ProfileSearchRunner? Search { get; }
/// <summary>The photo queue of the profile search; null without a photo cache.</summary>
public SearchPhotoQueue? SearchPhotos { get; }
public SiteMap SiteMap { get; }
public TargetMap Targets { get; }
@@ -169,18 +190,58 @@ public sealed class CollectionPipeline : IAsyncDisposable
Breaker = options.Breaker,
Options = options.Recipes,
Diagnostics = diagnostics,
PageTurns = options.PageTurns,
});
var fetcher = new BrowserFileFetcher(options.Cdp, site.Hosts, options.Log);
var downloads = new DownloadQueue(
options.Storage,
options.Ingest,
new BrowserFileFetcher(options.Cdp, site.Hosts, options.Log),
fetcher,
options.DataBudget,
options.Clock,
options.Random,
new DownloadOptions { StagingFolder = options.StagingFolder },
signals);
var pipeline = new CollectionPipeline(tap, signals, capture, driver, runner, downloads, siteMap, targets);
ProfileSearchRunner? search = null;
SearchPhotoQueue? searchPhotos = null;
if (options.PageTurns is { } turns)
{
search = new ProfileSearchRunner(
driver,
driver,
capture,
siteMap,
options.Governor,
signals,
options.Breaker,
options.Clock,
options.Random,
turns,
options.SearchOptions,
options.UserIsDriving,
diagnostics);
if (options.SearchPhotos is { } photos)
{
// Photos only while the page is on the site: from the rest page the browser may block the CDN (H7).
searchPhotos = new SearchPhotoQueue(
photos,
fetcher,
options.Governor,
options.DataBudget,
options.Breaker,
options.Clock,
options.Random,
options.SearchOptions,
signals,
() => turns.LastUser is not null)
{
Diagnostics = diagnostics,
};
}
}
var pipeline = new CollectionPipeline(tap, signals, capture, driver, runner, downloads, siteMap, targets, search, searchPhotos);
pipeline._subscriptions.Add(tap.AddObserver(signals));
pipeline._subscriptions.Add(tap.AddConsumer(signals));
pipeline._subscriptions.Add(tap.AddObserver(capture));
@@ -208,6 +269,11 @@ public sealed class CollectionPipeline : IAsyncDisposable
subscription.Dispose();
}
if (SearchPhotos is not null)
{
await SearchPhotos.DisposeAsync().ConfigureAwait(false);
}
await Tap.DisposeAsync().ConfigureAwait(false);
}