Skip to main content

Build Anki flashcard decks for bird identification from allaboutbirds.org

Project description

AviAnki

PyPI Python License Stars Ruff

Learn to identify the birds in your area. Drop in your location and AviAnki builds a custom Anki deck — sorted by the species most likely to appear near you — pulling photos, calls, songs, and descriptions from allaboutbirds.org.

Each species gets two card types:

  • Photo → Name — given two photos and audio, identify the bird
  • Description → Name — given audio and a written description, identify the bird

Card examples

Photo → Name — identify the bird from photos and audio:

Photo → Name front

Description → Name — identify the bird from audio and a redacted description:

Description → Name front

Answer — reveals the name, scientific name, photos, audio, and full description:

Answer

Prerequisites

  • uv — for running and installing
  • ffmpeg — for trimming audio clips

Install ffmpeg:

# Windows
winget install ffmpeg

# macOS
brew install ffmpeg

Quick start

  1. Go to allaboutbirds.org/guide/browse
  2. Under Birds Near Me, enter your city, ZIP code, or state/province — set the time of year to Year-round for a complete deck
  3. Click Browse, copy the URL from your browser's address bar, and run:
uvx avianki "https://www.allaboutbirds.org/guide/browse/filter/loc/ChIJGzE9DS1l44kRoOhiASS_fHg/..."

That's it. An .apkg file is written to the current directory — import it into Anki via File → Import.

Use --limit N to cap the number of species for a smaller file size:

uvx avianki "https://www.allaboutbirds.org/guide/browse/..." --limit 30

Usage

From PyPI (recommended):

uvx avianki LOCATION [OPTIONS]

From a local clone:

git clone https://github.com/Ian-Costa18/avianki.git
cd avianki
uv run avianki LOCATION [OPTIONS]

Location formats

allaboutbirds.org browse URL (recommended — species sorted by local frequency, no API key needed):

uvx avianki "https://www.allaboutbirds.org/guide/browse/filter/loc/ChIJGzE9DS1l44kRoOhiASS_fHg/date/all/behavior/all/size/all/colors/all/sort/score/view/list-view"

Google Place ID (shorthand for the above):

uvx avianki ChIJGzE9DS1l44kRoOhiASS_fHg

Find a Place ID at developers.google.com/maps/documentation/javascript/examples/places-placeid-finder.

eBird region code (species in taxonomic order, requires an API key):

uvx avianki US-MA
uvx avianki US-MA-017   # county level

Get a free eBird API key at ebird.org/api/keygen, then set it in a .env file:

EBIRD_API_KEY=your_key_here

Options

Flag Short Description
--limit N -n Cap the number of species included in the deck
--output FILE -o Output .apkg path (default: auto-generated from location)
--deck-name NAME -d Override the deck name shown in Anki
--no-audio -A Skip downloading call and song audio
--no-images -I Skip downloading photos
--delay SECONDS -D Wait between requests in seconds (default: 0.5)
--work-dir DIR -w Directory for cached media, logs, and JSON (default: <tmp>/avianki/)
--media-dir DIR -m Override media subdirectory (default: <work-dir>/media/)
--json-file FILE -j Path for birds.json output (default: <work-dir>/birds.json)
--ephemeral -e Run without persisting anything — see Ephemeral mode
--no-cache -X Skip cache lookup; delete downloaded media after packaging
--log-file FILE -l Log file path (default: <work-dir>/avianki.log)
--verbose -v Show debug-level output in the console
--quiet -q Only show warnings and errors in the console

Examples

# Your local birds, capped to 50 species
uvx avianki "https://www.allaboutbirds.org/guide/browse/..." --limit 50

# Custom output path and deck name
uvx avianki "https://www.allaboutbirds.org/guide/browse/..." --output ~/Desktop/MyBirds.apkg --deck-name "My Birds"

# Images only, no audio
uvx avianki "https://www.allaboutbirds.org/guide/browse/..." --no-audio

# Be polite to the server
uvx avianki "https://www.allaboutbirds.org/guide/browse/..." --delay 1.5

Output

An .apkg file is written to the current directory (e.g. Birds_ChIJGzE9DS1l44kRoOhiASS_fHg.apkg or Birds_US-MA.apkg). Import it into Anki via File → Import.

Downloaded images and audio are cached in the system temp directory (<tmp>/avianki/media/ by default, or the directory set by --media-dir) so re-runs skip already-fetched files. Re-running the same location only fetches new or missing media. The log is written to <tmp>/avianki/avianki.log.

A birds.json file is also written to <work-dir>/birds.json (override with --json-file) containing the scraped data for every species. Each entry has the common name, scientific name, description, and paths to the cached image and audio files relative to <work-dir>. Audio fields are null when no clip was found. See examples/example-birds.json for a sample.

[
  {
    "name": "American Robin",
    "sci_name": "Turdus migratorius",
    "description": "The quintessential early bird...",
    "images": ["media/bird_American_Robin_img1.jpg", "media/bird_American_Robin_img2.jpg"],
    "call": "media/bird_American_Robin_call.mp3",
    "song": "media/bird_American_Robin_song.mp3"
  }
]

Ephemeral mode

--ephemeral is for one-shot runs where you want no persistent files. Instead of writing to <work-dir> directly, all temporary files (media, log, birds.json) go into <work-dir>/.ephemeral/. That subdirectory is deleted after the .apkg is packaged, leaving the base work directory untouched. The cache is never read or written in this mode.

Notes

  • Audio clips are trimmed to 10 seconds via ffmpeg to keep file sizes small.
  • allaboutbirds.org browse URLs sort species by likelihood score for your location, which gives much better study order than eBird's taxonomic ordering.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

avianki-0.7.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

avianki-0.7.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file avianki-0.7.0.tar.gz.

File metadata

  • Download URL: avianki-0.7.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for avianki-0.7.0.tar.gz
Algorithm Hash digest
SHA256 fa74e77f132caeba7d768840ae41e404ccb6597302b24b2dc703d3b167452940
MD5 795a2b2b98f42bdebccdc7caa5f42b4e
BLAKE2b-256 a7821a48407a4b7cec11c5d81955a80d521e84112940536417c1e531cb1f60a7

See more details on using hashes here.

File details

Details for the file avianki-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: avianki-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for avianki-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f394b824b0f3576bac6a56127eb50a8572a56da99bbbfca50276e2d2b008ce6
MD5 edef121e2186160ddd0b10d63b927d37
BLAKE2b-256 549961bb3e81512ce735b3e7ae4e07da997953960a78f93810868ffbe1df52e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page