Jackett/src/Jackett.Common/Indexers/DanishBits.cs

78 lines
3.1 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Jackett.Common.Indexers.Abstract;
using Jackett.Common.Models;
using Jackett.Common.Models.IndexerConfig;
using Jackett.Common.Services.Interfaces;
using Jackett.Common.Utils.Clients;
using NLog;
namespace Jackett.Common.Indexers
{
[ExcludeFromCodeCoverage]
2017-09-15 16:57:43 +00:00
public class DanishBits : CouchPotatoTracker
{
2017-11-30 15:12:10 +00:00
public override string[] LegacySiteLinks { get; protected set; } = new string[] {
"http://danishbits.org/",
};
private new ConfigurationDataUserPasskey configData
{
get => (ConfigurationDataUserPasskey)base.configData;
set => base.configData = value;
}
public DanishBits(IIndexerConfigurationService configService, WebClient wc, Logger l, IProtectionService ps)
: base(id: "danishbits",
name: "DanishBits",
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")
{
Encoding = Encoding.UTF8;
2016-12-09 17:20:58 +00:00
Language = "da-dk";
Type = "private";
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
}
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();
var ReplaceRegex = new Regex("[^a-zA-Z0-9]+");
2017-09-19 09:32:12 +00:00
searchString = ReplaceRegex.Replace(searchString, "%");
return searchString;
}
protected override async Task<WebResult> RequestWithCookiesAsync(
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)
{
2017-10-03 12:23:31 +00:00
CookieHeader = null; // Download fill fail with cookies set
return await base.RequestWithCookiesAsync(url, cookieOverride, method, referer, data, headers);
}
}
}