feat: read gallery-dl sidecars for reel type and post dates
The .json sidecars published with the ARTMS fetch were inert: the scanner fed them through the Instaloader path, where `node.edge_media_to_caption` and `checkIsStory`'s `product_type` are both absent, so nothing happened. They are now recognised structurally -- flat, with post_shortcode and type, and none of the markers the other two JSON shapes carry -- and used for three things: - `type` sets post.isReel, which post-tabs prefers over every fallback. This is Instagram's own classification and it disagrees with ours a lot: of 781 items in "official_artms - reels", the sidecars say only 360 are reels. The other 421 are feed videos the clips endpoint returns via include_feed_video, and the directory-based rule counted them all. - `description` fills the caption where no .txt exists. - `date` dates a post whose filename could not. Also fixes date precedence. Only JDownloader highlights lack a date in the filename, so parseArchiveFilename now marks those as mtime-derived and the scanner lets any real date replace them -- previously the date depended on which file the scan reached first. Verified against real published files: a directory of three type=post and three type=reel renders 6 in the grid and exactly the 3 reels in the Reels tab. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,15 @@ export interface ParsedFilename {
|
||||
index: number;
|
||||
ext: string;
|
||||
isStory: boolean;
|
||||
/**
|
||||
* True when `date` is the file's mtime rather than anything Instagram said.
|
||||
*
|
||||
* Only highlights fetched by JDownloader lack a date in the filename, and
|
||||
* their mtime is just when the file was written. Callers should let any real
|
||||
* date win over this one — the same item is often also present under a
|
||||
* gallery-dl name that does carry the date.
|
||||
*/
|
||||
dateFromMtime: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,6 +63,7 @@ export const parseArchiveFilename = (
|
||||
index: indexStr ? parseInt(indexStr, 10) : 1,
|
||||
ext,
|
||||
isStory: Boolean(story),
|
||||
dateFromMtime: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,6 +77,7 @@ export const parseArchiveFilename = (
|
||||
index: indexStr ? parseInt(indexStr, 10) : 1,
|
||||
ext,
|
||||
isStory: Boolean(story),
|
||||
dateFromMtime: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -81,6 +92,7 @@ export const parseArchiveFilename = (
|
||||
index: 1,
|
||||
ext,
|
||||
isStory: false,
|
||||
dateFromMtime: Boolean(mtime),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user