Raccolta (M0/M2): sito di prova completo, lettori per forma, ricette su browser vero, coda degli scaricamenti, sonda con ripulitura e verifica; documenti delle ipotesi e delle prove dal vivo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
74 files changed
+12689
-13
No files matched your search
@@ -0,0 +1,143 @@
|
||||
using System.Text;
|
||||
using Febe.Core.Domain;
|
||||
|
||||
namespace Febe.Core.Collection.Readers;
|
||||
|
||||
/// <summary>One version of a file as the page received it: an address with its size.</summary>
|
||||
/// <param name="Url">Signed address: never logged (spec §13.2).</param>
|
||||
/// <param name="Width">Width in pixels, when given.</param>
|
||||
/// <param name="Height">Height in pixels, when given.</param>
|
||||
/// <param name="HasAudio">For videos: whether the rendition carries audio; null when the response does not say.</param>
|
||||
public sealed record FileVersion(string Url, int? Width, int? Height, bool? HasAudio)
|
||||
{
|
||||
public long Area => (long)(Width ?? 0) * (Height ?? 0);
|
||||
|
||||
private bool PrintMembers(StringBuilder builder)
|
||||
{
|
||||
builder.Append($"Width = {Width}, Height = {Height}, HasAudio = {HasAudio}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>One file of a content item, with the version chosen for download (spec §6.5 point 1).</summary>
|
||||
/// <param name="Kind">Photo or video.</param>
|
||||
/// <param name="InstagramId">Identifier of this file of a series, when the site gives one.</param>
|
||||
/// <param name="Best">Largest image, or best video version complete with audio.</param>
|
||||
/// <param name="Cover">For videos: the largest cover image.</param>
|
||||
/// <param name="Duration">Video duration, when given.</param>
|
||||
public sealed record ContentFile(MediaKind Kind, string? InstagramId, FileVersion Best, FileVersion? Cover, TimeSpan? Duration);
|
||||
|
||||
/// <summary>A profile as it appears in a response (author of content, profile page, list of followed profiles).</summary>
|
||||
public sealed record ProfileInfo
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
|
||||
public required string Username { get; init; }
|
||||
|
||||
public string? DisplayName { get; init; }
|
||||
|
||||
public bool? IsPrivate { get; init; }
|
||||
|
||||
public bool? IsFollowed { get; init; }
|
||||
|
||||
public int? PostCount { get; init; }
|
||||
|
||||
/// <summary>Largest version of the profile picture.</summary>
|
||||
public FileVersion? Picture { get; init; }
|
||||
|
||||
/// <summary>Publication time of the latest active story (stories bar).</summary>
|
||||
public DateTimeOffset? LatestStoryAt { get; init; }
|
||||
|
||||
/// <summary>True when the response presents this profile as the connected account (H10).</summary>
|
||||
public bool IsViewer { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>A content node: a post, a story or an item of a highlight collection.</summary>
|
||||
public sealed record ContentItem
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
|
||||
public string? Code { get; init; }
|
||||
|
||||
public required DateTimeOffset TakenAt { get; init; }
|
||||
|
||||
/// <summary>Caption: never logged.</summary>
|
||||
public string? Caption { get; init; }
|
||||
|
||||
public ProfileInfo? Owner { get; init; }
|
||||
|
||||
public bool Pinned { get; init; }
|
||||
|
||||
public DateTimeOffset? ExpiresAt { get; init; }
|
||||
|
||||
/// <summary>The files in order (one for a single photo or video, several for a series).</summary>
|
||||
public required IReadOnlyList<ContentFile> Files { get; init; }
|
||||
|
||||
/// <summary>False when the series declares more files than the response carries: Post singolo completes it.</summary>
|
||||
public bool IsComplete { get; init; } = true;
|
||||
|
||||
/// <summary>Identifier of the highlight collection the item was found in, if any.</summary>
|
||||
public string? HighlightId { get; init; }
|
||||
|
||||
/// <summary>Order of appearance in the response, from 0.</summary>
|
||||
public int Order { get; init; }
|
||||
|
||||
private bool PrintMembers(StringBuilder builder)
|
||||
{
|
||||
builder.Append($"Id = {Id}, Code = {Code}, TakenAt = {TakenAt:O}, Owner = {Owner?.Username}, Pinned = {Pinned}, Files = {Files.Count}, IsComplete = {IsComplete}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A highlight collection, with its contents when the response carries them.</summary>
|
||||
public sealed record HighlightInfo
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
|
||||
public required string Title { get; init; }
|
||||
|
||||
public ProfileInfo? Owner { get; init; }
|
||||
|
||||
public FileVersion? Cover { get; init; }
|
||||
|
||||
public IReadOnlyList<ContentItem> Items { get; init; } = [];
|
||||
|
||||
public int Order { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>Pagination information of a page of data.</summary>
|
||||
public sealed record PageInfo(bool? HasMore, string? Cursor);
|
||||
|
||||
/// <summary>What the reader made of a response.</summary>
|
||||
public enum ReadShape
|
||||
{
|
||||
/// <summary>At least one content, profile or highlight was recognized.</summary>
|
||||
Recognized,
|
||||
|
||||
/// <summary>Nothing to read (empty lists, a bare status): not an error, but counts as an empty page.</summary>
|
||||
Empty,
|
||||
|
||||
/// <summary>A shape the vocabulary does not describe: event «formato non riconosciuto» (spec §6.4).</summary>
|
||||
Unrecognized,
|
||||
}
|
||||
|
||||
/// <summary>Everything one response gave, detached from the JSON document (which is disposed right after).</summary>
|
||||
public sealed record ReadResult
|
||||
{
|
||||
public static ReadResult EmptyResult { get; } = new() { Shape = ReadShape.Empty };
|
||||
|
||||
public required ReadShape Shape { get; init; }
|
||||
|
||||
public IReadOnlyList<ContentItem> Contents { get; init; } = [];
|
||||
|
||||
public IReadOnlyList<ProfileInfo> Profiles { get; init; } = [];
|
||||
|
||||
public IReadOnlyList<HighlightInfo> Highlights { get; init; } = [];
|
||||
|
||||
public PageInfo? Page { get; init; }
|
||||
|
||||
public ProfileInfo? Viewer { get; init; }
|
||||
|
||||
/// <summary>For unrecognized responses: the key structure, without any value (spec §6.4).</summary>
|
||||
public string? KeyStructure { get; init; }
|
||||
}
|
||||
Reference in new issue
Block a user