Replace broken DDG search with AI thumbnail generation fallback

DuckDuckGo's HTML search endpoint now requires vqd session tokens,
making server-side search-based URL resolution unreliable. Simplified
the thumbnail pipeline:

- OG scrape only for non-aggregator URLs (direct publisher pages)
- AI image generation via OpenRouter for aggregator articles (Google News)
- Added Image Model settings field in admin UI
- Added thumbnail_local column for AI-generated images
- Updated public/admin display to check thumbnail_local as fallback
- Removed all DuckDuckGo search code (find_article_url_via_search,
  extract_ddg_url, resolve_article_for_scraping)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Terence Ong
2026-04-06 20:29:32 +07:00
parent de35f2d684
commit cd8eee11b8
7 changed files with 118 additions and 228 deletions

View File

@@ -390,12 +390,12 @@ class Peptide_News_LLM {
global $wpdb;
$table = $wpdb->prefix . 'peptide_news_articles';
// Find active articles with no thumbnail (neither URL nor local).
// Find active articles with no usable thumbnail (including _no_image sentinel).
$articles = $wpdb->get_results( $wpdb->prepare(
"SELECT id, title, excerpt, ai_summary, tags, categories
FROM {$table}
WHERE is_active = 1
AND ( thumbnail_url = '' OR thumbnail_url IS NULL )
AND ( thumbnail_url = '' OR thumbnail_url IS NULL OR thumbnail_url = '_no_image' )
AND ( thumbnail_local = '' OR thumbnail_local IS NULL )
ORDER BY fetched_at DESC
LIMIT %d",