2d52255b93
Added external_view_count so provider totals from YouTube/Vimeo/etc are added to the site’s total without double-counting local plays. Updated public totals and per-video public view displays to use site views + external views. Changed Upkeeping action to Correct external view counts with a Correct Views button. Expanded provider scraping beyond YouTube with generic page/JSON-LD/oEmbed patterns for readable Vimeo, Dailymotion, and similar pages. Improved Add Video:Title no longer has to be manually entered first. External URL rows now have Fetch Info. Metadata can fill title, description, duration, source label, and external view count. Save also retries metadata extraction server-side. Added authenticated metadata endpoint: [admin/media_info.php](/Users/tyemeclifford/Documents/GH/mediaplayer/admin/media_info.php). Updated docs in [README.md](/Users/tyemeclifford/Documents/GH/mediaplayer/README.md).
25 lines
697 B
PHP
25 lines
697 B
PHP
<?php
|
|
require_once __DIR__ . '/auth.php';
|
|
admin_require_auth();
|
|
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
$url = normalize_media_url($_GET['url'] ?? '');
|
|
if ($url === '') {
|
|
echo json_encode(['ok' => false, 'error' => 'Enter a valid http:// or https:// URL.']);
|
|
exit;
|
|
}
|
|
|
|
$metadata = media_external_metadata($url);
|
|
$has_info = $metadata['title'] !== ''
|
|
|| $metadata['description'] !== ''
|
|
|| $metadata['thumbnail_url'] !== ''
|
|
|| (int)$metadata['duration'] > 0
|
|
|| (int)$metadata['view_count'] > 0;
|
|
|
|
echo json_encode([
|
|
'ok' => $has_info,
|
|
'error' => $has_info ? '' : 'No readable media metadata was found for that URL.',
|
|
'metadata' => $metadata,
|
|
]);
|