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":1869,"count":1,"description":"","link":"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/","name":"Philips Arena","slug":"philips-arena","taxonomy":"post_tag","meta":[],"yoast_head":"\nPhilips Arena Archives - PunchDrunkGamer<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Philips Arena Archives - PunchDrunkGamer\" \/>\n<meta property=\"og:url\" content=\"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/\" \/>\n<meta property=\"og:site_name\" content=\"PunchDrunkGamer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"CollectionPage\",\"@id\":\"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/\",\"url\":\"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/\",\"name\":\"Philips Arena Archives - PunchDrunkGamer\",\"isPartOf\":{\"@id\":\"https:\/\/punchdrunkgamer.com\/#website\"},\"breadcrumb\":{\"@id\":\"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/#breadcrumb\"},\"inLanguage\":\"en-US\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/punchdrunkgamer.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Philips Arena\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/punchdrunkgamer.com\/#website\",\"url\":\"https:\/\/punchdrunkgamer.com\/\",\"name\":\"PunchDrunkGamer\",\"description\":\"PunchDrunkGamer delivers the action-packed coverage you crave.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/punchdrunkgamer.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},false]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Philips Arena Archives - PunchDrunkGamer","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/","og_locale":"en_US","og_type":"article","og_title":"Philips Arena Archives - PunchDrunkGamer","og_url":"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/","og_site_name":"PunchDrunkGamer","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"CollectionPage","@id":"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/","url":"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/","name":"Philips Arena Archives - PunchDrunkGamer","isPartOf":{"@id":"https:\/\/punchdrunkgamer.com\/#website"},"breadcrumb":{"@id":"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/#breadcrumb"},"inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https:\/\/punchdrunkgamer.com\/tag\/philips-arena\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/punchdrunkgamer.com\/"},{"@type":"ListItem","position":2,"name":"Philips Arena"}]},{"@type":"WebSite","@id":"https:\/\/punchdrunkgamer.com\/#website","url":"https:\/\/punchdrunkgamer.com\/","name":"PunchDrunkGamer","description":"PunchDrunkGamer delivers the action-packed coverage you crave.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/punchdrunkgamer.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},false]}},"_links":{"self":[{"href":"https:\/\/punchdrunkgamer.com\/wp-json\/wp\/v2\/tags\/1869","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/punchdrunkgamer.com\/wp-json\/wp\/v2\/tags"}],"about":[{"href":"https:\/\/punchdrunkgamer.com\/wp-json\/wp\/v2\/taxonomies\/post_tag"}],"wp:post_type":[{"href":"https:\/\/punchdrunkgamer.com\/wp-json\/wp\/v2\/posts?tags=1869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}