diff --git a/src/Jackett.Common/Definitions/speed-share.yml b/src/Jackett.Common/Definitions/speed-share.yml index e6a414d3b..c8b67e7a2 100644 --- a/src/Jackett.Common/Definitions/speed-share.yml +++ b/src/Jackett.Common/Definitions/speed-share.yml @@ -220,6 +220,11 @@ ,a[href^="torrents.php?cat=228"] ,a[href^="torrents.php?cat=191"] attribute: href + year: + selector: td.label > div:contains("Lançamento:") + filters: + - name: replace + args: ["Lançamento:", ""] title_anime: selector: a[href^="torrents-details.php?id="] filters: @@ -227,6 +232,9 @@ args: ["(Ep[\\.]?[ ]?)|([S]\\d\\d[Ee])", "E"] title_normal: selector: a[href^="torrents-details.php?id="] + filters: + - name: re_replace + args: ["^(.*?) - ((S(\\d{1,2}))?E(\\d{1,3}))", "$1 {{.Result.year}} $2"] title: text: "{{if .Result.is_anime }}{{ .Result.title_anime }}{{else}}{{ .Result.title_normal }}{{end}}" filters: @@ -234,11 +242,16 @@ args: ["^(\\[XXX]\\s)", ""] - name: replace args: [" - NOVO!", ""] - title|append: - selector: td.label > div:contains("Lançamento:") - filters: - - name: replace - args: ["Lançamento:", ""] + - name: re_replace + args: ["(\\d{2})ª a (\\d{2})ª Temporada", "S$1-$2"] + - name: re_replace + args: ["(\\d{1})ª a (\\d{1})ª Temporada", "S0$1-0$2"] + - name: re_replace + args: ["(\\d{1})ª a (\\d{2})ª Temporada", "S0$1-$2"] + - name: re_replace + args: ["(\\d{2})ª Temporada", "S$1"] + - name: re_replace + args: ["(\\d{1})ª Temporada", "S0$1"] title|append: optional: true selector: td.label > div:contains("Qualidade:") diff --git a/src/Jackett.Common/Indexers/BJShare.cs b/src/Jackett.Common/Indexers/BJShare.cs index cad341a04..c3e6e098f 100644 --- a/src/Jackett.Common/Indexers/BJShare.cs +++ b/src/Jackett.Common/Indexers/BJShare.cs @@ -238,20 +238,22 @@ Encoding = Encoding.UTF8; ICollection Category = null; string YearStr = null; Nullable YearPublishDate = null; + string CategoryStr = ""; if (Row.ClassList.Contains("group") || Row.ClassList.Contains("torrent")) // group/ungrouped headers { var qCatLink = Row.QuerySelector("a[href^=\"/torrents.php?filter_cat\"]"); - string CategoryStr = qCatLink.GetAttribute("href").Split('=')[1].Split('&')[0]; + CategoryStr = qCatLink.GetAttribute("href").Split('=')[1].Split('&')[0]; Category = MapTrackerCatToNewznab(CategoryStr); + + YearStr = qDetailsLink.NextSibling.TextContent.Trim().TrimStart('[').TrimEnd(']'); + YearPublishDate = DateTime.SpecifyKind(DateTime.ParseExact(YearStr, "yyyy", CultureInfo.InvariantCulture), DateTimeKind.Unspecified); // 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(']'); - YearPublishDate = DateTime.SpecifyKind(DateTime.ParseExact(YearStr, "yyyy", CultureInfo.InvariantCulture), DateTimeKind.Unspecified); if (Row.ClassList.Contains("group")) // group headers { @@ -278,7 +280,11 @@ Encoding = Encoding.UTF8; if (Row.ClassList.Contains("group_torrent")) // torrents belonging to a group { release.Description = qDetailsLink.TextContent; - release.Title = GroupTitle + " " + GroupYearStr; + + string cleanTitle = Regex.Replace(GroupTitle, @" - S?(?\d{1,2})?E?(?\d{1,4})?", ""); + string seasonEp = Regex.Replace(GroupTitle, @"^(.*?) - (S?(\d{1,2})?E?(\d{1,4})?)?", "$2"); + release.Title = CategoryStr == "14" ? GroupTitle : cleanTitle + " " + GroupYearStr + " " + seasonEp; + release.PublishDate = GroupPublishDate.Value; release.Category = GroupCategory; } @@ -286,7 +292,11 @@ Encoding = Encoding.UTF8; { var qDescription = Row.QuerySelector("div.torrent_info"); release.Description = qDescription.TextContent; - release.Title = Title + " " + YearStr; + + string cleanTitle = Regex.Replace(Title, @" - ((S(\d{1,2}))?E(\d{1,4}))", ""); + string seasonEp = Regex.Replace(Title, @"^(.*?) - ((S(\d{1,2}))?E(\d{1,4}))", "$2"); + release.Title = CategoryStr == "14" ? Title : cleanTitle + " " + YearStr + " " + seasonEp; + release.PublishDate = YearPublishDate.Value; release.Category = Category; }