### Install juscraper with uv Source: https://github.com/jtrecenti/juscraper/blob/main/README.md Alternative installation method using the 'uv' package manager. ```bash uv add juscraper ``` -------------------------------- ### Initialize Process Download Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/jusbr.ipynb Initializes the process list and calls the jusbr.cpopg function to start the download. This is suitable for a small number of processes. ```python import os import pandas as pd from tqdm import tqdm from joblib import Parallel, delayed processos = ['15006452620228260536'] resultados = jusbr.cpopg(processos) ``` -------------------------------- ### Web Signer Plugin Installation Prompt (HTML) Source: https://github.com/jtrecenti/juscraper/blob/main/tests/tjce/samples/cjsg/post_initial.html This message informs the user that the Web Signer plugin is required for digital certificate usage and prompts them to install it. It provides options to install, cancel, or seek help. ```html Para utilização do certificado digital no Portal e-SAJ é necessário a instalação do plug-in Web Signer. Por favor, realize a instalação antes de continuar. Instalar Cancelar Ajuda ``` -------------------------------- ### Install juscraper Development Version Source: https://github.com/jtrecenti/juscraper/blob/main/README.md Install the most recent version directly from the GitHub repository for development purposes. ```bash pip install git+https://github.com/jtrecenti/juscraper.git ``` -------------------------------- ### Initialize TJES Scraper Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjes.ipynb Create an instance of the TJES scraper. No specific setup is required beyond importing the library. ```python import juscraper as jus # Create a TJES scraper tjes = jus.scraper('tjes') ``` -------------------------------- ### Install juscraper via PyPI Source: https://github.com/jtrecenti/juscraper/blob/main/README.md Use this command to install the latest stable version of juscraper from the Python Package Index. ```bash pip install juscraper ``` -------------------------------- ### Initialize JUSBR Scraper Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/jusbr.ipynb Initializes the JUSBR scraper instance. Ensure the juscraper library is installed. ```python import juscraper as jus import json jusbr = jus.scraper("jusbr") ``` -------------------------------- ### Download Progress Indicator (Start) Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjpe.ipynb Shows the initial progress indicator during the download of TJPE Acórdãos. This is typically displayed at the beginning of the download process. ```python Downloading TJPE Acórdãos: 0%| | 0/1 [00:00 ``` -------------------------------- ### Download Documents with Text and Binary from cpopg DataFrame Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/pdpj.ipynb Download documents, including both text and binary content, from a cpopg DataFrame. This example shows how to specify max_docs_per_process, with_text, and with_binary flags. ```python # Tambem da pra passar o resultado de cpopg direto df_cpopg = pdpj.cpopg("50211226520184036100") out2 = pdpj.download_documents(df_cpopg, max_docs_per_process=2, with_text=True, with_binary=True) out2[["processo", "id_documento", "nome", "tipo_nome"]] ``` -------------------------------- ### Search Processes with Multiple Filters Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/pdpj.ipynb Example of searching processes using multiple filters, such as tribunal and update date range. This can be resource-intensive depending on the data volume. The `paginas` argument can accept a range. ```python # Exemplo com varios filtros: processos do TRF1 atualizados em uma janela. # Descomente para rodar -- pode demorar conforme volume. # df_janela = pdpj.pesquisa( tribunal="TRF1", data_atualizacao_inicio="2026-04-01T00:00:00.000", data_atualizacao_fim="2026-04-30T23:59:59.999", paginas=range(1, 4), ) df_janela.shape ``` -------------------------------- ### Download Raw HTML for a Process Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/trf5.ipynb Use `cpopg_download` to fetch the raw HTML content for a given process CNJ. This is useful for caching or manual inspection. ```python htmls = trf5.cpopg_download("0058457-31.2025.4.05.8000") print(f"got {len(htmls)} HTML(s), {len(htmls[0])} chars") ``` ```text Output: TRF5 cpopg: 100%|██████████| 1/1 [00:00<00:00, 1.48it/s] ``` ```text Output: got 1 HTML(s), 80218 chars ``` -------------------------------- ### Initialize e-SAJ Environment Variables Source: https://github.com/jtrecenti/juscraper/blob/main/tests/tjac/samples/cjsg/post_initial.html Sets up the base URL and path for various e-SAJ resources like CSS, JS, and images. This configuration is essential for the correct loading of front-end assets. ```javascript window.saj = window.saj || {}; window.saj.env = window.saj.env || {}; window.saj.env.root = '/cjsg'; window.saj.env.css = '/cjsg/css'; window.saj.env.js = '/cjsg/js'; window.saj.env.imagens = '/cjsg/imagens'; window.saj.env.cliente = 'AC'; ``` -------------------------------- ### RichFaces and PJE Utilities Initialization Source: https://github.com/jtrecenti/juscraper/blob/main/tests/trf1/samples/cpopg/detail_paginated.html Sets up RichFaces extended skinning and initializes PJE utility object with user IP and location data. ```javascript window.RICH_FACES_EXTENDED_SKINNING_ON=true; window.pjeUtils = { ipDoUsuario: "177.189.2.74", cpfUsuario: "", localizacaoAtualCombo: "" }; ``` -------------------------------- ### Initialize Tooltip and Form Validation for Start Date Source: https://github.com/jtrecenti/juscraper/blob/main/tests/tjsp/samples/cjpg/results_normal_page_01.html Initializes a tooltip for the start date input and removes default HTML5 form validation attributes. It also conditionally applies 'aria-required' and 'required' attributes if a specific condition is met. ```javascript (function($){ $(function() { var saj = $.saj; var id = 'iddadosConsulta.dtInicio'; var idObjetoReferencia = '#' + id; if ('' !== '' && !false) { $(idObjetoReferencia).registrarTooltip({ conteudoTooltip: '', posicaoTooltip: 'direita', objReferenciaPosicaoTooltip:$(idObjetoReferencia) }); } //remove comportamento de exibir mensagem de erro típica do html5 $('form:visible').attr('novalidate',''); if (''){ $(idObjetoReferencia).attr('aria-required','true').attr('required',''); } }); })(jQuery); ``` -------------------------------- ### Get DataFrame Columns Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjac.ipynb Retrieves a list of column names from the scraped DataFrame. ```python df.columns.tolist() ``` -------------------------------- ### Initialize TJGO Scraper Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjgo.ipynb Import the juscraper library and initialize the TJGO scraper. This is the first step before performing any searches. ```python import juscraper as jus tjgo = jus.scraper('tjgo') ``` -------------------------------- ### Downloading and Parsing Raw HTML with TJTO Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjto.ipynb This example demonstrates downloading raw HTML content using 'cjsg_download' and then parsing it into a DataFrame using 'cjsg_parse'. It shows how to check the number of pages downloaded and the size of the raw HTML. ```python brutos = tjto.cjsg_download('direito', paginas=range(1, 3)) print(f"Pages downloaded: {len(brutos)}") print(f"Raw HTML size (page 1): {len(brutos[0])} chars") dados = tjto.cjsg_parse(brutos) print(f"\nParsed shape: {dados.shape}") dados.head(3) ``` -------------------------------- ### Initialize TJPA Scraper Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjpa.ipynb Import the juscraper library and create an instance of the TJPA scraper. ```python import juscraper as jus # Create the TJPA scraper tjpa = jus.scraper('tjpa') ``` -------------------------------- ### Initialize TJPR Scraper Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjpr.ipynb Initializes the TJPR scraper object. Ensure the 'juscraper' library is installed. ```python import juscraper as jus # cria um objeto tjpr tjpr = jus.scraper('tjpr') ``` -------------------------------- ### Initialize Modal Panel Source: https://github.com/jtrecenti/juscraper/blob/main/tests/trf1/samples/cpopg/detail_normal.html Initializes a modal panel with various configuration options including size, behavior, and visual state. ```javascript new ModalPanel('modalStatus', { width: -1, height: -1, minWidth: -1, minHeight: -1, resizeable: true, moveable: true, left: "auto", top: "auto", zindex: 100,onresize: '',onmove: '',onshow: '',onhide: '',onbeforeshow: '',onbeforehide: '', domElementAttachment: "", keepVisualState: false, showWhenRendered: false, selectBehavior: "disable", autosized: false, overlapEmbedObjects: false}); ``` -------------------------------- ### Get Process DataFrame Columns Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/trf5.ipynb Retrieve a list of all column names available in the process DataFrame. ```python df.columns.tolist() ``` ```text Result: ['processo', 'data_distribuicao', 'classe', 'assunto', 'jurisdicao', 'orgao_julgador', 'endereco_orgao', 'polo_ativo', 'polo_passivo', 'movimentacoes', 'documentos', 'id_cnj'] ``` -------------------------------- ### Get Jurisprudence Columns Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjap.ipynb Retrieve a list of all column names available in the scraped jurisprudence data. ```python dados_cjsg.columns.tolist() ``` -------------------------------- ### Configure CJSG Environment Variables Source: https://github.com/jtrecenti/juscraper/blob/main/tests/tjms/samples/cjsg/post_initial.html Sets up the root path and subdirectories for CSS, JavaScript, and images for the CJSG system. ```javascript window.saj = window.saj || {}; window.saj.env = window.saj.env || {}; window.saj.env.root = '/cjsg'; window.saj.env.css = '/cjsg/css'; window.saj.env.js = '/cjsg/js'; window.saj.env.imagens = '/cjsg/js'; window.saj.env.cliente = 'MS'; ``` -------------------------------- ### Initialize TJDFT Scraper Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjdft.ipynb Instantiate the TJDFT scraper object from the juscraper library. Ensure juscraper is installed. ```python import juscraper as jus # cria um objeto tjdft tjdft = jus.scraper('tjdft') ``` -------------------------------- ### Initialize Google Analytics Source: https://github.com/jtrecenti/juscraper/blob/main/tests/tjrj/samples/cjsg/post_initial.html Sets up Google Analytics tracking by creating and appending a script tag to the document's head. This should be included on pages where analytics are needed. ```javascript var googleAnalyticsId = 'G-5ZKHD9TRY6'; var scriptTag = document.createElement('script'); scriptTag.async = true; scriptTag.src = 'https://www.googletagmanager.com/gtag/js?id=' + googleAnalyticsId; document.head.appendChild(scriptTag); window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', 'G-5ZKHD9TRY6'); ``` -------------------------------- ### Get Available Columns Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjes.ipynb After retrieving data, you can inspect the available columns in the resulting DataFrame using this command. ```python # Available columns dados_cjsg.columns.tolist() ``` -------------------------------- ### Initialize TJCE Scraper Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjce.ipynb Import the juscraper library and initialize the TJCE scraper object. ```python import juscraper as jus tjce = jus.scraper('tjce') ``` -------------------------------- ### Initialize TJAL Scraper Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjal.ipynb Import the juscraper library and initialize the TJAL scraper. ```python import juscraper as jus tjal = jus.scraper('tjal') ``` -------------------------------- ### Setup Input Masks Source: https://github.com/jtrecenti/juscraper/blob/main/tests/tjpr/samples/cjsg/ementa_completa.html Initializes input masks for form elements using the Xaprb library. This should be called after the DOM is ready. ```javascript addLoadEvent(function() { Xaprb.InputMask.setupElementMasks(); }); ``` -------------------------------- ### Initialize Saj Environment Variables Source: https://github.com/jtrecenti/juscraper/blob/main/tests/tjsp/samples/cpopg/search.html Initializes the global 'saj' object and its environment properties, setting base paths for CSS, JS, images, and query strings specific to the '/cpopg' context. ```javascript window.saj = window.saj || {}; window.saj.env = window.saj.env || {}; window.saj.env.root = '/cpopg'; window.saj.env.css = '/cpopg/css'; window.saj.env.js = '/cpopg/js'; window.saj.env.imagens = '/cpopg/imagens'; window.saj.env.queryString = 'processo.codigo=9M0002CYG0000&processo.foro=346&processo.numero=1000149-71.2024.8.26.0346'; ``` -------------------------------- ### Initialize PrimeFaces SelectManyCheckbox Component Source: https://github.com/jtrecenti/juscraper/blob/main/tests/tjrr/samples/cjsg/step_02_search.html Initializes a PrimeFaces SelectManyCheckbox component. This snippet is a basic setup without specific configuration options shown. ```javascript function(){ PrimeFaces.cw("SelectManyCheckbox","widget_formPesquisa_tipoOrgaoList",{id:"formPesquisa:tipoOrgaoList"}); } ``` -------------------------------- ### Check for All Digits Source: https://github.com/jtrecenti/juscraper/blob/main/tests/tjmg/samples/cjsg/no_results.html Validates if a given value consists solely of numeric digits. It supports hexadecimal and octal formats by adjusting the allowed character set and starting position. ```javascript function jcv_isAllDigits(argvalue) { argvalue = argvalue.toString(); var validChars = "0123456789"; var startFrom = 0; if (argvalue.substring(0, 2) == "0x") { validChars = "0123456789abcdefABCDEF"; startFrom = 2; } else if (argvalue.charAt(0) == "0") { validChars = "01234567"; startFrom = 1; } else if (argvalue.charAt(0) == "-") { startFrom = 1; } for (var n = startFrom; n < argvalue.length; n++) { if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false; } return true; } ``` -------------------------------- ### Search CJSG with Date Filters Source: https://github.com/jtrecenti/juscraper/blob/main/docs/notebooks/tjal.ipynb Perform a CJSG search filtering by judgment start and end dates, and specify the number of pages. Prints the shape of the resulting DataFrame. ```python df_filtered = tjal.cjsg( 'direito', data_julgamento_inicio='01/01/2024', data_julgamento_fim='30/06/2024', paginas=1, ) print(df_filtered.shape) df_filtered.head(3) ```