2017-10-29 06:21:18 +00:00
|
|
|
using System.Collections.Generic;
|
2020-05-03 23:35:52 +00:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2017-10-29 06:21:18 +00:00
|
|
|
using System.Text;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Threading.Tasks;
|
2018-03-10 08:05:56 +00:00
|
|
|
using Jackett.Common.Indexers.Abstract;
|
|
|
|
using Jackett.Common.Models;
|
|
|
|
using Jackett.Common.Models.IndexerConfig;
|
|
|
|
using Jackett.Common.Services.Interfaces;
|
|
|
|
using Jackett.Common.Utils.Clients;
|
2015-10-24 14:54:32 +00:00
|
|
|
using NLog;
|
2017-04-15 08:45:10 +00:00
|
|
|
|
2018-03-10 08:05:56 +00:00
|
|
|
namespace Jackett.Common.Indexers
|
2015-10-24 14:54:32 +00:00
|
|
|
{
|
2020-05-03 23:35:52 +00:00
|
|
|
[ExcludeFromCodeCoverage]
|
2017-09-15 16:57:43 +00:00
|
|
|
public class DanishBits : CouchPotatoTracker
|
2015-10-24 14:54:32 +00:00
|
|
|
{
|
2017-11-30 15:12:10 +00:00
|
|
|
public override string[] LegacySiteLinks { get; protected set; } = new string[] {
|
|
|
|
"http://danishbits.org/",
|
|
|
|
};
|
|
|
|
|
2017-10-29 06:21:18 +00:00
|
|
|
private new ConfigurationDataUserPasskey configData
|
2017-10-06 08:36:04 +00:00
|
|
|
{
|
2020-02-25 16:08:03 +00:00
|
|
|
get => (ConfigurationDataUserPasskey)base.configData;
|
|
|
|
set => base.configData = value;
|
2017-10-06 08:36:04 +00:00
|
|
|
}
|
|
|
|
|
2020-04-04 06:56:51 +00:00
|
|
|
public DanishBits(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps)
|
2020-05-11 19:59:28 +00:00
|
|
|
: base(id: "danishbits",
|
|
|
|
name: "DanishBits",
|
2020-04-04 06:56:51 +00:00
|
|
|
description: "A danish closed torrent tracker",
|
|
|
|
link: "https://danishbits.org/",
|
|
|
|
caps: new TorznabCapabilities
|
|
|
|
{
|
|
|
|
SupportsImdbMovieSearch = true
|
|
|
|
},
|
|
|
|
configService: configService,
|
|
|
|
client: wc,
|
|
|
|
logger: l,
|
|
|
|
p: ps,
|
|
|
|
configData: new ConfigurationDataUserPasskey(
|
|
|
|
@"Note about Passkey: This is not your login Password. Find the Passkey by logging into
|
|
|
|
DanishBits with your Browser, and under your account page you'll see your passkey under the 'Personal'
|
|
|
|
section on the left side."),
|
|
|
|
endpoint: "couchpotato.php")
|
2015-10-24 14:54:32 +00:00
|
|
|
{
|
2017-11-05 09:42:03 +00:00
|
|
|
Encoding = Encoding.UTF8;
|
2016-12-09 17:20:58 +00:00
|
|
|
Language = "da-dk";
|
2017-01-27 15:57:32 +00:00
|
|
|
Type = "private";
|
2016-12-06 13:56:47 +00:00
|
|
|
|
2017-09-15 16:57:43 +00:00
|
|
|
AddCategoryMapping("movie", TorznabCatType.Movies);
|
|
|
|
AddCategoryMapping("tv", TorznabCatType.TV);
|
2018-01-09 15:13:15 +00:00
|
|
|
AddCategoryMapping("blandet", TorznabCatType.Other); // e.g. games
|
2015-10-24 14:54:32 +00:00
|
|
|
}
|
|
|
|
|
2017-09-19 09:32:12 +00:00
|
|
|
protected override string GetSearchString(TorznabQuery query)
|
|
|
|
{
|
|
|
|
if (string.IsNullOrEmpty(query.SearchTerm) && string.IsNullOrEmpty(query.ImdbID))
|
|
|
|
{
|
|
|
|
return "%";
|
|
|
|
}
|
|
|
|
var searchString = query.GetQueryString();
|
2020-02-10 22:16:19 +00:00
|
|
|
var ReplaceRegex = new Regex("[^a-zA-Z0-9]+");
|
2017-09-19 09:32:12 +00:00
|
|
|
searchString = ReplaceRegex.Replace(searchString, "%");
|
|
|
|
return searchString;
|
|
|
|
}
|
|
|
|
|
2020-09-21 16:39:47 +00:00
|
|
|
protected override async Task<WebResult> RequestWithCookiesAsync(
|
2020-06-11 15:09:27 +00:00
|
|
|
string url, string cookieOverride = null, RequestType method = RequestType.GET, string referer = null,
|
|
|
|
IEnumerable<KeyValuePair<string, string>> data = null, Dictionary<string, string> headers = null,
|
|
|
|
string rawbody = null, bool? emulateBrowser = null)
|
2015-10-24 14:54:32 +00:00
|
|
|
{
|
2017-10-03 12:23:31 +00:00
|
|
|
CookieHeader = null; // Download fill fail with cookies set
|
2020-09-21 16:39:47 +00:00
|
|
|
return await base.RequestWithCookiesAsync(url, cookieOverride, method, referer, data, headers);
|
2015-10-24 14:54:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|