CLI Reference¶
OPAL provides command-line tools for scraping Alabama news sites and court records. For the easiest way to build commands, use our Interactive Command Builder which provides a visual interface with examples and real-time validation.
Command Structure¶
Basic Syntax¶
Available Tools¶
-
Main OPAL CLI - For news articles and basic court scraping
-
Configurable Court Extractor - For advanced court searches with filters
Common Examples¶
News Scraping¶
1819 News Articles:
Alabama Daily News:
Court Records¶
Basic Court Scraping:
python -m opal --url https://publicportal.alappeals.gov/portal/search/case/results --parser ParserAppealsAL
Advanced Court Search:
# Last 7 days of civil cases, excluding closed
python -m opal.configurable_court_extractor --court civil --date-period 7d --exclude-closed
# Last month of criminal cases (JSON and CSV automatically generated)
python -m opal.configurable_court_extractor --court criminal --date-period 1m
Complete Parameter Reference¶
Main OPAL Parameters¶
Parameter | Description | Required | Example |
---|---|---|---|
--url |
Base URL of the website to scrape | Yes | https://1819news.com/ |
--parser |
Parser to use (Parser1819 , ParserDailyNews , ParserAppealsAL ) |
Yes | Parser1819 |
--suffix |
URL suffix to filter articles | No | /news/item |
--max_pages |
Maximum number of pages to scrape | No | 5 |
Court Extractor Parameters¶
Parameter | Description | Default | Example |
---|---|---|---|
--court |
Court type (civil , criminal , supreme ) |
civil |
civil |
--date-period |
Time period (7d , 1m , 3m , 6m , 1y , custom ) |
1y |
7d |
--exclude-closed |
Exclude closed cases | False | --exclude-closed |
--case-number |
Search specific case number | None | 2024-CA-001 |
--case-title |
Search by case title | None | Smith v. Jones |
--start-date |
Custom range start date (YYYY-MM-DD) | None | 2024-01-01 |
--end-date |
Custom range end date (YYYY-MM-DD) | None | 2024-12-31 |
--max-pages |
Maximum pages to process | All | 10 |
--output-prefix |
Prefix for output files | court_cases |
civil_appeals |
CSV Output
The court extractor automatically generates both JSON and CSV output files for every search. There's no need to specify a separate flag - both formats are always created.
Getting Help¶
Command-Line Help¶
# Main OPAL help
python -m opal --help
# Court extractor help
python -m opal.configurable_court_extractor --help
Interactive Resources¶
- ๐ ๏ธ Interactive Command Builder - Build commands visually with examples
- ๐ Common Use Cases - Real-world scenarios and workflows
- ๐พ Output Examples - See what data you'll get
- ๐ Quick Start Tutorial - Step-by-step first scrape
Tips and Best Practices¶
- Start Small: Use
--max_pages 1
when testing to verify your command works - Use Suffixes: For news sites, use
--suffix
to filter only article pages - Check Output: Review the JSON output format in Output Examples
- Rate Limiting: The court scraper includes automatic delays to respect server limits
- Virtual Environment: Always run OPAL in a virtual environment to avoid conflicts
Troubleshooting¶
If you encounter errors: 1. Check your URL is correct and accessible 2. Verify you're using the right parser for your target site 3. Ensure Chrome is installed (for court scraping) 4. See Understanding Errors for detailed error explanations