Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Patreon files capture by reading html #182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Rename Patreon files capture by reading html
  • Loading branch information
Ovear committed May 9, 2023
commit 8623652f39781d058f15dcda2d7f43cf0794bc45
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,20 @@ public async Task<bool> ProcessCrawledUrl(ICrawledUrl udpCrawledUrl)

string appendStr = _fileCountDict[key].ToString();

// External files captured by plugin may also Patreon files
MatchCollection matches = _fileIdRegex.Matches(crawledUrl.Url);

if (crawledUrl.UrlType != PatreonCrawledUrlType.ExternalUrl)
{
MatchCollection matches = _fileIdRegex.Matches(crawledUrl.Url);

if (matches.Count == 0)
throw new DownloadException($"[{crawledUrl.PostId}] Unable to retrieve file id for {crawledUrl.Url}, contact developer!");
if (matches.Count > 1)
throw new DownloadException($"[{crawledUrl.PostId}] More than 1 media found in URL {crawledUrl.Url}");
}

// If we get file id successfully
if (matches.Count == 1)
{
appendStr = matches[0].Groups[4].Value;
}

Expand Down