Пример #1
0
 }
 echo $outPrefix . sizeof($videoLeads) . " videos merged from " . sizeof(QUERY_SORTING_SEQUENCE) . " searches\n";
 echo $outPrefix . 'fetching and indexing [';
 // process each video: get caption, get details, send to index
 /* @var $videoLeads YTVideo[] */
 $newVideos = [];
 $n = 1;
 shuffle($videoLeads);
 foreach ($videoLeads as $video) {
     // OPTIMIZATION: skip resolving if we already did it in the past and
     // the video has already been indexed (or we know it can't be).
     if (!FORCE_REINDEX && CacheMachine::setContains(VIDEOS_PROCESSED_SET, $video->videoId)) {
         echo ' ';
         continue;
     }
     CacheMachine::addToSet(VIDEOS_PROCESSED_SET, $video->videoId);
     // resolve the captions, and skip if failed
     if (!$video->resolveCaptions()) {
         echo 'C(' . ltrim($video->getLastCaptionIssue(), ' ') . ')';
         continue;
     }
     // also resolve details: numbers of views, etc.
     $video->resolveDetails();
     if ($video->countViews < MIN_VIDEO_VIEWS) {
         echo 'D(v-' . $video->countViews . ')';
         continue;
     }
     // send it to the Index (to be indexed)
     if (!$indexMachine->addOrUpdate($video->videoId, $video)) {
         echo 'I';
         continue;