Skip to content

Alyetama/Coyote-Attacks-News

Repository files navigation

Coyote-Attacks-News

🚀 This program is designed to scrape news articles related to coyote attacks within a specified time period using the Newscatcher API. The program saves the extracted data into a SQLite database.

Note: The script requires an API key for Newscatcher.

Supported Python versions PEP8

Requirements

⬇️ Installation

git clone https://github.com/Biodiversity-CatTracker2/Coyote-Attacks-News.git
cd Coyote-Attacks-News
pip install -r requirements.txt

⌨️ Usage

usage: main.py [-h] -d DB_NAME -s START_DATE -e END_DATE [--no-sleep]

options:
  -h, --help            show this help message and exit
  -d DB_NAME, --db-name DB_NAME
                        Name of the database file
  -s START_DATE, --start-date START_DATE
                        Search from this date
  -e END_DATE, --end-date END_DATE
                        Search until this date
  --no-sleep            No sleep

Add your Newscatcher token to .env

mv .env.example .env
nano .env

Parse Articles

python main.py -d <DB_NAME> -s <START_DATE> -e <END_DATE>

Run Datasette Instance

  • First, rename and edit run.sh.example content.
mv run.sh.example run.sh
nano run.sh
  • Then, run with:
bash run.sh

📕 Examples

python main.py -d db.sqlite3 -s '2023-04-02' -e '2023-04-17'