Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

Commit 4496072

Browse files
committed
can now resume downloading media from a certain date.
last issue remaining is the copious memory usage when downloading media. I'll work on that tomorrow.
1 parent 1ab9249 commit 4496072

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

PatreonDownloader/Program.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Globalization;
34
using System.IO;
45
using System.Linq;
56
using System.Net;
@@ -117,8 +118,27 @@ private static void DownloadMedia(HttpClient client, CookieContainer cookies, Li
117118
new DropboxDownloader()
118119
};
119120

121+
Console.WriteLine("If you want to download ALL saved media, press enter. Otherwise, enter the YYYY-MM-DD of the date that you want to resume downloading from. (Media is downloaded in reverse order of submitting.)");
122+
DateTime? skipAfter = null;
123+
bool @continue = false;
124+
while (!@continue) {
125+
string ymd = Console.ReadLine();
126+
if (string.IsNullOrWhiteSpace(ymd)) {
127+
@continue = true;
128+
} else if (DateTime.TryParseExact(ymd, "yyyy-MM-dd", null, DateTimeStyles.None, out DateTime result)) {
129+
skipAfter = result;
130+
@continue = true;
131+
} else {
132+
Console.WriteLine("Please press enter, or enter the date in YYYY-MM-DD.");
133+
}
134+
}
135+
120136
int postI = 1;
121137
foreach (PostPageData post in posts.SelectMany(page => page.Data).Where(post => post.Attributes.PostType == "image_file")) {
138+
if (skipAfter.HasValue && post.Attributes.PublishedAt > skipAfter) {
139+
postI++;
140+
continue;
141+
}
122142
DirectoryInfo directory = null;
123143

124144
#region Media downloading

0 commit comments

Comments
 (0)