UNPKG

brazilian-courts-scrappers

Version:

Data scrapper para fazer raspagem de dados de processos judiciais dos portais de tribunais do Brasil.

73 lines 3.08 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.NotProcessoHomepageException = exports.identifyCorrectScrapper = void 0; const ProjudiTjbaProcessoScrapper_1 = __importDefault(require("./scrappers/ProjudiTjbaProcessoScrapper")); const Pje1gTjbaProcessoScrapper_1 = __importDefault(require("./scrappers/Pje1gTjbaProcessoScrapper")); const Pje1gTrt5ProcessoScrapper_1 = __importDefault(require("./scrappers/Pje1gTrt5ProcessoScrapper")); const NotProcessoHomepageException_1 = __importDefault(require("./exceptions/NotProcessoHomepageException")); exports.NotProcessoHomepageException = NotProcessoHomepageException_1.default; const DOMAINS = [ { name: "TjBaProjudi", hostname: "projudi.tjba.jus.br", scrapper: ProjudiTjbaProcessoScrapper_1.default, }, { name: "TjBaPje1g", hostname: "pje.tjba.jus.br", scrapper: Pje1gTjbaProcessoScrapper_1.default, }, { name: "Trt5Pje1g", hostname: "pje.trt5.jus.br", scrapper: Pje1gTrt5ProcessoScrapper_1.default, }, ]; function identifyCorrectScrapper(doc) { const found = DOMAINS.filter(domainObj => domainObj.hostname === new URL(doc.URL).hostname); if (found.length === 0) return null; return found[0].scrapper; } exports.identifyCorrectScrapper = identifyCorrectScrapper; exports.default = { identifyCorrectScrapper, NotProcessoHomepageException: NotProcessoHomepageException_1.default }; // export function pjeLoadFullTimeline( // conditionsCb: CallableFunction | boolean = true // ): void { // (function () { // const conditionsFromCb = // typeof conditionsCb === "function" ? conditionsCb() : conditionsCb; // if (conditionsFromCb && conditionsForPjeFullLoading()) { // const pjeFullPageLoader = document.createElement("script"); // pjeFullPageLoader.src = chrome.runtime.getURL("timelineLoader.js"); // pjeFullPageLoader.type = "module"; // pjeFullPageLoader.defer = true; // document.head.appendChild(pjeFullPageLoader); // } // })(); // function conditionsForPjeFullLoading(): boolean { // const urlObj = new URL(document.URL); // const PJE_DOMAIN_CONDITIONS_FOR_LOADING = [ // { // hostname: getHostname("TjBaPje1g"), // pathnamePartial: "ConsultaProcesso", // }, // { hostname: getHostname("Trt5Pje1g"), pathnamePartial: "/detalhe" }, // ]; // return PJE_DOMAIN_CONDITIONS_FOR_LOADING.some(courtConditions => { // return ( // urlObj.hostname === courtConditions.hostname && // urlObj.pathname.includes(courtConditions.pathnamePartial) // ); // }); // } // function getHostname(name: string): string { // const found = DOMAINS.filter(domainObj => domainObj.name === name); // if (found.length === 0) return null; // return found[0].hostname; // } // } //# sourceMappingURL=index.js.map