diff --git a/src/OpenDirectoryDownloader/Site/Mediafire/MediafireParser.cs b/src/OpenDirectoryDownloader/Site/Mediafire/MediafireParser.cs index 64d5e24f..2c631e48 100644 --- a/src/OpenDirectoryDownloader/Site/Mediafire/MediafireParser.cs +++ b/src/OpenDirectoryDownloader/Site/Mediafire/MediafireParser.cs @@ -11,6 +11,7 @@ public static class MediafireParser { private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Regex FolderIdRegex = new Regex(@"\/folder\/(?[^/]*)(?:\/?.*)?"); + private static readonly Regex FolderIdRegex2 = new Regex(@"\/\?(?[^/]*)(?:\/?.*)?"); private const string Parser = "Mediafire"; private const string StatusSuccess = "Success"; private const string ApiBaseAddress = "https://www.mediafire.com/api/1.4"; @@ -43,12 +44,19 @@ private static string GetFolderId(WebDirectory webDirectory) { Match folderIdRegexMatch = FolderIdRegex.Match(webDirectory.Url); - if (!folderIdRegexMatch.Success) + if (folderIdRegexMatch.Success) { - throw new Exception("Error getting folder id"); + return folderIdRegexMatch.Groups["FolderId"].Value; } - return folderIdRegexMatch.Groups["FolderId"].Value; + Match folderIdRegex2Match = FolderIdRegex2.Match(webDirectory.Url); + + if (folderIdRegex2Match.Success) + { + return folderIdRegex2Match.Groups["FolderId"].Value; + } + + throw new Exception("Error getting folder id"); } private static async Task ScanAsync(HttpClient httpClient, WebDirectory webDirectory)