Secondo HAR: campioni, lettori e richieste della pagina di Instagram
Il HAR del 12 novembre (senza filtro) letto con la sonda sulla macchina di Alberto, fuori dal repository: 45 forme di richieste, 142 campioni ripuliti e verificati. Da qui otto campioni nuovi (scheda e post del profilo, schede Reel e Con tag, raccolte, storie, vassoio delle storie, serie con un video), accorciati sulla copia ripulita per non aprire mai i grezzi. Lettori: postCount = media_count e la chiave nuova highlight.cover. Le schede Reel e Con tag restano anteprime, non contenuti; il blocco della pagina iniziale da' nome e foto dell'account collegato (H10). Sonda: i numeri con esponente restano numeri; la verifica non cerca dentro i valori ammessi di proposito ma sempre nelle chiavi di dati, cerca la chiave del frammento con lo stesso confronto del testo, e non conta le parole degli indirizzi finti. docs/sonda/richieste-instagram.md: quale operazione da' che cosa, le scritture che Febe non deve mai mandare, le vie per doc_id e i campi di sessione nei limiti di 6.1, cio' che manca (seguiti, seconda pagina dei post: parte A quater delle prove dal vivo). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ffb766a95
commit
dc60e282c5
23 files changed
+5986
-28
No files matched your search
@@ -68,7 +68,7 @@ public sealed class InstagramReaderTests
|
||||
Vocabulary.Content.ExpiresAt, Vocabulary.Content.Duration, Vocabulary.Version.Url, Vocabulary.Version.Width, Vocabulary.Version.Height,
|
||||
Vocabulary.Version.HasAudio, Vocabulary.Profile.Id, Vocabulary.Profile.Username, Vocabulary.Profile.DisplayName, Vocabulary.Profile.IsPrivate,
|
||||
Vocabulary.Profile.IsFollowed, Vocabulary.Profile.PostCount, Vocabulary.Profile.Picture, Vocabulary.Profile.LatestStoryAt,
|
||||
Vocabulary.Highlight.Id, Vocabulary.Highlight.Title, Vocabulary.Highlight.Owner, Vocabulary.Highlight.Items,
|
||||
Vocabulary.Highlight.Id, Vocabulary.Highlight.Title, Vocabulary.Highlight.Owner, Vocabulary.Highlight.Items, Vocabulary.Highlight.Cover,
|
||||
Vocabulary.Page.HasMore, Vocabulary.Page.Cursor, Vocabulary.Viewer,
|
||||
};
|
||||
foreach (var path in concepts.SelectMany(c => c.Paths))
|
||||
@@ -198,6 +198,131 @@ public sealed class InstagramReaderTests
|
||||
Assert.AreEqual(post.TakenAt, ReadMapping.ToEntry(post, 1, EntryKind.Post, now).PublishedAt);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TheProfileCardGivesThePostCountTheNameAndTheLargePicture()
|
||||
{
|
||||
// PolarisProfilePageContentQuery, from the second HAR (12 November 2026): the only answer with media_count.
|
||||
var result = ReadSample("scheda-profilo");
|
||||
Assert.AreEqual(ReadShape.Recognized, result.Shape);
|
||||
Assert.AreEqual(0, result.Contents.Count);
|
||||
var profile = result.Profiles.Single();
|
||||
Assert.AreEqual(443, profile.PostCount);
|
||||
Assert.IsFalse(string.IsNullOrWhiteSpace(profile.DisplayName));
|
||||
Assert.AreEqual(false, profile.IsPrivate);
|
||||
Assert.AreEqual(false, profile.IsFollowed);
|
||||
Assert.IsNotNull(profile.LatestStoryAt);
|
||||
Assert.IsTrue(profile.Picture?.Url.EndsWith(".jpg", StringComparison.Ordinal), "hd_profile_pic_url_info has the address only.");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TheProfilePostsGiveReelsAndSeriesWithTheNextPage()
|
||||
{
|
||||
// PolarisProfilePostsQuery: the grid of a profile, reels included, 12 at a time (2 kept: a reel and a series).
|
||||
var result = ReadSample("post-del-profilo");
|
||||
Assert.AreEqual(ReadShape.Recognized, result.Shape);
|
||||
Assert.AreEqual(2, result.Contents.Count);
|
||||
Assert.IsTrue(result.Contents.All(c => c.Code?.Length == 11 && c.Owner is not null && c.ExpiresAt is null && c.IsComplete));
|
||||
Assert.AreEqual(1, result.Contents.Select(c => c.Owner!.Username).Distinct().Count());
|
||||
|
||||
var reel = result.Contents[0].Files.Single();
|
||||
Assert.AreEqual(MediaKind.Video, reel.Kind);
|
||||
Assert.AreEqual((720, 1280), (reel.Best.Width, reel.Best.Height));
|
||||
Assert.IsNotNull(reel.Cover);
|
||||
|
||||
var series = result.Contents[1].Files;
|
||||
Assert.AreEqual(6, series.Count, "carousel_media: one file for each child.");
|
||||
Assert.IsTrue(series.All(f => f.Kind == MediaKind.Photo && f.Best.Width == 2160 && f.Best.Height == 2880));
|
||||
|
||||
Assert.AreEqual(true, result.Page?.HasMore);
|
||||
Assert.IsFalse(string.IsNullOrEmpty(result.Page?.Cursor), "page_info.end_cursor, the «after» of the next page.");
|
||||
Assert.IsNotNull(result.ViewerId);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ASeriesWithAVideoKeepsEveryChildInOrder()
|
||||
{
|
||||
// The same answer as «post-del-profilo», another post: 20 children, the 13th a video with its cover.
|
||||
var result = ReadSample("serie-con-video");
|
||||
var post = result.Contents.Single();
|
||||
Assert.IsTrue(post.IsComplete);
|
||||
Assert.AreEqual(20, post.Files.Count);
|
||||
Assert.AreEqual(12, post.Files.ToList().FindIndex(f => f.Kind == MediaKind.Video));
|
||||
var video = post.Files[12];
|
||||
Assert.IsTrue(video.Best.Url.EndsWith(".mp4", StringComparison.Ordinal));
|
||||
Assert.IsNotNull(video.Cover);
|
||||
Assert.AreEqual(19, post.Files.Count(f => f.Kind == MediaKind.Photo));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TheReelsAndTaggedGridsArePreviewsNotContents()
|
||||
{
|
||||
// The Reels and Tagged tabs carry thumbnails without taken_at or video versions: the profile and the next page
|
||||
// are read, the previews are not contents (the whole content comes from the posts or from media/…/info/).
|
||||
foreach (var name in new[] { "reel-del-profilo", "con-tag" })
|
||||
{
|
||||
var result = ReadSample(name);
|
||||
Assert.AreEqual(ReadShape.Recognized, result.Shape, name);
|
||||
Assert.AreEqual(0, result.Contents.Count, name);
|
||||
Assert.IsTrue(result.Profiles.Count > 0, name);
|
||||
Assert.AreEqual(true, result.Page?.HasMore, name);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TheHighlightsOfAProfileComeWithTitleAndCoverButNoItems()
|
||||
{
|
||||
// PolarisProfileStoryHighlightsTrayContentQuery: the list under the profile header (3 of 9 kept).
|
||||
var result = ReadSample("raccolte-del-profilo");
|
||||
Assert.AreEqual(ReadShape.Recognized, result.Shape);
|
||||
Assert.AreEqual(3, result.Highlights.Count);
|
||||
foreach (var highlight in result.Highlights)
|
||||
{
|
||||
StringAssert.Matches(highlight.Id, new System.Text.RegularExpressions.Regex("^[0-9]{17}$"));
|
||||
Assert.IsFalse(string.IsNullOrWhiteSpace(highlight.Title));
|
||||
Assert.IsNotNull(highlight.Owner);
|
||||
StringAssert.StartsWith(highlight.Cover?.Url, "https://", "cover_media.cropped_image_version (jpg or webp).");
|
||||
Assert.AreEqual(0, highlight.Items.Count, "The stories of a collection come with PolarisStoriesV3HighlightsPageQuery.");
|
||||
}
|
||||
|
||||
Assert.AreEqual(false, result.Page?.HasMore);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TheStoriesOfAProfileExpireAndHaveADuration()
|
||||
{
|
||||
// PolarisStoriesV3ReelPageStandaloneQuery: the stories of one profile (reels_media, reel_type user_reel).
|
||||
var result = ReadSample("storie-di-un-profilo");
|
||||
Assert.AreEqual(ReadShape.Recognized, result.Shape);
|
||||
var story = result.Contents.Single();
|
||||
Assert.IsNull(story.HighlightId);
|
||||
Assert.IsTrue(story.ExpiresAt > story.TakenAt);
|
||||
Assert.IsNotNull(story.Owner);
|
||||
var video = story.Files.Single();
|
||||
Assert.AreEqual(MediaKind.Video, video.Kind);
|
||||
Assert.IsTrue(video.Duration > TimeSpan.Zero);
|
||||
Assert.IsNull(video.Best.Width, "Story video versions have no dimensions.");
|
||||
Assert.IsNotNull(video.Cover);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TheStoriesTrayOfTheHomePageSaysWhoHasStories()
|
||||
{
|
||||
// xdt_api__v1__feed__reels_tray, embedded in the home page document (3 of 120 kept): who has stories and when
|
||||
// the last one was published, without the stories themselves.
|
||||
var result = ReadSample("vassoio-storie");
|
||||
Assert.AreEqual(ReadShape.Recognized, result.Shape);
|
||||
Assert.AreEqual(0, result.Contents.Count);
|
||||
var withStories = result.Profiles.Where(p => !p.IsViewer).ToList();
|
||||
Assert.AreEqual(3, withStories.Count);
|
||||
Assert.IsTrue(withStories.All(p => p.LatestStoryAt is not null && p.Picture is not null));
|
||||
|
||||
// H10: in the page document xdt_viewer.user also has the name and the picture of the connected account.
|
||||
Assert.IsNotNull(result.Viewer);
|
||||
Assert.AreEqual(result.ViewerId, result.Viewer.Id);
|
||||
Assert.IsFalse(string.IsNullOrWhiteSpace(result.Viewer.Username));
|
||||
Assert.IsNotNull(result.Viewer.Picture);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TheProfilesOfSearchSuggestionsAndCommentsAreProfilesOnly()
|
||||
{
|
||||
|
||||
@@ -211,6 +211,74 @@ public sealed class SanitizerTests
|
||||
Assert.IsFalse(SampleSanitizer.LooksLikeSecretKey("username"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void WordsOfSomeoneElsesTextInsideKeptValuesAreNotLeaksButTheTextStillIs()
|
||||
{
|
||||
// From the HAR of 12 November 2026: the Italian word «altro» and a short word inside a media type or a date
|
||||
// occur in other people's text; the cleaned samples write «altro.esempio», «.avif», «text/javascript» and keep
|
||||
// dates on purpose. Those are not leaks. A name put back by hand still is, and the check says under which key.
|
||||
using var temp = new TempFolder("ripulitura");
|
||||
var raw = Directory.CreateDirectory(temp.Combine("grezzi")).FullName;
|
||||
File.WriteAllText(Path.Combine(raw, "000001.json"), """
|
||||
{
|
||||
"descrittore": { "indirizzo": "https://www.instagram.com/graphql/query", "host": "sito", "stato": 200, "tipo": "text/javascript" },
|
||||
"corpo": {
|
||||
"didascalia": "Altro script di Lucia, 17914",
|
||||
"link": "https://esterno.example/pagina",
|
||||
"foto": "https://scontent.cdninstagram.com/v/t51/123_456_n.avif?firma=x",
|
||||
"taken_at": 1791791400
|
||||
}
|
||||
}
|
||||
""");
|
||||
var clean = temp.Combine("ripuliti");
|
||||
new SampleSanitizer(key: new byte[32]).SanitizeFolder(raw, clean);
|
||||
var verify = SampleVerifier.Verify(raw, clean);
|
||||
Assert.IsTrue(verify.Passed, string.Join("; ", verify.Leaks.Select(l => $"{l.CleanFile} {l.Length} {l.Kind} {l.Key}")));
|
||||
|
||||
var path = Path.Combine(clean, "000001.json");
|
||||
var node = JsonNode.Parse(File.ReadAllText(path))!;
|
||||
node["corpo"]!["link"] = "https://altro.esempio/lucia";
|
||||
File.WriteAllText(path, node.ToJsonString());
|
||||
var leak = SampleVerifier.Verify(raw, clean).Leaks.Single();
|
||||
Assert.AreEqual(new SampleLeak("000001.json", 5, "lettere", "link"), leak);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ARawDataKeyLeftInTheCleanCopyFailsWhateverItsParentKeyAllows()
|
||||
{
|
||||
// A data key (an identifier or a name used as a key) is always faked: the rule of its parent key («*_at» keeps
|
||||
// dates, «type» keeps codes) must not make the check skip it when a raw one is left behind.
|
||||
using var temp = new TempFolder("ripulitura");
|
||||
var raw = Directory.CreateDirectory(temp.Combine("grezzi")).FullName;
|
||||
File.WriteAllText(Path.Combine(raw, "000001.json"), """
|
||||
{
|
||||
"descrittore": { "indirizzo": "https://www.instagram.com/graphql/query", "host": "sito", "stato": 200, "tipo": "text/javascript" },
|
||||
"corpo": { "updated_at": { "17841400123": 1 }, "type": { "lucia.rossi": true } }
|
||||
}
|
||||
""");
|
||||
var clean = Directory.CreateDirectory(temp.Combine("ripuliti")).FullName;
|
||||
File.Copy(Path.Combine(raw, "000001.json"), Path.Combine(clean, "000001.json"));
|
||||
var leaks = SampleVerifier.Verify(raw, clean).Leaks;
|
||||
Assert.IsTrue(leaks.Any(l => l.Kind == "cifre" && l.Key == "(chiave di dati)"), string.Join("; ", leaks));
|
||||
Assert.IsTrue(leaks.Any(l => l.Kind == "lettere" && l.Key == "(chiave di dati)"), string.Join("; ", leaks));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void LongNumbersWithAnExponentOrAFractionStayNumbers()
|
||||
{
|
||||
// Instagram writes some large numbers with an exponent: only the digits are faked, the «e» and the sign stay.
|
||||
var sanitizer = new SampleSanitizer(key: new byte[32]);
|
||||
var node = sanitizer.Sanitize(JsonNode.Parse("""{"a":1.7976931348e+21,"b":-12345.678,"c":98765432109876}"""))!;
|
||||
foreach (var key in new[] { "a", "b", "c" })
|
||||
{
|
||||
Assert.AreEqual(JsonValueKind.Number, node[key]!.GetValueKind(), key);
|
||||
}
|
||||
|
||||
StringAssert.Contains(node["a"]!.ToJsonString(), "e+");
|
||||
StringAssert.StartsWith(node["b"]!.ToJsonString(), "-");
|
||||
Assert.AreNotEqual("98765432109876", node["c"]!.ToJsonString());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TheProbeReadsOnlyThroughAReadOnlyScript() =>
|
||||
Febe.Browser.Cdp.ReadOnlyScriptGuard.EnsureReadOnly(ProbeRecorder.InteractionScript);
|
||||
|
||||
Reference in new issue
Block a user