cardigann: add attribute for download selector (#6891)

This commit is contained in:
Diego Heras
2020-01-11 05:52:11 +01:00
committed by garfield69
parent 74dcf37352
commit 9413006524
58 changed files with 82 additions and 14 deletions

View File

@@ -140,6 +140,7 @@
download: download:
# the .torrent url is on the on the details page # the .torrent url is on the on the details page
selector: ul li a[href^="{{ .Config.downloadlink }}"] selector: ul li a[href^="{{ .Config.downloadlink }}"]
attribute: href
search: search:
paths: paths:

View File

@@ -38,6 +38,7 @@
download: download:
selector: a[href^="magnet:?xt="] selector: a[href^="magnet:?xt="]
attribute: href
search: search:
paths: paths:

View File

@@ -125,6 +125,7 @@
thanks: 1 thanks: 1
rndval: "1487013827343" rndval: "1487013827343"
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -102,6 +102,7 @@
download: download:
selector: a[href*="{{ .Config.downloadlink }}"] selector: a[href*="{{ .Config.downloadlink }}"]
attribute: href
search: search:
paths: paths:

View File

@@ -67,6 +67,7 @@
download: download:
selector: a[href*="/download/"] selector: a[href*="/download/"]
attribute: href
search: search:
paths: paths:

View File

@@ -55,7 +55,8 @@
download: download:
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:
- path: browse.php - path: browse.php

View File

@@ -41,6 +41,7 @@
download: download:
selector: a[ href^="magnet:?xt="] selector: a[ href^="magnet:?xt="]
attribute: href
search: search:
paths: paths:

View File

@@ -21,6 +21,8 @@
download: download:
selector: a#magnetOpen selector: a#magnetOpen
attribute: href
search: search:
paths: paths:
- path: "search/{{if .Keywords}}{{ .Keywords}}{{else}}2019{{end}}" - path: "search/{{if .Keywords}}{{ .Keywords}}{{else}}2019{{end}}"

View File

@@ -28,7 +28,8 @@
download: download:
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:
- path: torrents-search.php - path: torrents-search.php

View File

@@ -92,6 +92,7 @@
infohash: "\"{{ .DownloadUri.Query.id }}\"" infohash: "\"{{ .DownloadUri.Query.id }}\""
thanks: 1 thanks: 1
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -142,6 +142,7 @@
to: "give" to: "give"
torrent: "{{ .DownloadUri.Query.id }}" torrent: "{{ .DownloadUri.Query.id }}"
selector: a:contains("Télécharger ce torrent") selector: a:contains("Télécharger ce torrent")
attribute: href
search: search:
paths: paths:

View File

@@ -284,6 +284,7 @@
download: download:
selector: a[href^="magnet:?xt="] selector: a[href^="magnet:?xt="]
attribute: href
search: search:
paths: paths:

View File

@@ -185,6 +185,7 @@
thanks: 1 thanks: 1
rndval: "1487013827343" rndval: "1487013827343"
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -80,6 +80,7 @@
download: download:
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
# https://dxp.ru/torrents.php?search=&sort=4&type=desc # https://dxp.ru/torrents.php?search=&sort=4&type=desc

View File

@@ -297,6 +297,7 @@
download: download:
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -42,6 +42,7 @@
download: download:
selector: a.linktorrent selector: a.linktorrent
attribute: href
search: search:
paths: paths:

View File

@@ -96,6 +96,7 @@
download: download:
selector: a[href^="{{ .Config.downloadlink }}"] selector: a[href^="{{ .Config.downloadlink }}"]
attribute: href
search: search:
path: "{{ if .Keywords }}torrents-search.php{{else}}torrents.php{{end}}" path: "{{ if .Keywords }}torrents-search.php{{else}}torrents.php{{end}}"

View File

@@ -76,6 +76,7 @@
text: "{{ .Config.thankyou }}" text: "{{ .Config.thankyou }}"
submit: Opslaan submit: Opslaan
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -44,6 +44,7 @@
download: download:
selector: a[href^="magnet:?xt="] selector: a[href^="magnet:?xt="]
attribute: href
search: search:
paths: paths:

View File

@@ -91,6 +91,7 @@
download: download:
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -32,6 +32,7 @@
download: download:
selector: a[href^="/download.php?id="] selector: a[href^="/download.php?id="]
attribute: href
search: search:
# http://firebit.net/index.php?do=search&type=simple&q=2019 # http://firebit.net/index.php?do=search&type=simple&q=2019

View File

@@ -233,6 +233,7 @@
download: download:
selector: a[href*="/Telechargement/"] selector: a[href*="/Telechargement/"]
attribute: href
search: search:
paths: paths:

View File

@@ -30,6 +30,7 @@
download: download:
selector: a#download_torrent selector: a#download_torrent
attribute: href
search: search:
paths: paths:

View File

@@ -179,6 +179,7 @@
to: "give" to: "give"
torrent: "{{ .DownloadUri.Query.id }}" torrent: "{{ .DownloadUri.Query.id }}"
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -123,6 +123,7 @@
thanks: "1" thanks: "1"
rndval: "1487013827343" rndval: "1487013827343"
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -54,6 +54,7 @@
download: download:
selector: a[href*="{{ .Config.downloadlink }}"] selector: a[href*="{{ .Config.downloadlink }}"]
attribute: href
search: search:
paths: paths:

View File

@@ -50,6 +50,7 @@
download: download:
selector: a[href^="magnet:?xt="] selector: a[href^="magnet:?xt="]
attribute: href
search: search:
# https://hdreactor.net/index.php?do=search&subaction=search&showposts=1&story=2019&catlist[]=2001&catlist[]=2006 # https://hdreactor.net/index.php?do=search&subaction=search&showposts=1&story=2019&catlist[]=2001&catlist[]=2006

View File

@@ -52,6 +52,7 @@
download: download:
selector: a.btn-magnet selector: a.btn-magnet
attribute: href
filters: filters:
- name: querystring - name: querystring
args: url args: url

View File

@@ -44,6 +44,7 @@
download: download:
selector: a[href^="/torrentfiles/"] selector: a[href^="/torrentfiles/"]
attribute: href
search: search:
paths: paths:

View File

@@ -37,6 +37,7 @@
download: download:
selector: a[href*="/dl.php?id="] selector: a[href*="/dl.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -52,6 +52,7 @@
download: download:
# the .torrent url is on the on the details page # the .torrent url is on the on the details page
selector: a.csprite_dltorrent[href^="{{ .Config.downloadlink }}"] selector: a.csprite_dltorrent[href^="{{ .Config.downloadlink }}"]
attribute: href
search: search:
paths: paths:

View File

@@ -30,6 +30,7 @@
download: download:
selector: a#download-file selector: a#download-file
attribute: href
search: search:
paths: paths:

View File

@@ -23,6 +23,7 @@
download: download:
selector: a[href^="/torrents/"] selector: a[href^="/torrents/"]
attribute: href
search: search:
paths: paths:

View File

@@ -20,6 +20,7 @@
download: download:
selector: a.torrent_download selector: a.torrent_download
attribute: href
search: search:
paths: paths:

View File

@@ -660,6 +660,7 @@
download: download:
selector: a[href^="./download/file.php?id="] selector: a[href^="./download/file.php?id="]
attribute: href
search: search:
# http://www.nntt.org/search.php?sr=topics&sf=titleonly&fp=1&tracker_search=torrent&keywords=2019&fid[]=154 # http://www.nntt.org/search.php?sr=topics&sf=titleonly&fp=1&tracker_search=torrent&keywords=2019&fid[]=154

View File

@@ -39,6 +39,7 @@
download: download:
selector: a[href*="{{ .Config.downloadlink }}"] selector: a[href*="{{ .Config.downloadlink }}"]
attribute: href
search: search:
paths: paths:

View File

@@ -626,6 +626,7 @@
download: download:
selector: a[href^="magnet:?xt="] selector: a[href^="magnet:?xt="]
attribute: href
search: search:
paths: paths:

View File

@@ -91,6 +91,7 @@
download: download:
selector: a[href^="magnet:?"] selector: a[href^="magnet:?"]
attribute: href
search: search:
paths: paths:

View File

@@ -295,6 +295,7 @@
download: download:
selector: a[href^="./download/file.php?id="] selector: a[href^="./download/file.php?id="]
attribute: href
search: search:
# http://rus-media.org/search.php?tracker_search=torrent&sr=topics&keywords=2019&fid[]=54 # http://rus-media.org/search.php?tracker_search=torrent&sr=topics&keywords=2019&fid[]=54

View File

@@ -50,9 +50,10 @@
- selector: div.recover-error2 - selector: div.recover-error2
test: test:
path: profile.php path: profile.php
download: download:
selector: a[href^="download.php/"] selector: a[href^="download.php/"]
attribute: href
search: search:
paths: paths:

View File

@@ -21,6 +21,7 @@
download: download:
selector: a[href*="/torrent/"] selector: a[href*="/torrent/"]
attribute: href
search: search:
# https://seedpeer.me/today # https://seedpeer.me/today

View File

@@ -103,6 +103,7 @@
_action: "say_thank" _action: "say_thank"
id: "{{ .DownloadUri.Query.id }}" id: "{{ .DownloadUri.Query.id }}"
selector: a[href^="downloadnew.php?id="] selector: a[href^="downloadnew.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -35,6 +35,7 @@
download: download:
selector: a[href^="/album/download-torrent/"] selector: a[href^="/album/download-torrent/"]
attribute: href
search: search:
paths: paths:

View File

@@ -41,6 +41,7 @@
download: download:
selector: a[href^="magnet:?xt="] selector: a[href^="magnet:?xt="]
attribute: href
search: search:
path: recherche path: recherche

View File

@@ -90,7 +90,7 @@
type: info type: info
label: How to get the Cookie label: How to get the Cookie
default: "<ol><li>Login to this tracker in your browser<li>Open the <b>DevTools</b> panel by pressing <b>F12</b><li>Select the <b>Network</b> tab<li>Click on the <b>Doc</b> button<li>Refresh the page by pressing <b>F5</b><li>Select the <b>Headers</b> tab<li>Find 'cookie:' in the <b>Request Headers</b> section<li>Copy & paste the whole cookie string to here</ol>" default: "<ol><li>Login to this tracker in your browser<li>Open the <b>DevTools</b> panel by pressing <b>F12</b><li>Select the <b>Network</b> tab<li>Click on the <b>Doc</b> button<li>Refresh the page by pressing <b>F5</b><li>Select the <b>Headers</b> tab<li>Find 'cookie:' in the <b>Request Headers</b> section<li>Copy & paste the whole cookie string to here</ol>"
login: login:
method: cookie method: cookie
inputs: inputs:
@@ -100,7 +100,8 @@
download: download:
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:
- path: browse.php - path: browse.php

View File

@@ -35,6 +35,7 @@
torrent: "{{ .DownloadUri.Query.id }}" torrent: "{{ .DownloadUri.Query.id }}"
submit: "Thanks!" submit: "Thanks!"
selector: a[href^="download.php?id="] selector: a[href^="download.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -1,4 +1,4 @@
--- ---
site: tfile site: tfile
name: TFile name: TFile
description: "TFile is a RUSSIAN Public Torrent Tracker for MOVIES / TV / GENERAL" description: "TFile is a RUSSIAN Public Torrent Tracker for MOVIES / TV / GENERAL"
@@ -854,6 +854,7 @@
download: download:
selector: a[href^="{{ .Config.downloadlink }}"] selector: a[href^="{{ .Config.downloadlink }}"]
attribute: href
search: search:
paths: paths:
@@ -923,4 +924,4 @@
text: 0 text: 0
uploadvolumefactor: uploadvolumefactor:
text: 1 text: 1
# engine n/a # engine n/a

View File

@@ -103,6 +103,7 @@
inputs: inputs:
torrentid: "{{ .DownloadUri.Query.id }}" torrentid: "{{ .DownloadUri.Query.id }}"
selector: a[href*="/download.php?id="] selector: a[href*="/download.php?id="]
attribute: href
search: search:
paths: paths:

View File

@@ -21,6 +21,8 @@
download: download:
selector: a#torrent selector: a#torrent
attribute: href
search: search:
paths: paths:
# http://topnow.se/search.php?dayq=mandalorian # http://topnow.se/search.php?dayq=mandalorian

View File

@@ -45,6 +45,7 @@
download: download:
selector: a[href^="magnet:?xt="] selector: a[href^="magnet:?xt="]
attribute: href
search: search:
paths: paths:

View File

@@ -55,7 +55,7 @@
download: download:
selector: a[href^="magnet:?"] selector: a[href^="magnet:?"]
attribute: href attribute: href
search: search:
paths: paths:
- path: "{{ if .Keywords }}/search_torrent/{{ re_replace .Keywords \"[']+\" \"\" }}/page-0{{else}}/top_torrent.html{{end}}" - path: "{{ if .Keywords }}/search_torrent/{{ re_replace .Keywords \"[']+\" \"\" }}/page-0{{else}}/top_torrent.html{{end}}"

View File

@@ -40,6 +40,7 @@
download: download:
selector: a[href^="magnet:?xt="] selector: a[href^="magnet:?xt="]
attribute: href
search: search:
paths: paths:

View File

@@ -36,6 +36,7 @@
download: download:
selector: a[href^="{{ .Config.downloadlink }}"] selector: a[href^="{{ .Config.downloadlink }}"]
attribute: href
search: search:
paths: paths:

View File

@@ -67,6 +67,7 @@
download: download:
selector: a[href^="magnet:?xt="] selector: a[href^="magnet:?xt="]
attribute: href
search: search:
# https://torrentparadise.org/search.php?f=monday+night # https://torrentparadise.org/search.php?f=monday+night

View File

@@ -99,6 +99,7 @@
download: download:
selector: a[href^="d.php?keyalert1="] selector: a[href^="d.php?keyalert1="]
attribute: href
filters: filters:
- name: replace - name: replace
args: ["d.php?keyalert1=", "/dI.php/"] args: ["d.php?keyalert1=", "/dI.php/"]

View File

@@ -1330,6 +1330,7 @@
download: download:
selector: a[href^="./download/file.php?id="]:not(img) selector: a[href^="./download/file.php?id="]:not(img)
attribute: href
search: search:
paths: paths:

View File

@@ -1734,13 +1734,23 @@ namespace Jackett.Common.Indexers
if (response.IsRedirect) if (response.IsRedirect)
response = await RequestStringWithCookies(response.RedirectingTo); response = await RequestStringWithCookies(response.RedirectingTo);
var results = response.Content; var results = response.Content;
var SearchResultParser = new HtmlParser(); var searchResultParser = new HtmlParser();
var SearchResultDocument = SearchResultParser.ParseDocument(results); var searchResultDocument = searchResultParser.ParseDocument(results);
var DlUri = SearchResultDocument.QuerySelector(selector); var downloadElement = searchResultDocument.QuerySelector(selector);
if (DlUri != null) if (downloadElement != null)
{ {
logger.Debug(string.Format("CardigannIndexer ({0}): Download selector {1} matched:{2}", ID, selector, DlUri.ToHtmlPretty())); logger.Debug(string.Format("CardigannIndexer ({0}): Download selector {1} matched:{2}", ID, selector, downloadElement.ToHtmlPretty()));
var href = DlUri.GetAttribute("href"); var href = "";
if (Download.Attribute != null)
{
href = downloadElement.GetAttribute(Download.Attribute);
if (href == null)
throw new Exception(string.Format("Attribute \"{0}\" is not set for element {1}", Download.Attribute, downloadElement.ToHtmlPretty()));
}
else
{
href = downloadElement.TextContent;
}
href = applyFilters(href, Download.Filters, variables); href = applyFilters(href, Download.Filters, variables);
link = resolvePath(href, link); link = resolvePath(href, link);
} }

View File

@@ -197,6 +197,7 @@ namespace Jackett.Common.Models
public class downloadBlock public class downloadBlock
{ {
public string Selector { get; set; } public string Selector { get; set; }
public string Attribute { get; set; }
public List<filterBlock> Filters { get; set; } public List<filterBlock> Filters { get; set; }
public string Method { get; set; } public string Method { get; set; }
public requestBlock Before { get; set; } public requestBlock Before { get; set; }