private function beeteam368_youtube_automatic_import($auto_id) { if (!isset($auto_id) || !is_numeric($auto_id)) { return; } $renew_posts = get_post_meta($auto_id, $this->prefix . 'renew_posts', true); // yes, no if ($renew_posts == 'yes') { return; } $youtube_source = trim(get_post_meta($auto_id, $this->prefix . 'youtube_source', true)); $processing = get_post_meta($auto_id, $this->prefix . 'processing', true); // yes, no $timestamp_update = get_post_meta($auto_id, $this->prefix . 'timestamp_update', true); $publishedAfter = trim(get_post_meta($auto_id, $this->prefix . 'published_after', true)); $publishedBefore = trim(get_post_meta($auto_id, $this->prefix . 'published_before', true)); $playlist_upload = $this->auto_detech_playlist_id($this->auto_detech($youtube_source), $publishedAfter, $publishedBefore, $auto_id); if ($playlist_upload != '') { $fetch_videos = $this->beeteam368_youtube_get_upload_videos($playlist_upload, '', array(), $auto_id); if (!is_array($fetch_videos) || count($fetch_videos) == 0) { $this->update_processing($auto_id, 'no'); return; } $videos = wp_list_pluck($fetch_videos, 'videoID'); if (is_array($videos) && count($videos) > 0) { $old_import = get_post_meta($auto_id, $this->prefix . 'old_import', true); if (!is_array($old_import) || count($old_import) == 0) { $old_import = array(); } $new_import_videos = array_diff($videos, $old_import); // LIMIT IMPORTS TO 20 VIDEOS PER RUN $new_import_videos = array_slice($new_import_videos, 0, 20); if (!is_array($new_import_videos) || count($new_import_videos) == 0) { $this->update_processing($auto_id, 'no'); return; } foreach ($new_import_videos as $video) { $postData = array( 'post_title' => esc_html__('[ID: ' . $video . '] Youtube Automatic', 'vidorev-extensions'), 'post_status' => 'private', ); $newPostID = wp_insert_post($postData); if (!is_wp_error($newPostID) && $newPostID) { $post_import = get_post_meta($auto_id, $this->prefix . 'post_import', true); if (!is_array($post_import)) { $post_import = array(); } array_push($post_import, $newPostID); update_post_meta($auto_id, $this->prefix . 'post_import', $post_import); $this->update_data($auto_id, $video, $newPostID, array()); } } $this->update_processing($auto_id, 'no'); } else { $this->update_processing($auto_id, 'no'); } } else { $this->update_processing($auto_id, 'no'); } } {"id":1192,"count":1,"description":"","link":"https:\/\/punchdrunkgamer.com\/tag\/becka-noel\/","name":"Becka Noel","slug":"becka-noel","taxonomy":"post_tag","meta":[],"yoast_head":"\n