Skip to content

Commit

Permalink
Fix CZ
Browse files Browse the repository at this point in the history
  • Loading branch information
Morea committed Apr 21, 2024
1 parent 0e512e7 commit 883ba3d
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 39 deletions.
48 changes: 35 additions & 13 deletions Find Unique Titles/dist/find.unique.titles.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,9 @@
});
var _utils_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/utils/utils.ts");
var _tracker__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/trackers/tracker.ts");
var common_dom__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../common/dist/dom/index.mjs");
var common_http__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../common/dist/http/index.mjs");
var common_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("../common/dist/dom/index.mjs");
var common_searcher__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../common/dist/searcher/index.mjs");
var common_trackers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../common/dist/trackers/index.mjs");
class CinemaZ {
canBeUsedAsSource() {
return true;
Expand All @@ -809,30 +810,42 @@
return url.includes("cinemaz.to");
}
async* getSearchRequest() {
const requests = [];
document.querySelectorAll("#content-area > div.block > .row")?.forEach((element => {
const rows = document.querySelectorAll("#content-area > div.block > .row");
let elements = Array.from(rows);
if (1 === rows.length) elements = Array.from(rows.item(0).children);
yield {
total: elements.length
};
for (let element of elements) {
const imdbId = (0, _utils_utils__WEBPACK_IMPORTED_MODULE_0__.parseImdbIdFromLink)(element);
const {title, year} = (0, _utils_utils__WEBPACK_IMPORTED_MODULE_0__.parseYearAndTitle)(element.querySelector("a")?.getAttribute("title"));
const request = {
torrents: [],
torrents: [ {
dom: element
} ],
dom: [ element ],
imdbId,
title: ""
title,
year,
category: _tracker__WEBPACK_IMPORTED_MODULE_1__.Category.MOVIE
};
requests.push(request);
}));
yield* (0, _tracker__WEBPACK_IMPORTED_MODULE_1__.toGenerator)(requests);
yield request;
}
}
name() {
return "CinemaZ";
}
async search(request) {
if (!request.imdbId) return _tracker__WEBPACK_IMPORTED_MODULE_1__.SearchResult.NOT_CHECKED;
const queryUrl = "https://cinemaz.to/movies?search=&imdb=" + request.imdbId;
const result = await (0, common_http__WEBPACK_IMPORTED_MODULE_2__.fetchAndParseHtml)(queryUrl);
return result.textContent.includes("No Movie found!") ? _tracker__WEBPACK_IMPORTED_MODULE_1__.SearchResult.NOT_EXIST : _tracker__WEBPACK_IMPORTED_MODULE_1__.SearchResult.EXIST;
const result = await (0, common_searcher__WEBPACK_IMPORTED_MODULE_2__.search)(common_trackers__WEBPACK_IMPORTED_MODULE_3__.CZ, {
movie_title: "",
movie_imdb_id: request.imdbId
});
if (result == common_searcher__WEBPACK_IMPORTED_MODULE_2__.SearchResult.LOGGED_OUT) return _tracker__WEBPACK_IMPORTED_MODULE_1__.SearchResult.NOT_LOGGED_IN;
return result == common_searcher__WEBPACK_IMPORTED_MODULE_2__.SearchResult.NOT_FOUND ? _tracker__WEBPACK_IMPORTED_MODULE_1__.SearchResult.NOT_EXIST : _tracker__WEBPACK_IMPORTED_MODULE_1__.SearchResult.EXIST;
}
insertTrackersSelect(select) {
(0, common_dom__WEBPACK_IMPORTED_MODULE_3__.addChild)(document.querySelector("#content-area > div.well.well-sm"), select);
(0, common_dom__WEBPACK_IMPORTED_MODULE_4__.addChild)(document.querySelector("#content-area > div.well.well-sm"), select);
}
}
},
Expand Down Expand Up @@ -3207,6 +3220,7 @@
__webpack_require__.d(__webpack_exports__, {
AT: () => AT,
Aither: () => Aither,
CZ: () => CZ,
HDb: () => HDb,
KG: () => KG,
MTV: () => MTV,
Expand All @@ -3229,6 +3243,14 @@
matchRegex: /class="overlay-container"|class="movie-poster/,
positiveMatch: true
};
const CZ = {
name: "CZ",
searchUrl: "https://cinemaz.to/movies?search=&imdb=%tt%",
configName: "ET",
loggedOutRegex: /Forgot Your Password/,
matchRegex: /class="overlay-container"|class="movie-poster/,
positiveMatch: true
};
const HDb = {
name: "HDb",
searchUrl: "https://hdbits.org/browse.php?c1=1&c2=1&c3=1&c4=1&c5=1&c7=1&c8=1&imdb=%tt%",
Expand Down
2 changes: 1 addition & 1 deletion Find Unique Titles/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "find.unique.titles",
"description": "Find unique titles to cross seed",
"version": "0.0.10",
"version": "0.0.11",
"author": {
"name": "Mea01"
},
Expand Down
1 change: 0 additions & 1 deletion Find Unique Titles/src/trackers/AvistaZ.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { parseImdbIdFromLink, parseYearAndTitle } from "../utils/utils";
import { tracker, Request, MetaData, SearchResult, Category } from "./tracker";
import { addChild } from "common/dom";
import { fetchAndParseHtml } from "common/http";
import { search, SearchResult as SR } from "common/searcher";
import { AT as ATTracker } from "common/trackers";

Expand Down
61 changes: 37 additions & 24 deletions Find Unique Titles/src/trackers/CinemaZ.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { parseImdbIdFromLink } from "../utils/utils";
import { parseImdbIdFromLink, parseYearAndTitle } from "../utils/utils";
import {
tracker,
Request,
toGenerator,
MetaData,
SearchResult,
Category,
} from "./tracker";
import { addChild } from "common/dom";
import { fetchAndParseHtml } from "common/http";
import { search, SearchResult as SR } from "common/searcher";
import { CZ as CZTracker } from "common/trackers";

export default class CinemaZ implements tracker {
canBeUsedAsSource(): boolean {
Expand All @@ -23,22 +24,34 @@ export default class CinemaZ implements tracker {
}

async *getSearchRequest(): AsyncGenerator<MetaData | Request, void, void> {
const requests: Array<Request> = [];
document
.querySelectorAll("#content-area > div.block > .row")
?.forEach((element: HTMLElement) => {
const imdbId = parseImdbIdFromLink(element);
const rows = document.querySelectorAll("#content-area > div.block > .row");
let elements = Array.from(rows);
if (rows.length === 1) {
elements = Array.from(rows.item(0)!!.children);
}
yield {
total: elements.length,
};
for (let element of elements) {
const imdbId = parseImdbIdFromLink(element);
const { title, year } = parseYearAndTitle(
element.querySelector("a")?.getAttribute("title")
);

const request: Request = {
torrents: [],
dom: [element],
imdbId,
title: "",
};
requests.push(request);
});

yield* toGenerator(requests);
const request: Request = {
torrents: [
{
dom: element,
},
],
dom: [element],
imdbId,
title,
year,
category: Category.MOVIE,
};
yield request;
}
}

name(): string {
Expand All @@ -47,13 +60,13 @@ export default class CinemaZ implements tracker {

async search(request: Request): Promise<SearchResult> {
if (!request.imdbId) return SearchResult.NOT_CHECKED;
const queryUrl = "https://cinemaz.to/movies?search=&imdb=" + request.imdbId;

const result = await fetchAndParseHtml(queryUrl);
const result = await search(CZTracker, {
movie_title: "",
movie_imdb_id: request.imdbId,
});
if (result == SR.LOGGED_OUT) return SearchResult.NOT_LOGGED_IN;
return result == SR.NOT_FOUND ? SearchResult.NOT_EXIST : SearchResult.EXIST;

return result.textContent!!.includes("No Movie found!")
? SearchResult.NOT_EXIST
: SearchResult.EXIST;
}

insertTrackersSelect(select: HTMLElement): void {
Expand Down

0 comments on commit 883ba3d

Please sign in to comment.