Add diagnostic debug output to thumbnail backfill for troubleshooting

Temporary debug version that returns query counts, URL resolution results,
and OG scraping outcomes to identify why thumbnail scraping returns 0.
Also adds Google News URL decoder (base64/protobuf approach).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Terence Ong
2026-04-06 19:39:26 +07:00
parent 5918a7d446
commit 2c09ee4664
2 changed files with 176 additions and 46 deletions

View File

@@ -608,7 +608,13 @@ class Peptide_News_Admin {
}, function(response) {
$btn.prop('disabled', false).text('<?php echo esc_js( __( 'Fix Article Thumbnails', 'peptide-news' ) ); ?>');
if (response.success) {
$result.text(response.data.updated + ' thumbnail(s) scraped.');
var d = response.data;
var msg = d.updated + ' thumbnail(s) scraped. Query matched: ' + d.query_count;
if (d.total_active !== undefined) {
msg += ' | Total: ' + d.total_active + ', Has URL: ' + d.with_thumb_url + ', Has local: ' + d.with_thumb_local;
}
$result.text(msg);
if (d.samples && d.samples.length) { console.log('Thumbnail debug:', JSON.stringify(d, null, 2)); }
} else {
$result.text('Error: ' + (response.data || 'Unknown error'));
}