mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
BJ-Share, B2S-Share and Speed-Share: fix Anime search (#2171)
* Fixed anime search on BJShare, removing the season from search and changing the output from "Anime SXXEXX" to "Anime EXX". Season had to be removed because the season numbering on anime is all wrong in this tracker. * - Changed to change title based on search for category of every row in bj-share, instead of category of search - Fixed title parse on B2S-Share and Speed-Share to animes (series not changed) from "Anime SXXEXX" to "Anime EXX" * - Added anime title change on empty search as well - BJ-Share
This commit is contained in:
@@ -227,8 +227,19 @@
|
|||||||
details:
|
details:
|
||||||
selector: a[href^="torrents-details.php?id="]
|
selector: a[href^="torrents-details.php?id="]
|
||||||
attribute: href
|
attribute: href
|
||||||
title:
|
is_anime:
|
||||||
|
optional: true
|
||||||
|
selector: a[href^="torrents.php?cat=11"]
|
||||||
|
attribute: href
|
||||||
|
title_anime:
|
||||||
selector: a[href^="torrents-details.php?id="]
|
selector: a[href^="torrents-details.php?id="]
|
||||||
|
filters:
|
||||||
|
- name: re_replace
|
||||||
|
args: ["(Ep[\\.]?[ ]?)|([S]\\d\\d[Ee])", "E"]
|
||||||
|
title_normal:
|
||||||
|
selector: a[href^="torrents-details.php?id="]
|
||||||
|
title:
|
||||||
|
text: "{{if .Result.is_anime }}{{ .Result.title_anime }}{{else}}{{ .Result.title_normal }}{{end}}"
|
||||||
download:
|
download:
|
||||||
selector: a[href^="torrents-details.php?id="]
|
selector: a[href^="torrents-details.php?id="]
|
||||||
attribute: href
|
attribute: href
|
||||||
|
@@ -207,9 +207,30 @@
|
|||||||
details:
|
details:
|
||||||
selector: a[href^="torrents-details.php?id="]
|
selector: a[href^="torrents-details.php?id="]
|
||||||
attribute: href
|
attribute: href
|
||||||
title:
|
is_anime:
|
||||||
|
optional: true
|
||||||
|
selector: >
|
||||||
|
a[href^="torrents.php?cat=240"]
|
||||||
|
,a[href^="torrents.php?cat=189"]
|
||||||
|
,a[href^="torrents.php?cat=102"]
|
||||||
|
,a[href^="torrents.php?cat=103"]
|
||||||
|
,a[href^="torrents.php?cat=250"]
|
||||||
|
,a[href^="torrents.php?cat=144"]
|
||||||
|
,a[href^="torrents.php?cat=251"]
|
||||||
|
,a[href^="torrents.php?cat=227"]
|
||||||
|
,a[href^="torrents.php?cat=228"]
|
||||||
|
,a[href^="torrents.php?cat=191"]
|
||||||
|
attribute: href
|
||||||
|
title_anime:
|
||||||
selector: a[href^="torrents-details.php?id="]
|
selector: a[href^="torrents-details.php?id="]
|
||||||
filters:
|
filters:
|
||||||
|
- name: re_replace
|
||||||
|
args: ["(Ep[\\.]?[ ]?)|([S]\\d\\d[Ee])", "E"]
|
||||||
|
title_normal:
|
||||||
|
selector: a[href^="torrents-details.php?id="]
|
||||||
|
title:
|
||||||
|
text: "{{if .Result.is_anime }}{{ .Result.title_anime }}{{else}}{{ .Result.title_normal }}{{end}}"
|
||||||
|
filters:
|
||||||
- name: re_replace
|
- name: re_replace
|
||||||
args: ["^(\\[XXX]\\s)", ""]
|
args: ["^(\\[XXX]\\s)", ""]
|
||||||
- name: replace
|
- name: replace
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -22,6 +23,7 @@ namespace Jackett.Indexers
|
|||||||
private string LoginUrl { get { return SiteLink + "login.php"; } }
|
private string LoginUrl { get { return SiteLink + "login.php"; } }
|
||||||
private string BrowseUrl { get { return SiteLink + "torrents.php"; } }
|
private string BrowseUrl { get { return SiteLink + "torrents.php"; } }
|
||||||
private string TodayUrl { get { return SiteLink + "torrents.php?action=today"; } }
|
private string TodayUrl { get { return SiteLink + "torrents.php?action=today"; } }
|
||||||
|
private char[] digits = new[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||||
|
|
||||||
private new ConfigurationDataBasicLoginWithRSSAndDisplay configData
|
private new ConfigurationDataBasicLoginWithRSSAndDisplay configData
|
||||||
{
|
{
|
||||||
@@ -88,12 +90,11 @@ Encoding = Encoding.UTF8;
|
|||||||
return IndexerConfigurationStatus.RequiresTesting;
|
return IndexerConfigurationStatus.RequiresTesting;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string StripSearchString(string term)
|
private string StripSearchString(string term, bool isAnime)
|
||||||
{
|
{
|
||||||
// Search does not support searching with episode numbers so strip it if we have one
|
// Search does not support searching with episode numbers so strip it if we have one
|
||||||
// Ww AND filter the result later to archive the proper result
|
// Ww AND filter the result later to archive the proper result
|
||||||
term = Regex.Replace(term, @"[S|E]\d\d", string.Empty);
|
return isAnime ? term.TrimEnd(digits) : Regex.Replace(term, @"[S|E]\d\d", string.Empty).Trim();
|
||||||
return term.Trim();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||||
@@ -160,6 +161,11 @@ Encoding = Encoding.UTF8;
|
|||||||
}
|
}
|
||||||
|
|
||||||
var catStr = qCatLink.GetAttribute("href").Split('=')[1];
|
var catStr = qCatLink.GetAttribute("href").Split('=')[1];
|
||||||
|
// if result is an anime, convert title from SXXEXX to EXX
|
||||||
|
if (catStr == "14")
|
||||||
|
{
|
||||||
|
release.Title = Regex.Replace(release.Title, @"(Ep[\.]?[ ]?)|([S]\d\d[Ee])", "E");
|
||||||
|
}
|
||||||
release.Category = MapTrackerCatToNewznab(catStr);
|
release.Category = MapTrackerCatToNewznab(catStr);
|
||||||
|
|
||||||
release.Link = new Uri(SiteLink + qDLLink.GetAttribute("href"));
|
release.Link = new Uri(SiteLink + qDLLink.GetAttribute("href"));
|
||||||
@@ -192,9 +198,10 @@ Encoding = Encoding.UTF8;
|
|||||||
else // use search
|
else // use search
|
||||||
{
|
{
|
||||||
var searchUrl = BrowseUrl;
|
var searchUrl = BrowseUrl;
|
||||||
|
var isSearchAnime = query.Categories.Any(s => s == TorznabCatType.TVAnime.ID);
|
||||||
|
|
||||||
var queryCollection = new NameValueCollection();
|
var queryCollection = new NameValueCollection();
|
||||||
queryCollection.Add("searchstr", StripSearchString(searchString));
|
queryCollection.Add("searchstr", StripSearchString(searchString, isSearchAnime));
|
||||||
queryCollection.Add("order_by", "time");
|
queryCollection.Add("order_by", "time");
|
||||||
queryCollection.Add("order_way", "desc");
|
queryCollection.Add("order_way", "desc");
|
||||||
queryCollection.Add("group_results", "1");
|
queryCollection.Add("group_results", "1");
|
||||||
@@ -237,6 +244,12 @@ Encoding = Encoding.UTF8;
|
|||||||
var qCatLink = Row.QuerySelector("a[href^=\"/torrents.php?filter_cat\"]");
|
var qCatLink = Row.QuerySelector("a[href^=\"/torrents.php?filter_cat\"]");
|
||||||
string CategoryStr = qCatLink.GetAttribute("href").Split('=')[1].Split('&')[0];
|
string CategoryStr = qCatLink.GetAttribute("href").Split('=')[1].Split('&')[0];
|
||||||
Category = MapTrackerCatToNewznab(CategoryStr);
|
Category = MapTrackerCatToNewznab(CategoryStr);
|
||||||
|
|
||||||
|
// if result is an anime, convert title from SXXEXX to EXX
|
||||||
|
if (CategoryStr == "14")
|
||||||
|
{
|
||||||
|
Title = Regex.Replace(Title, @"(Ep[\.]?[ ]?)|([S]\d\d[Ee])", "E");
|
||||||
|
}
|
||||||
YearStr = qDetailsLink.NextSibling.TextContent.Trim().TrimStart('[').TrimEnd(']');
|
YearStr = qDetailsLink.NextSibling.TextContent.Trim().TrimStart('[').TrimEnd(']');
|
||||||
YearPublishDate = DateTime.SpecifyKind(DateTime.ParseExact(YearStr, "yyyy", CultureInfo.InvariantCulture), DateTimeKind.Unspecified);
|
YearPublishDate = DateTime.SpecifyKind(DateTime.ParseExact(YearStr, "yyyy", CultureInfo.InvariantCulture), DateTimeKind.Unspecified);
|
||||||
|
|
||||||
|
@@ -1,26 +1,21 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net452</TargetFramework>
|
<TargetFramework>net452</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="Indexers\**" />
|
<Compile Remove="Indexers\**" />
|
||||||
<EmbeddedResource Remove="Indexers\**" />
|
<EmbeddedResource Remove="Indexers\**" />
|
||||||
<None Remove="Indexers\**" />
|
<None Remove="Indexers\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Util\Invalid-RSS.xml" />
|
<None Remove="Util\Invalid-RSS.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Util\Invalid-RSS.xml" />
|
<EmbeddedResource Include="Util\Invalid-RSS.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Autofac" Version="4.6.2" />
|
||||||
<PackageReference Include="FluentAssertions" Version="4.19.4" />
|
<PackageReference Include="FluentAssertions" Version="4.19.4" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
|
<PackageReference Include="MSTest.TestAdapter" Version="1.2.0" />
|
||||||
@@ -29,17 +24,14 @@
|
|||||||
<PackageReference Include="NUnit.ConsoleRunner" Version="3.7.0" />
|
<PackageReference Include="NUnit.ConsoleRunner" Version="3.7.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Properties\" />
|
<Folder Include="Properties\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Jackett.Common\Jackett.Common.csproj" />
|
||||||
<ProjectReference Include="..\Jackett\Jackett.csproj" />
|
<ProjectReference Include="..\Jackett\Jackett.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
Reference in New Issue
Block a user