Skip to content

Commit

Permalink
fix CHD
Browse files Browse the repository at this point in the history
  • Loading branch information
Gawain12 authored and Morea committed Oct 8, 2023
1 parent e01d8ea commit 95e47c3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
3 changes: 1 addition & 2 deletions Find Unique Titles/config/userscript.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ export const UserScriptConfig: IWebpackUserScript = {
"https://kp.m-team.cc/*",
"https://ncore.pro/torrents.php*",
"https://greatposterwall.com/torrents.php*",
"https://chdbits.co/torrents.php*",
"https://ptchdbits.co/torrents.php*",
"https://hdsky.me/torrents.php*",

],
require: [
`https://cdn.jsdelivr.net/npm/jquery@${pkg.dependencies.jquery}/dist/jquery.min.js`,
Expand Down
22 changes: 11 additions & 11 deletions Find Unique Titles/dist/find.unique.titles.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// @match https://kp.m-team.cc/*
// @match https://ncore.pro/torrents.php*
// @match https://greatposterwall.com/torrents.php*
// @match https://chdbits.co/torrents.php*
// @match https://ptchdbits.co/torrents.php*
// @match https://hdsky.me/torrents.php*
// @grant GM.xmlHttpRequest
// @grant GM.setValue
Expand Down Expand Up @@ -716,31 +716,30 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ });
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/utils */ "./src/utils/utils.ts");
/* harmony import */ var common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! common */ "../common/dist/index.mjs");
/* harmony import */ var _utils_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/dom */ "./src/utils/dom.ts");
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }



class CHD {
constructor() {
_defineProperty(this, "lst", [1, 2, 1, 2]);
}
canBeUsedAsSource() {
return true;
}
canBeUsedAsTarget() {
return false;
}
canRun(url) {
return url.includes("chdbits.co");
return url.includes("ptchdbits.co");
}
getSearchRequest() {
return _asyncToGenerator(function* () {
var requests = [];
for (var element of document.querySelectorAll('.torrents')[0].children[0].children) {
var _element$children$;
var nodes = document.querySelectorAll('.torrents')[0].children[0].children;
(0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.updateTotalCount)(nodes.length);
var i = 1;
for (var element of nodes) {
(0,_utils_dom__WEBPACK_IMPORTED_MODULE_2__.updateCount)(i++);
if (!element.querySelector(".torrentname")) {
continue;
}
Expand All @@ -750,7 +749,8 @@ class CHD {
}
var response = yield common__WEBPACK_IMPORTED_MODULE_1__["default"].http.fetchAndParseHtml(link.href);
var imdbId = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_0__.parseImdbIdFromLink)(response);
var size = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_0__.parseSize)((_element$children$ = element.children[6]) === null || _element$children$ === void 0 ? void 0 : _element$children$.textContent);
var size = (0,_utils_utils__WEBPACK_IMPORTED_MODULE_0__.parseSize)(element.querySelector('.rowfollow:nth-child(5)').innerText);
console.log("size:", size);
var request = {
torrents: [{
size,
Expand Down
2 changes: 1 addition & 1 deletion Find Unique Titles/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const main = async function () {
console.log("Init User script");
/******************************************************************************/

let only_show_unique_titles = true; // change to true if you wish
let only_show_unique_titles = false; // change to true if you wish
let better_constant = 1.15; // you can change this too.. wouldn't recommend going below 1.05
let useCache = false;

Expand Down
17 changes: 10 additions & 7 deletions Find Unique Titles/src/trackers/CHD.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { parseImdbIdFromLink, parseSize } from "../utils/utils";
import { tracker, Request } from "./tracker";
import tracker_tools from "common";
import { updateCount, updateTotalCount } from "../utils/dom";

export default class CHD implements tracker {
canBeUsedAsSource(): boolean {
Expand All @@ -10,18 +11,20 @@ export default class CHD implements tracker {
canBeUsedAsTarget(): boolean {
return false;
}

canRun(url: string): boolean {
return url.includes("chdbits.co");
return url.includes("ptchdbits.co");
}
lst=[1,2,1,2,]
async getSearchRequest(): Promise<Array<Request>> {
const requests: Array<Request> = [];
for (const element of document.querySelectorAll('.torrents')[0].children[0].children) {
let nodes =document.querySelectorAll('.torrents')[0].children[0].children;
updateTotalCount(nodes.length);
let i = 1;
for (const element of nodes) {
updateCount(i++);
if (!element.querySelector(".torrentname")) {
continue;
}

const link: HTMLAnchorElement | null = element.querySelector(
'a[href*="details.php?id"]'
);
Expand All @@ -33,8 +36,8 @@ export default class CHD implements tracker {
);
const imdbId = parseImdbIdFromLink(response as HTMLElement);

const size = parseSize(element.children[6]?.textContent as string);

const size = parseSize(element.querySelector('.rowfollow:nth-child(5)').innerText);
console.log("size:",size);
const request: Request = {
torrents: [
{
Expand Down

0 comments on commit 95e47c3

Please sign in to comment.