2017-10-29 06:50:47 +00:00
|
|
|
|
using System;
|
2016-06-23 10:34:19 +00:00
|
|
|
|
using System.Collections.Generic;
|
2018-04-23 14:33:29 +00:00
|
|
|
|
using System.Collections.Specialized;
|
2016-06-23 10:34:19 +00:00
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Linq;
|
2017-11-05 09:42:03 +00:00
|
|
|
|
using System.Net;
|
2017-10-29 06:50:47 +00:00
|
|
|
|
using System.Text;
|
2016-06-23 10:34:19 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2018-03-10 08:05:56 +00:00
|
|
|
|
using Jackett.Common.Models;
|
|
|
|
|
using Jackett.Common.Models.IndexerConfig;
|
|
|
|
|
using Jackett.Common.Services.Interfaces;
|
2018-04-23 14:33:29 +00:00
|
|
|
|
using Jackett.Common.Utils;
|
2017-10-29 06:50:47 +00:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using NLog;
|
2016-06-23 10:34:19 +00:00
|
|
|
|
|
2018-03-10 08:05:56 +00:00
|
|
|
|
namespace Jackett.Common.Indexers
|
2016-06-23 10:34:19 +00:00
|
|
|
|
{
|
2017-07-10 20:58:44 +00:00
|
|
|
|
public class PassThePopcorn : BaseWebIndexer
|
2016-06-23 10:34:19 +00:00
|
|
|
|
{
|
2016-12-09 16:17:19 +00:00
|
|
|
|
private string LoginUrl { get { return "https://passthepopcorn.me/ajax.php?action=login"; } }
|
|
|
|
|
private string indexUrl { get { return "https://passthepopcorn.me/ajax.php?action=login"; } }
|
|
|
|
|
private string SearchUrl { get { return "https://passthepopcorn.me/torrents.php"; } }
|
|
|
|
|
private string DetailURL { get { return "https://passthepopcorn.me/torrents.php?torrentid="; } }
|
2017-07-14 05:39:52 +00:00
|
|
|
|
private string AuthKey { get; set; }
|
2017-10-29 06:50:47 +00:00
|
|
|
|
|
2020-01-05 20:43:54 +00:00
|
|
|
|
private new ConfigurationDataAPILoginWithUserAndPasskeyAndFilter configData
|
2016-06-23 10:34:19 +00:00
|
|
|
|
{
|
2020-01-05 20:43:54 +00:00
|
|
|
|
get { return (ConfigurationDataAPILoginWithUserAndPasskeyAndFilter)base.configData; }
|
2016-06-23 10:34:19 +00:00
|
|
|
|
set { base.configData = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-05 09:42:03 +00:00
|
|
|
|
public PassThePopcorn(IIndexerConfigurationService configService, Utils.Clients.WebClient c, Logger l, IProtectionService ps)
|
2016-06-23 10:34:19 +00:00
|
|
|
|
: base(name: "PassThePopcorn",
|
2017-10-04 05:05:10 +00:00
|
|
|
|
description: "PassThePopcorn is a Private site for MOVIES / TV",
|
2016-06-23 10:34:19 +00:00
|
|
|
|
link: "https://passthepopcorn.me/",
|
|
|
|
|
caps: new TorznabCapabilities(),
|
2017-07-10 20:58:44 +00:00
|
|
|
|
configService: configService,
|
2016-06-23 10:34:19 +00:00
|
|
|
|
client: c,
|
|
|
|
|
logger: l,
|
|
|
|
|
p: ps,
|
2020-01-05 20:43:54 +00:00
|
|
|
|
configData: new ConfigurationDataAPILoginWithUserAndPasskeyAndFilter(@"Enter filter options below to restrict search results.
|
2016-06-23 10:34:19 +00:00
|
|
|
|
Separate options with a space if using more than one option.<br>Filter options available:
|
2018-04-23 14:33:29 +00:00
|
|
|
|
<br><code>GoldenPopcorn</code><br><code>Scene</code><br><code>Checked</code><br><code>Free</code>"))
|
2016-06-23 10:34:19 +00:00
|
|
|
|
{
|
2016-12-09 16:17:19 +00:00
|
|
|
|
Encoding = Encoding.UTF8;
|
2016-12-09 17:20:58 +00:00
|
|
|
|
Language = "en-us";
|
2017-01-27 15:57:32 +00:00
|
|
|
|
Type = "private";
|
2016-12-09 16:17:19 +00:00
|
|
|
|
|
2019-05-11 03:27:25 +00:00
|
|
|
|
TorznabCaps.SupportsImdbMovieSearch = true;
|
2017-04-15 08:45:10 +00:00
|
|
|
|
|
|
|
|
|
webclient.requestDelay = 2; // 0.5 requests per second
|
|
|
|
|
|
2017-03-16 07:10:19 +00:00
|
|
|
|
AddCategoryMapping(1, TorznabCatType.Movies, "Feature Film");
|
2016-06-23 10:34:19 +00:00
|
|
|
|
AddCategoryMapping(1, TorznabCatType.MoviesForeign);
|
|
|
|
|
AddCategoryMapping(1, TorznabCatType.MoviesOther);
|
|
|
|
|
AddCategoryMapping(1, TorznabCatType.MoviesSD);
|
|
|
|
|
AddCategoryMapping(1, TorznabCatType.MoviesHD);
|
|
|
|
|
AddCategoryMapping(1, TorznabCatType.Movies3D);
|
|
|
|
|
AddCategoryMapping(1, TorznabCatType.MoviesBluRay);
|
|
|
|
|
AddCategoryMapping(1, TorznabCatType.MoviesDVD);
|
|
|
|
|
AddCategoryMapping(1, TorznabCatType.MoviesWEBDL);
|
2017-03-16 07:10:19 +00:00
|
|
|
|
AddCategoryMapping(2, TorznabCatType.Movies, "Short Film");
|
|
|
|
|
AddCategoryMapping(3, TorznabCatType.TV, "Miniseries");
|
|
|
|
|
AddCategoryMapping(4, TorznabCatType.TV, "Stand-up Comedy");
|
|
|
|
|
AddCategoryMapping(5, TorznabCatType.TV, "Live Performance");
|
2016-06-23 10:34:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-06-28 05:31:38 +00:00
|
|
|
|
public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
2016-06-23 10:34:19 +00:00
|
|
|
|
{
|
2017-01-02 20:39:28 +00:00
|
|
|
|
LoadValuesFromJson(configJson);
|
2016-06-23 10:34:19 +00:00
|
|
|
|
|
2020-01-05 20:43:54 +00:00
|
|
|
|
IsConfigured = false;
|
|
|
|
|
try
|
2016-06-23 10:34:19 +00:00
|
|
|
|
{
|
2020-01-05 20:43:54 +00:00
|
|
|
|
var results = await PerformQuery(new TorznabQuery());
|
|
|
|
|
if (results.Count() == 0)
|
|
|
|
|
throw new Exception("Testing returned no results!");
|
|
|
|
|
IsConfigured = true;
|
|
|
|
|
SaveConfig();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
throw new ExceptionWithConfigData(e.Message, configData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return IndexerConfigurationStatus.Completed;
|
2016-06-23 10:34:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-03 05:15:47 +00:00
|
|
|
|
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
2016-06-23 10:34:19 +00:00
|
|
|
|
{
|
|
|
|
|
var releases = new List<ReleaseInfo>();
|
|
|
|
|
bool configGoldenPopcornOnly = configData.FilterString.Value.ToLowerInvariant().Contains("goldenpopcorn");
|
|
|
|
|
bool configSceneOnly = configData.FilterString.Value.ToLowerInvariant().Contains("scene");
|
|
|
|
|
bool configCheckedOnly = configData.FilterString.Value.ToLowerInvariant().Contains("checked");
|
2018-04-23 14:33:29 +00:00
|
|
|
|
bool configFreeOnly = configData.FilterString.Value.ToLowerInvariant().Contains("free");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string movieListSearchUrl = SearchUrl;
|
|
|
|
|
var queryCollection = new NameValueCollection();
|
|
|
|
|
queryCollection.Add("json", "noredirect");
|
2016-06-23 10:34:19 +00:00
|
|
|
|
|
2017-01-16 16:23:51 +00:00
|
|
|
|
if (!string.IsNullOrEmpty(query.ImdbID))
|
|
|
|
|
{
|
2018-04-23 14:33:29 +00:00
|
|
|
|
queryCollection.Add("searchstr", query.ImdbID);
|
2017-01-16 16:23:51 +00:00
|
|
|
|
}
|
2017-07-14 05:39:52 +00:00
|
|
|
|
else if (!string.IsNullOrEmpty(query.GetQueryString()))
|
2016-06-23 10:34:19 +00:00
|
|
|
|
{
|
2018-04-23 14:33:29 +00:00
|
|
|
|
queryCollection.Add("searchstr", query.GetQueryString());
|
2017-01-16 16:23:51 +00:00
|
|
|
|
}
|
2018-04-23 14:33:29 +00:00
|
|
|
|
|
|
|
|
|
if(configFreeOnly)
|
|
|
|
|
queryCollection.Add("freetorrent", "1");
|
|
|
|
|
|
|
|
|
|
if (queryCollection.Count > 0)
|
2017-04-15 08:45:10 +00:00
|
|
|
|
{
|
2018-04-23 14:33:29 +00:00
|
|
|
|
movieListSearchUrl += "?" + queryCollection.GetQueryString();
|
2016-06-23 10:34:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-01-05 20:43:54 +00:00
|
|
|
|
var authHeaders = new Dictionary<string, string>()
|
|
|
|
|
{
|
|
|
|
|
{ "ApiUser", configData.User.Value },
|
|
|
|
|
{ "ApiKey", configData.Key.Value }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var results = await RequestStringWithCookiesAndRetry(movieListSearchUrl, null, null, authHeaders);
|
2018-03-14 16:59:17 +00:00
|
|
|
|
if (results.IsRedirect) // untested
|
|
|
|
|
{
|
2020-01-05 20:43:54 +00:00
|
|
|
|
results = await RequestStringWithCookiesAndRetry(movieListSearchUrl, null, null, authHeaders);
|
2018-03-14 16:59:17 +00:00
|
|
|
|
}
|
2016-06-23 10:34:19 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//Iterate over the releases for each movie
|
|
|
|
|
JObject js_results = JObject.Parse(results.Content);
|
|
|
|
|
foreach (var movie in js_results["Movies"])
|
|
|
|
|
{
|
2017-03-19 15:00:54 +00:00
|
|
|
|
string movie_title = (string)movie["Title"];
|
|
|
|
|
string Year = (string)movie["Year"];
|
2017-03-16 10:27:18 +00:00
|
|
|
|
var movie_imdbid_str = (string)movie["ImdbId"];
|
2017-03-19 15:00:54 +00:00
|
|
|
|
var coverStr = (string)movie["Cover"];
|
|
|
|
|
Uri coverUri = null;
|
|
|
|
|
if (!string.IsNullOrEmpty(coverStr))
|
|
|
|
|
coverUri = new Uri(coverStr);
|
2017-03-16 10:27:18 +00:00
|
|
|
|
long? movie_imdbid = null;
|
2017-07-14 05:39:52 +00:00
|
|
|
|
if (!string.IsNullOrEmpty(movie_imdbid_str))
|
2017-03-16 10:27:18 +00:00
|
|
|
|
movie_imdbid = long.Parse(movie_imdbid_str);
|
2016-06-23 10:34:19 +00:00
|
|
|
|
string movie_groupid = (string)movie["GroupId"];
|
|
|
|
|
foreach (var torrent in movie["Torrents"])
|
|
|
|
|
{
|
|
|
|
|
var release = new ReleaseInfo();
|
2017-03-19 15:00:54 +00:00
|
|
|
|
string release_name = (string)torrent["ReleaseName"];
|
|
|
|
|
release.Title = release_name;
|
|
|
|
|
release.Description = string.Format("Title: {0}", movie_title);
|
|
|
|
|
release.BannerUrl = coverUri;
|
2016-06-23 10:34:19 +00:00
|
|
|
|
release.Imdb = movie_imdbid;
|
2017-11-05 09:42:03 +00:00
|
|
|
|
release.Comments = new Uri(string.Format("{0}?id={1}", SearchUrl, WebUtility.UrlEncode(movie_groupid)));
|
2016-06-23 10:34:19 +00:00
|
|
|
|
release.Size = long.Parse((string)torrent["Size"]);
|
2017-03-19 15:00:54 +00:00
|
|
|
|
release.Grabs = long.Parse((string)torrent["Snatched"]);
|
2016-06-23 10:34:19 +00:00
|
|
|
|
release.Seeders = int.Parse((string)torrent["Seeders"]);
|
2017-05-07 15:43:23 +00:00
|
|
|
|
release.Peers = release.Seeders + int.Parse((string)torrent["Leechers"]);
|
2017-07-14 05:39:52 +00:00
|
|
|
|
release.PublishDate = DateTime.ParseExact((string)torrent["UploadTime"], "yyyy-MM-dd HH:mm:ss",
|
2016-06-23 10:34:19 +00:00
|
|
|
|
CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal).ToLocalTime();
|
2017-07-14 05:39:52 +00:00
|
|
|
|
release.Link = new Uri(string.Format("{0}?action=download&id={1}&authkey={2}&torrent_pass={3}",
|
2017-11-05 09:42:03 +00:00
|
|
|
|
SearchUrl, WebUtility.UrlEncode((string)torrent["Id"]), WebUtility.UrlEncode(AuthKey), WebUtility.UrlEncode(configData.Passkey.Value)));
|
2017-11-10 15:56:08 +00:00
|
|
|
|
release.Guid = release.Link;
|
2016-06-23 10:34:19 +00:00
|
|
|
|
release.MinimumRatio = 1;
|
|
|
|
|
release.MinimumSeedTime = 345600;
|
2019-10-05 20:30:28 +00:00
|
|
|
|
release.DownloadVolumeFactor = 1;
|
|
|
|
|
release.UploadVolumeFactor = 1;
|
2017-02-21 12:07:54 +00:00
|
|
|
|
release.Category = new List<int> { 2000 };
|
2016-06-23 10:34:19 +00:00
|
|
|
|
|
|
|
|
|
bool golden, scene, check;
|
|
|
|
|
bool.TryParse((string)torrent["GoldenPopcorn"], out golden);
|
|
|
|
|
bool.TryParse((string)torrent["Scene"], out scene);
|
|
|
|
|
bool.TryParse((string)torrent["Checked"], out check);
|
|
|
|
|
|
|
|
|
|
if (configGoldenPopcornOnly && !golden)
|
|
|
|
|
{
|
|
|
|
|
continue; //Skip release if user only wants GoldenPopcorn
|
|
|
|
|
}
|
|
|
|
|
if (configSceneOnly && !scene)
|
|
|
|
|
{
|
|
|
|
|
continue; //Skip release if user only wants Scene
|
|
|
|
|
}
|
|
|
|
|
if (configCheckedOnly && !check)
|
|
|
|
|
{
|
|
|
|
|
continue; //Skip release if user only wants Checked
|
|
|
|
|
}
|
2017-03-19 15:00:54 +00:00
|
|
|
|
|
|
|
|
|
var titletags = new List<string>();
|
|
|
|
|
string Quality = (string)torrent["Quality"];
|
|
|
|
|
string Container = (string)torrent["Container"];
|
|
|
|
|
string Codec = (string)torrent["Codec"];
|
|
|
|
|
string Resolution = (string)torrent["Resolution"];
|
2017-04-15 08:45:10 +00:00
|
|
|
|
string Source = (string)torrent["Source"];
|
|
|
|
|
|
|
|
|
|
if (Year != null)
|
|
|
|
|
{
|
|
|
|
|
release.Description += string.Format("<br>\nYear: {0}", Year);
|
2017-03-19 15:00:54 +00:00
|
|
|
|
}
|
2017-04-15 08:45:10 +00:00
|
|
|
|
if (Quality != null)
|
|
|
|
|
{
|
|
|
|
|
release.Description += string.Format("<br>\nQuality: {0}", Quality);
|
2017-03-19 15:00:54 +00:00
|
|
|
|
}
|
2017-04-15 08:45:10 +00:00
|
|
|
|
if (Resolution != null)
|
|
|
|
|
{
|
|
|
|
|
titletags.Add(Resolution);
|
|
|
|
|
release.Description += string.Format("<br>\nResolution: {0}", Resolution);
|
2017-03-19 15:00:54 +00:00
|
|
|
|
}
|
2017-04-15 08:45:10 +00:00
|
|
|
|
if (Source != null)
|
|
|
|
|
{
|
|
|
|
|
titletags.Add(Source);
|
|
|
|
|
release.Description += string.Format("<br>\nSource: {0}", Source);
|
2017-03-19 15:00:54 +00:00
|
|
|
|
}
|
2017-04-15 08:45:10 +00:00
|
|
|
|
if (Codec != null)
|
|
|
|
|
{
|
|
|
|
|
titletags.Add(Codec);
|
|
|
|
|
release.Description += string.Format("<br>\nCodec: {0}", Codec);
|
|
|
|
|
}
|
|
|
|
|
if (Container != null)
|
|
|
|
|
{
|
|
|
|
|
titletags.Add(Container);
|
|
|
|
|
release.Description += string.Format("<br>\nContainer: {0}", Container);
|
2017-03-19 15:00:54 +00:00
|
|
|
|
}
|
2017-04-15 08:45:10 +00:00
|
|
|
|
if (scene)
|
|
|
|
|
{
|
|
|
|
|
titletags.Add("Scene");
|
|
|
|
|
release.Description += "<br>\nScene";
|
2017-03-19 15:00:54 +00:00
|
|
|
|
}
|
2017-04-15 08:45:10 +00:00
|
|
|
|
if (check)
|
|
|
|
|
{
|
|
|
|
|
titletags.Add("Checked");
|
|
|
|
|
release.Description += "<br>\nChecked";
|
|
|
|
|
}
|
|
|
|
|
if (golden)
|
|
|
|
|
{
|
|
|
|
|
titletags.Add("Golden Popcorn");
|
|
|
|
|
release.Description += "<br>\nGolden Popcorn";
|
2017-03-19 15:00:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (titletags.Count() > 0)
|
|
|
|
|
release.Title += " [" + string.Join(" / ", titletags) + "]";
|
|
|
|
|
|
2019-10-05 20:30:28 +00:00
|
|
|
|
bool freeleech;
|
|
|
|
|
bool.TryParse((string)torrent["FreeleechType"], out freeleech);
|
|
|
|
|
if (freeleech)
|
|
|
|
|
release.DownloadVolumeFactor = 0;
|
|
|
|
|
|
2016-06-23 10:34:19 +00:00
|
|
|
|
releases.Add(release);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
OnParseError(results.Content, ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return releases;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|