1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-04 02:09:22 +02:00

Fix og tags

This commit is contained in:
DanielnetoDotCom 2021-01-07 13:49:25 -03:00
parent 8b9a27bb64
commit fbb4a9c0e4
4 changed files with 46 additions and 45 deletions

View file

@ -60,19 +60,18 @@ $description = _substr(html2plainText($video['description']), 0,155);
<meta property="og:type" content="video.other" />
<?php
$sourceMP4 = Video::getSourceFile($video['filename'], ".mp4");
if(preg_match("/.m3u8/i", $sourceMP4['url'])){
if(CustomizeUser::canDownloadVideos()){
$sourceMP4['url'] = addQueryStringParameter($sourceMP4['url'], "download", 1);
$sourceMP4['url'] = addQueryStringParameter($sourceMP4['url'], "mp4", 1);
}else{
$sourceMP4['url'] = '';
$source = Video::getSourceFile($video['filename'], ".mp4");
if(empty($source['url']) && CustomizeUser::canDownloadVideos()){
$source = Video::getSourceFile($video['filename'], ".m3u8");
if(!empty($source['url'])){
$source['url'] = addQueryStringParameter($source['url'], "download", 1);
$source['url'] = addQueryStringParameter($source['url'], "mp4", 1);
}
}
if (!AVideoPlugin::isEnabledByName("SecureVideosDirectory") && !empty($sourceMP4['url'])) {
if (!AVideoPlugin::isEnabledByName("SecureVideosDirectory") && !empty($source['url'])) {
?>
<meta property="og:video" content="<?php echo $sourceMP4['url']; ?>" />
<meta property="og:video:secure_url" content="<?php echo $sourceMP4['url']; ?>" />
<meta property="og:video" content="<?php echo $source['url']; ?>" />
<meta property="og:video:secure_url" content="<?php echo $source['url']; ?>" />
<meta property="og:video:type" content="video/mp4" />
<meta property="og:video:width" content="<?php echo $imgw; ?>" />
<meta property="og:video:height" content="<?php echo $imgh; ?>" />
@ -90,13 +89,13 @@ if (!AVideoPlugin::isEnabledByName("SecureVideosDirectory") && !empty($sourceMP4
<!-- Twitter cards -->
<?php
if (!empty($advancedCustom->twitter_player)) {
if (!AVideoPlugin::isEnabledByName("SecureVideosDirectory") && !empty($sourceMP4['url'])) {
if (!AVideoPlugin::isEnabledByName("SecureVideosDirectory") && !empty($source['url'])) {
?>
<meta name="twitter:card" content="player" />
<meta name="twitter:player" content=<?php echo Video::getLinkToVideo($videos_id, $video['clean_title'], true); ?>" />
<meta name="twitter:player:width" content="<?php echo $imgw; ?>" />
<meta name="twitter:player:height" content="<?php echo $imgh; ?>" />
<meta name="twitter:player:stream" content="<?php echo $sourceMP4['url']; ?>" />
<meta name="twitter:player:stream" content="<?php echo $source['url']; ?>" />
<meta name="twitter:player:stream:content_type" content="video/mp4" />
<?php
} else {