Skip to content

Commit

Permalink
Small tweak and remove repeated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sim0n00ps committed Jun 30, 2024
1 parent 00e2682 commit e1a277b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
42 changes: 21 additions & 21 deletions OF DL/Helpers/DownloadHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ protected async Task<bool> CreateDirectoriesAndDownloadMedia(string path,
try
{
string customFileName = string.Empty;
if (!Directory.Exists(folder + path)) // check if the folder already exists
if (!Directory.Exists(folder + path))
{
Directory.CreateDirectory(folder + path); // create the new folder
Directory.CreateDirectory(folder + path);
}
string extension = Path.GetExtension(url.Split("?")[0]);

Expand Down Expand Up @@ -785,19 +785,19 @@ public async Task DownloadAvatarHeader(string? avatarUrl, string? headerUrl, str
{
try
{
string path = $"/Profile"; // specify the path for the new folder
string path = $"/Profile";

if (!Directory.Exists(folder + path)) // check if the folder already exists
if (!Directory.Exists(folder + path))
{
Directory.CreateDirectory(folder + path); // create the new folder
Directory.CreateDirectory(folder + path);
}

if (!string.IsNullOrEmpty(avatarUrl))
{
string avatarpath = $"{path}/Avatars";
if (!Directory.Exists(folder + avatarpath)) // check if the folder already exists
if (!Directory.Exists(folder + avatarpath))
{
Directory.CreateDirectory(folder + avatarpath); // create the new folder
Directory.CreateDirectory(folder + avatarpath);
}

List<string> avatarMD5Hashes = WidevineClient.Utils.CalculateFolderMD5(folder + avatarpath);
Expand Down Expand Up @@ -838,9 +838,9 @@ public async Task DownloadAvatarHeader(string? avatarUrl, string? headerUrl, str
if (!string.IsNullOrEmpty(headerUrl))
{
string headerpath = $"{path}/Headers";
if (!Directory.Exists(folder + headerpath)) // check if the folder already exists
if (!Directory.Exists(folder + headerpath))
{
Directory.CreateDirectory(folder + headerpath); // create the new folder
Directory.CreateDirectory(folder + headerpath);
}

List<string> headerMD5Hashes = WidevineClient.Utils.CalculateFolderMD5(folder + headerpath);
Expand Down Expand Up @@ -907,9 +907,9 @@ public async Task<bool> DownloadMessageDRMVideo(string policy, string signature,
{
path = "/Messages/Free/Videos";
}
if (!Directory.Exists(folder + path)) // check if the folder already exists
if (!Directory.Exists(folder + path))
{
Directory.CreateDirectory(folder + path); // create the new folder
Directory.CreateDirectory(folder + path);
}


Expand Down Expand Up @@ -991,9 +991,9 @@ public async Task<bool> DownloadPurchasedMessageDRMVideo(string policy, string s
{
path = "/Messages/Paid/Videos";
}
if (!Directory.Exists(folder + path)) // check if the folder already exists
if (!Directory.Exists(folder + path))
{
Directory.CreateDirectory(folder + path); // create the new folder
Directory.CreateDirectory(folder + path);
}

if (!string.IsNullOrEmpty(filenameFormat) && messageInfo != null && messageMedia != null)
Expand Down Expand Up @@ -1074,9 +1074,9 @@ public async Task<bool> DownloadPostDRMVideo(string policy, string signature, st
{
path = "/Posts/Free/Videos";
}
if (!Directory.Exists(folder + path)) // check if the folder already exists
if (!Directory.Exists(folder + path))
{
Directory.CreateDirectory(folder + path); // create the new folder
Directory.CreateDirectory(folder + path);
}

if (!string.IsNullOrEmpty(filenameFormat) && postInfo != null && postMedia != null)
Expand Down Expand Up @@ -1155,9 +1155,9 @@ public async Task<bool> DownloadPostDRMVideo(string policy, string signature, st
{
path = "/Posts/Free/Videos";
}
if (!Directory.Exists(folder + path)) // check if the folder already exists
if (!Directory.Exists(folder + path))
{
Directory.CreateDirectory(folder + path); // create the new folder
Directory.CreateDirectory(folder + path);
}

if (!string.IsNullOrEmpty(filenameFormat) && postInfo != null && postMedia != null)
Expand Down Expand Up @@ -1318,9 +1318,9 @@ public async Task<bool> DownloadPurchasedPostDRMVideo(string policy, string sign
{
path = "/Posts/Paid/Videos";
}
if (!Directory.Exists(folder + path)) // check if the folder already exists
if (!Directory.Exists(folder + path))
{
Directory.CreateDirectory(folder + path); // create the new folder
Directory.CreateDirectory(folder + path);
}


Expand Down Expand Up @@ -1394,9 +1394,9 @@ public async Task<bool> DownloadArchivedPostDRMVideo(string policy, string signa
Uri uri = new(url);
string filename = System.IO.Path.GetFileName(uri.LocalPath).Split(".")[0];
string path = "/Archived/Posts/Free/Videos";
if (!Directory.Exists(folder + path)) // check if the folder already exists
if (!Directory.Exists(folder + path))
{
Directory.CreateDirectory(folder + path); // create the new folder
Directory.CreateDirectory(folder + path);
}

if (!string.IsNullOrEmpty(filenameFormat) && postInfo != null && postMedia != null)
Expand Down
24 changes: 12 additions & 12 deletions OF DL/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,12 @@ private static async Task DownloadAllData(APIHelper m_ApiHelper, Auth Auth, Conf
}
else
{
path = $"__user_data__/sites/OnlyFans/{username}"; // specify the path for the new folder
path = $"__user_data__/sites/OnlyFans/{username}";
}

if (!Directory.Exists(path)) // check if the folder already exists
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path); // create the new folder
Directory.CreateDirectory(path);
AnsiConsole.Markup($"[red]Created folder for {username}\n[/]");
}
else
Expand Down Expand Up @@ -450,7 +450,7 @@ private static async Task DownloadAllData(APIHelper m_ApiHelper, Auth Auth, Conf
}
else
{
path = $"__user_data__/sites/OnlyFans/{purchasedTabCollection.Username}"; // specify the path for the new folder
path = $"__user_data__/sites/OnlyFans/{purchasedTabCollection.Username}";
}

var downloadContext = new DownloadContext(Auth, Config, GetCreatorFileNameFormatConfig(Config, purchasedTabCollection.Username), m_ApiHelper, dBHelper);
Expand All @@ -476,8 +476,8 @@ private static async Task DownloadAllData(APIHelper m_ApiHelper, Auth Auth, Conf
//https://onlyfans.com/my/chats/chat/70196897/?firstId=3127582635776

string messageUrl = AnsiConsole.Prompt(
new TextPrompt<string>("[red]Please enter a post URL: [/]")
.ValidationErrorMessage("[red]Please enter a valid post URL[/]")
new TextPrompt<string>("[red]Please enter a message URL: [/]")
.ValidationErrorMessage("[red]Please enter a valid message URL[/]")
.Validate(url =>
{
Regex regex = new Regex("https://onlyfans\\.com/my/chats/chat/[0-9]+/\\?firstId=[0-9]+$", RegexOptions.IgnoreCase);
Expand Down Expand Up @@ -511,12 +511,12 @@ private static async Task DownloadAllData(APIHelper m_ApiHelper, Auth Auth, Conf
}
else
{
path = $"__user_data__/sites/OnlyFans/{username}"; // specify the path for the new folder
path = $"__user_data__/sites/OnlyFans/{username}";
}

if (!Directory.Exists(path)) // check if the folder already exists
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path); // create the new folder
Directory.CreateDirectory(path);
AnsiConsole.Markup($"[red]Created folder for {username}\n[/]");
}
else
Expand Down Expand Up @@ -553,14 +553,14 @@ private static async Task DownloadAllData(APIHelper m_ApiHelper, Auth Auth, Conf
}
else
{
path = $"__user_data__/sites/OnlyFans/{user.Key}"; // specify the path for the new folder
path = $"__user_data__/sites/OnlyFans/{user.Key}";
}

await dBHelper.CheckUsername(user, path);

if (!Directory.Exists(path)) // check if the folder already exists
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path); // create the new folder
Directory.CreateDirectory(path);
AnsiConsole.Markup($"[red]Created folder for {user.Key}\n[/]");
}
else
Expand Down

0 comments on commit e1a277b

Please sign in to comment.