Skip to content

Commit

Permalink
feat: allowlist option
Browse files Browse the repository at this point in the history
  • Loading branch information
cshaa committed Sep 22, 2024
1 parent f713309 commit f824fc8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ mkdir(directory, { recursive: true });

const startingGuid = args.get("--start-with");
const reverse = args.has("--reverse");
const guids = args.get("--guids");

interface VideoItem {
Guid: string;
Expand Down Expand Up @@ -157,10 +158,15 @@ const videos = !reverse
? getVideos({ pageSize: 10 })
: (await Array.fromAsync(getVideos({ pageSize: 10 }))).reverse();

const allowlist = guids
? new Set((await Bun.file(guids).text()).split("\n"))
: undefined;

let skip = startingGuid !== undefined;
for await (const video of videos) {
if (video.Guid === startingGuid) skip = false;
if (skip) continue;
if (allowlist && !allowlist.has(video.Guid)) continue;

try {
const url = await getVideoUrl({ guid: video.Guid });
Expand Down

0 comments on commit f824fc8

Please sign in to comment.