Skip to content

feat: add channel scraper, geocoding enhancement, and SonarCloud CI - #84

Merged
kelleyglenn merged 9 commits into
masterfrom
feature/channel-scraper-geocoding-enhancement
Feb 23, 2026
Merged

feat: add channel scraper, geocoding enhancement, and SonarCloud CI#84
kelleyglenn merged 9 commits into
masterfrom
feature/channel-scraper-geocoding-enhancement

Conversation

@kelleyglenn

@kelleyglenn kelleyglenn commented Feb 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add scripts/list-channel/ Python CLI to list video URLs from a YouTube channel using yt-dlp, with date/duration filtering and Shorts exclusion. Output is compatible with extract.py --file.
  • Enhance geocoding accuracy by adding streetAddress field to the AI extraction prompt and preferring it over landmark names in seed-videos.sh
  • Fix geocode response parsing in seed-videos.sh to use .coordinates.latitude/.coordinates.longitude
  • Add SonarCloud static analysis CI workflow for Python and shell scripts

Test plan

  • Run list_channel.py against a known channel and verify URL output
  • Run extract.py on a video and verify streetAddress field is populated when applicable
  • Run seed-videos.sh and verify geocoding uses streetAddress when available
  • Verify SonarCloud workflow triggers on this PR and picks up Python/shell files

🤖 Generated with Claude Code

kelleyglenn and others added 9 commits February 22, 2026 00:28
- Add scripts/list-channel/ — YouTube channel video URL lister using
  yt-dlp with date/duration filtering (excludes Shorts). Output is
  compatible with extract.py --file.

- Add streetAddress field to LLM extraction prompt, JSON schema, and
  output in extract.py. Claude provides street addresses for well-known
  government buildings, improving downstream geocoding accuracy.

- Fix geocode response parsing bug in seed-videos.sh — was reading
  .latitude/.longitude but the API returns .coordinates.latitude/
  .coordinates.longitude, causing geocoding to silently fail.

- Prefer streetAddress over location name for geocoding queries in
  seed-videos.sh when available.

- Update docs/llm-extraction-prompt.md and extract-metadata README
  with streetAddress documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract _build_ydl_opts() and _parse_entry() helpers to bring
cognitive complexity from 22 to within Sonar's 15 threshold.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lity

- Add yt-dlp sleep options (sleep_requests, sleep_interval, sleep_subtitles)
  to avoid triggering YouTube rate limits on subtitle fetches
- Add retry with backoff for subtitle URL fetch on HTTP 429
- Fix batch API custom_id to use video ID instead of full URL (must match
  ^[a-zA-Z0-9_-]{1,64})
- Switch list_channel to extract_flat mode for faster channel listing
- Move date filtering from yt-dlp DateRange to Python (fixes YYYY-MM-DD
  format error and avoids per-video page fetches)
- Add seed-data/*.txt to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Separates the monolithic extraction script into two independent pipeline
stages: YouTube metadata fetching (yt-dlp) and Claude LLM extraction.
This allows re-running extraction without re-fetching from YouTube.

Both scripts support --append for resumable batch processing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace python3 URL encoding with jq (@uri filter) — python3 is a
  non-functional WindowsApps stub on Windows, causing curl to receive
  unencoded URLs and exit with code 3 under set -euo pipefail
- Require street address for geocoding fallback — generic name/city/state
  queries produce unreliable results
- Skip video creation when no location available (locationId is required)
- Handle location 409 by extracting existingLocationId from response
- Always include locationId in video creation request body

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract helper functions across all three Python scripts to reduce
SonarCloud cognitive complexity scores. Add incremental file writing
to fetch_youtube.py so progress survives interruptions, and add
--delay flag to throttle requests and avoid YouTube rate limiting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add --cookies-from-browser option to fetch_youtube.py for authenticated
YouTube sessions (~6x higher rate limits). Extract helper functions from
main() in both fetch_youtube.py and claude_extract.py to bring cognitive
complexity under SonarCloud's threshold of 15.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kelleyglenn
kelleyglenn merged commit aad4f15 into master Feb 23, 2026
1 check passed
@kelleyglenn
kelleyglenn deleted the feature/channel-scraper-geocoding-enhancement branch February 23, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant