Commit graph

11 commits

Author SHA1 Message Date
0589138396 Add detailed crawl diagnostic logging to upstream spider
Ported from Discord bot's async web fetcher improvements.

Add comprehensive logging to understand crawl behavior:
- Log crawl parameters at start (max_depth, URLs, keywords)
- Debug log for crawl queue state during processing
- Detailed link extraction stats with skip reasons:
  - Total links found
  - Links added to crawl queue
  - Links skipped by robots.txt
  - Links skipped (wrong domain)
  - Links skipped (max depth reached)

Applied to both:
- Fresh page fetching and link extraction
- Cached page link extraction for depth traversal

This diagnostic logging helps identify why crawlers find fewer
pages than expected (e.g., robots.txt blocking, domain filtering,
depth limits).

No crawl logic changes - purely diagnostic visibility.
2025-11-27 12:46:34 -05:00
1cc53e5d54 fix: Extract links from cached pages to enable depth traversal
Critical bugfix for depth-based crawling when pages are cached.

Problem:
- When a page was already cached and force_crawl=False, process_url()
  would return early without extracting links
- This broke depth traversal: if depth 0 page was cached, no depth 1
  pages would be discovered
- Example: With depth=1 and cached starting URI, crawler stopped at
  depth 0 and never crawled linked pages

Solution:
- Modified process_url() to still extract links from cached pages when
  depth < max_depth
- Cached page path now fetches HTML only for link extraction, skips
  expensive content extraction and scoring
- Links are checked against robots.txt and crawl rules as normal
- Only returns early (without link extraction) when at max depth

Impact:
- Fixes depth=1 crawling scenario where starting page is cached
- Improves crawl efficiency by not re-processing cached content
- Maintains proper depth traversal behavior across cache boundaries

See CHANGELOG.md for details.
2025-11-27 11:50:05 -05:00
f438c09171 feat: Add query-aware page scoring system for intelligent crawling
Implement multi-factor page scoring to prioritize high-quality, relevant content during crawls.

Key changes:
- Add score field to Article model for storing quality/relevance scores (0-100+)
- Implement _score_page() method with 5 scoring factors:
  * Content length (0-30 points)
  * Title quality (0-15 points)
  * URL quality (0-15 points)
  * Content density (0-15 points)
  * Query relevance (0-40 points)
- Thread query_keywords parameter through entire crawl chain
- Extract keywords early using Hermes AI for real-time scoring
- Update cache_article() to store scores in database
- Update process_url() to calculate and log page scores
- Update both DuckDuckGoCrawler and DirectTargetCrawler to extract keywords

Benefits:
- Pages are scored during crawling based on query relevance
- Enables future selective crawling based on score thresholds
- Provides visibility into crawl quality through detailed logs
- Minimal performance overhead (~10ms per page)

Future enhancements deferred:
- Async/await conversion with aiohttp
- Progressive depth escalation based on results

See CHANGELOG.md for detailed documentation.
2025-11-27 11:35:04 -05:00
11de952ee1 modified: duck_duck_go_hermes_unturf.py 2025-04-28 07:00:19 -04:00
f384022534 modified: duck_duck_go_hermes_unturf.py 2025-04-26 12:09:06 -04:00
5b823155a6 modified: duck_duck_go_hermes_unturf.py 2025-04-26 10:26:52 -04:00
b3f12dffbb modified: duck_duck_go_hermes_unturf.py 2025-04-26 09:15:45 -04:00
95c94db6f3 Add chromadb so we can do RAG
modified:   .gitignore
	modified:   duck_duck_go_hermes_unturf.py
2025-04-26 00:22:43 -04:00
dff8089f7c modified: duck_duck_go_hermes_unturf.py 2025-04-25 23:22:22 -04:00
a429bcc794 modified: duck_duck_go_hermes_unturf.py 2025-04-25 23:01:23 -04:00
923c4a4f9e version 0.0.1
new file:   .gitignore
	new file:   duck_duck_go_hermes_unturf.py
2025-04-19 13:20:58 -04:00