Browse Source

[FIX] Improvement of duplicate content detection and handling

pull/36/head
Boris 3 months ago
parent
commit
23a6aad73c
  1. 12
      www/boris/functions.php
  2. 7
      www/boris/youtube.php

12
www/boris/functions.php

@ -228,3 +228,15 @@ function canReadVideoFormat ($mimeType) {
return ($mimeType == 'video/mp4');
}
function in_array_column($text, $column, $array)
{
if (!empty($array) && is_array($array))
{
for ($i=0; $i < count($array); $i++)
{
if ($array[$i][$column]==$text || strcmp($array[$i][$column],$text)==0) return true;
}
}
return false;
}

7
www/boris/youtube.php

@ -15,7 +15,7 @@ $videosList = array();
$search = isset($_GET['search']) ? urldecode($_GET['search']) : "";
exec("/bin/bash -c './get_astrxbian_index.sh \"*\" \"". $search . "\"'", $videos);
exec("/bin/bash -c './get_PIN.sh'", $pinnedVideos);
$videos = array_unique($videos);
// $videos = array_unique($videos);
// exec("/bin/bash -c './get_youtube_videos.sh'", $videos);
// echo file_get_contents("http://youtube2.com/ipns/12D3KooWHLLohhFqwTs3Ccego51w1Q2WUQ8JmhSMWtsZnQpMigHY/.12D3KooWHLLohhFqwTs3Ccego51w1Q2WUQ8JmhSMWtsZnQpMigHY/FASTRXBIAN");
@ -49,6 +49,11 @@ foreach ($videos as $v) {
list($contentType, $videoID, $year, $filename, $saison, $tagsStr, $ipnsHash, $definition, $videoURI) = explode(";", $v);
if (in_array_column($videoURI, 'uri', $videosList)) {
continue;
}
list($videoSource, $videoID) = handleVideoID($videoID);
$ipfsHash = preg_replace('!^/ipfs/([^/]+)/.*$!isU', '$1', $videoURI);

Loading…
Cancel
Save