Instagram: Febe legge le risposte vere (campioni dal HAR del 21/10)
Febe non estraeva nulla da Instagram per due motivi. Instagram manda i dati di storie e raccolte (GraphQL) come text/javascript, e la cattura leggeva solo le risposte dichiarate JSON: le scartava tutte. E i file di Instagram (lettori, bersagli) erano scheletri, quindi le ricette si rifiutavano di girare. Alberto ha mandato un HAR del suo browser e una guida. La guida descrive richieste costruite a mano, vietate dalle regole 2-4, e un formato che nel HAR non compare: non si usa. Dal HAR si è letta solo la forma; le risposte utili sono diventate campioni grezzi fuori dal repository, ripuliti e verificati con febe-sonda (tests/Febe.Tests/campioni/instagram). Che cosa cambia: - la cattura legge le risposte text/javascript chieste dalla pagina (mai gli script) e ogni blocco JSON incorporato nel documento della pagina, e avvisa quando un corpo atteso non arriverà; - le risposte che non parlano di contenuti (promozioni, «storia vista») si ignorano invece di valere come formato non riconosciuto; - lettori.instagram.json è confermato, con sole chiavi presenti nei campioni; identificativi delle raccolte nella forma dell'indirizzo; - bersagli.instagram.json ha le pagine viste nel traffico vero; i bersagli restano vuoti (H11): storie, raccolte, Taggati e Reel aspettano lo script tools/bersagli/raccogli-bersagli.js; - le ricette del profilo reggono dati in risposte diverse e prendono la paginazione solo dalla risposta che porta i loro post; l'elenco dei seguiti scarta i profili suggeriti; «Tu» si riconosce anche dal solo identificativo dell'account collegato; - il visualizzatore delle raccolte conta i contenuti (l'indirizzo non cambia), chiede il permesso prima di ogni contenuto e si chiude sempre; - una ricetta che la configurazione non lascia girare è «Da configurare»: non è un guasto, non si sospende, non si pianifica; le sospensioni dovute ai file vecchi si azzerano una volta al cambio dei file; - la barra laterale dice «Collegato» dal cookie di sessione; i «Post singolo» per gli indirizzi scaduti non vengono più annullati; - febe-sonda da-har; la ripulitura tiene latest_reel_media e mette un riempitivo neutro sotto le chiavi simili a segreti (gitleaks). Prove su Windows: 783 superate, 76 saltate (Chromium e Xvfb, nella CI). Nulla è stato provato contro Instagram. Dettagli e decisioni in docs/stato.md e docs/decisioni.md (righe del 25 ottobre). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b3a7c31e5a
commit
31bbbf8bb7
69 files changed
+9184
-453
No files matched your search
@@ -7,8 +7,8 @@ namespace Febe.Tests.Collection;
|
||||
|
||||
/// <summary>
|
||||
/// The generic reader (spec §6.4) on the cleaned samples of <c>tests/campioni/prova</c>: captured from the test site,
|
||||
/// cleaned with «febe-sonda ripulisci» and checked with «febe-sonda verifica». Never real Instagram samples: there
|
||||
/// are none yet (rule 10).
|
||||
/// cleaned with «febe-sonda ripulisci» and checked with «febe-sonda verifica». The real Instagram samples have their
|
||||
/// own tests (<see cref="InstagramReaderTests"/>).
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public sealed class ReaderTests
|
||||
@@ -199,31 +199,16 @@ public sealed class ReaderTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TheShippedVocabulariesLoadAndInstagramsIsOnlyAHypothesis()
|
||||
public void TheShippedVocabulariesLoad()
|
||||
{
|
||||
var test = ReaderVocabulary.LoadTestSite();
|
||||
Assert.IsTrue(test.IsUsable, test.UnusableReason);
|
||||
Assert.AreEqual(0, test.Relevance.Count, "On the test site every unknown answer is a format change.");
|
||||
Assert.IsTrue(File.Exists(Path.Combine(AppContext.BaseDirectory, "config", "lettori.prova.json")), "Editable without recompiling.");
|
||||
Assert.IsTrue(File.Exists(Path.Combine(AppContext.BaseDirectory, "config", "lettori.instagram.json")));
|
||||
|
||||
var instagram = ReaderVocabulary.LoadInstagram();
|
||||
Assert.AreEqual(VocabularyStatus.Hypothesis, instagram.Status);
|
||||
Assert.IsFalse(instagram.IsUsable);
|
||||
StringAssert.Contains(instagram.UnusableReason, "ipotesi");
|
||||
StringAssert.Contains(instagram.Note, "IPOTESI, DA CONFERMARE CON I CAMPIONI DI M0");
|
||||
|
||||
// Only the hint keys of spec §6.4: nothing invented (rule 10).
|
||||
var keys = new[]
|
||||
{
|
||||
instagram.Content.Id, instagram.Content.Code, instagram.Content.TakenAt, instagram.Content.Caption, instagram.Content.Images,
|
||||
instagram.Content.Videos, instagram.Content.Children, instagram.Content.ChildCount, instagram.Content.Owner, instagram.Content.Pinned,
|
||||
instagram.Content.ExpiresAt, instagram.Content.Duration, instagram.Version.Url, instagram.Version.Width, instagram.Version.Height,
|
||||
instagram.Version.HasAudio, instagram.Profile.Id, instagram.Profile.Username, instagram.Profile.DisplayName, instagram.Profile.IsPrivate,
|
||||
instagram.Profile.IsFollowed, instagram.Profile.PostCount, instagram.Profile.Picture, instagram.Profile.LatestStoryAt,
|
||||
instagram.Highlight.Id, instagram.Highlight.Title, instagram.Highlight.Owner, instagram.Highlight.Items,
|
||||
instagram.Page.HasMore, instagram.Page.Cursor, instagram.Viewer,
|
||||
}.SelectMany(k => k.Paths).Order().ToArray();
|
||||
CollectionAssert.AreEqual(new[] { "carousel_media", "code", "image_versions2.candidates", "pk", "taken_at", "video_versions" }, keys);
|
||||
// Instagram's vocabulary has its own tests on the real cleaned samples (InstagramReaderTests).
|
||||
Assert.IsTrue(ReaderVocabulary.LoadInstagram().IsUsable);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
Reference in new issue
Block a user