function imdb_fetcher_fetch_data(){
check_ajax_referer('imdb_fetcher_save_meta_box_data','nonce');
$imdb_id = sanitize_text_field($_POST['imdb_id']);
$post_id = intval($_POST['post_id']);
$post_type = sanitize_text_field($_POST['post_type']);
if(empty($imdb_id)){wp_send_json_error(['message'=>'آیدی IMDb معتبر نیست.']);}
if(!$post_id){
$post_id = wp_insert_post(['post_title'=>'Draft','post_type'=>$post_type,'post_status'=>'draft'],true);
}
// ---------- دریافت اطلاعات از TMDb (بدون IMDb) ----------
$tmdb_api_key = '12e807d785262c02292bd8ed8516d24f';
$proxy_base = 'http://tmdb2.tala-film.top/55/tmdb-api-proxy.php?url=';
// ۱. پیدا کردن TMDb ID از طریق IMDB
$find_url = "https://api.themoviedb.org/3/find/{$imdb_id}?api_key={$tmdb_api_key}&language=en-US&external_source=imdb_id";
$find_response = wp_remote_get($proxy_base . urlencode($find_url), ['timeout'=>15]);
if(is_wp_error($find_response) || wp_remote_retrieve_response_code($find_response) !== 200){
wp_send_json_error(['message'=>'خطا در ارتباط با TMDb برای یافتن اثر.']);
}
$find_data = json_decode(wp_remote_retrieve_body($find_response), true);
if(empty($find_data['movie_results']) && empty($find_data['tv_results'])){
wp_send_json_error(['message'=>'آیدی IMDb در TMDb پیدا نشد.']);
}
// تشخیص نوع (فیلم یا سریال)
$media_type = 'movie';
$tmdb_id = 0;
if(!empty($find_data['movie_results'][0])){
$media_type = 'movie';
$tmdb_id = $find_data['movie_results'][0]['id'];
} elseif(!empty($find_data['tv_results'][0])){
$media_type = 'tv';
$tmdb_id = $find_data['tv_results'][0]['id'];
} else {
wp_send_json_error(['message'=>'نوع اثر (فیلم/سریال) قابل تشخیص نیست.']);
}
// ۲. دریافت جزییات کامل از TMDb
$detail_url = "https://api.themoviedb.org/3/{$media_type}/{$tmdb_id}?api_key={$tmdb_api_key}&language=en-US&append_to_response=credits,release_dates,translations,external_ids,keywords,content_ratings,videos,images";
$detail_response = wp_remote_get($proxy_base . urlencode($detail_url), ['timeout'=>20]);
if(is_wp_error($detail_response) || wp_remote_retrieve_response_code($detail_response) !== 200){
wp_send_json_error(['message'=>'خطا در دریافت جزییات از TMDb.']);
}
$detail = json_decode(wp_remote_retrieve_body($detail_response), true);
if(empty($detail)){
wp_send_json_error(['message'=>'دادهای از TMDb دریافت نشد.']);
}
// ---------- استخراج فیلدهای مورد نیاز از $detail ----------
$title = $detail['title'] ?? $detail['name'] ?? '';
// سال انتشار
$year = '';
if($media_type === 'movie' && !empty($detail['release_date'])){
$year = substr($detail['release_date'], 0, 4);
} elseif($media_type === 'tv' && !empty($detail['first_air_date'])){
$year = substr($detail['first_air_date'], 0, 4);
}
// مدت زمان (دقیقه)
$runtime_str = '';
if($media_type === 'movie' && !empty($detail['runtime'])){
$runtime_str = $detail['runtime'] . ' min';
} elseif($media_type === 'tv' && !empty($detail['episode_run_time'])){
$avg = is_array($detail['episode_run_time']) ? array_sum($detail['episode_run_time'])/count($detail['episode_run_time']) : $detail['episode_run_time'];
$runtime_str = intval($avg) . ' min';
}
// ژانرها
$genres = [];
if(!empty($detail['genres'])){
$genres = array_column($detail['genres'], 'name');
}
$genres_str = implode(', ', $genres);
// کشورها (از production_countries)
$countries = [];
if(!empty($detail['production_countries'])){
$countries = array_column($detail['production_countries'], 'name');
}
// اگر خالی بود، از origin_country (برای سریال) استفاده کن
if(empty($countries) && !empty($detail['origin_country'])){
$countries = $detail['origin_country'];
}
$countries_str = implode(', ', array_filter($countries));
// زبانها (از spoken_languages)
$languages = [];
if(!empty($detail['spoken_languages'])){
$languages = array_column($detail['spoken_languages'], 'name');
}
$languages_str = implode(', ', array_filter($languages));
// کارگردان (از credits.crew)
$directors = [];
if(!empty($detail['credits']['crew'])){
foreach($detail['credits']['crew'] as $crew){
if($crew['job'] === 'Director'){
$directors[] = $crew['name'];
}
}
}
$directors_str = implode(', ', array_unique($directors));
// بازیگران (حداکثر ۵ نفر)
$actors = [];
if(!empty($detail['credits']['cast'])){
$cast = array_slice($detail['credits']['cast'], 0, 5);
$actors = array_column($cast, 'name');
}
$actors_str = implode(', ', array_filter($actors));
// ردهی سنی (US MPAA از release_dates)
$rated = '';
if(!empty($detail['release_dates']['results'])){
foreach($detail['release_dates']['results'] as $rd){
if($rd['iso_3166_1'] === 'US' && !empty($rd['release_dates'][0]['certification'])){
$rated = $rd['release_dates'][0]['certification'];
break;
}
}
}
if(empty($rated) && !empty($detail['content_ratings']['results'])){
foreach($detail['content_ratings']['results'] as $cr){
if($cr['iso_3166_1'] === 'US'){
$rated = $cr['rating'];
break;
}
}
}
// جوایز – TMDb این را مستقیماً ندارد، میتوان از overview یا tagline استفاده کرد
$awards_text = '';
if(!empty($detail['tagline'])){
$awards_text = $detail['tagline'];
} elseif(!empty($detail['overview'])){
$awards_text = substr($detail['overview'], 0, 200);
}
// بودجه و فروش جهانی (فقط برای فیلم)
$budget = '';
$gross_worldwide = '';
if($media_type === 'movie'){
if(!empty($detail['budget'])){
$budget = '$' . number_format($detail['budget']);
}
if(!empty($detail['revenue'])){
$gross_worldwide = '$' . number_format($detail['revenue']);
}
}
// تمیز کردن اعداد (همان تابع قبلی)
$budget_clean = $budget ? imdb_fetcher_money_clean($budget) : '';
$gross_worldwide_clean = $gross_worldwide ? imdb_fetcher_money_clean($gross_worldwide) : '';
// آمادهسازی آرایهی دادهها (با کلیدهای یکسان قبلی)
$imdb_data = [
'Title' => $title,
'Year' => $year,
'Runtime' => $runtime_str,
'Genre' => $genres_str,
'Country' => $countries_str,
'Language' => $languages_str,
'Director' => $directors_str,
'Actors' => $actors_str,
'Awards' => $awards_text,
'Rated' => $rated,
'Metascore' => '', // TMDb متااسکور ندارد
'BoxOffice' => $budget_clean
];
// ---------- بکگراند و پوستر (همان کد قبلی) ----------
$backdrop_path = $detail['backdrop_path'] ?? '';
$poster_path = $detail['poster_path'] ?? '';
$backdrop_url = $backdrop_path ? 'http://tmdb2.tala-film.top/55/tmdb-proxy.php?path=' . urlencode($backdrop_path) : '';
$poster_url = $poster_path ? 'http://tmdb2.tala-film.top/55/tmdb-proxy.php?path=' . urlencode($poster_path) : '';
if(!empty($backdrop_url)){
$attach_id = imdb_fetcher_set_backdrop_image($post_id, $backdrop_url);
if($attach_id){
update_post_meta($post_id, 'post_backdrop', $attach_id);
$meta_key = ($post_type==='series') ? 'tv_backdrop' : 'movies_backdrop';
$backdrop_url_local = wp_get_attachment_url($attach_id);
if(function_exists('update_field')){
update_field($meta_key, $backdrop_url_local, $post_id);
} else {
update_post_meta($post_id, $meta_key, $backdrop_url_local);
}
}
}
if(!empty($poster_url)){
imdb_fetcher_set_featured_image($post_id, $poster_url);
}
// ---------- عنوان و اسلاگ ----------
$title_for_post = $imdb_data['Title'] ?? 'Unknown';
$year_for_post = str_replace('–','',$imdb_data['Year'] ?? '');
if($post_type==='post'){
$post_title="دانلود فیلم {$title_for_post} {$year_for_post} بدون سانسور";
$post_slug="{$title_for_post}-{$year_for_post}";
}else{
$post_title="دانلود سریال {$title_for_post} بدون سانسور";
$post_slug="{$title_for_post}";
}
wp_update_post(['ID'=>$post_id,'post_title'=>$post_title,'post_name'=>sanitize_title($post_slug),'post_status'=>'draft']);
// ---------- ذخیره متاها (دقیقاً مشابه قبل) ----------
$rating = $detail['vote_average'] ?? '';
$votes = $detail['vote_count'] ?? '';
$metascore = ''; // از TMDb نداریم
$rated = $imdb_data['Rated'] ?? '';
$fields=[];
if($post_type==='series'){
$fields=[
'title_english_s' => $title_for_post,
'title_persian' => '',
'imdb_rating_s' => $rating,
'votecounttv' => $votes,
'serial_meta_critic'=> $metascore,
'id_series_meta' => $imdb_id,
'first_air_date' => $detail['first_air_date'] ?? '',
'year_s' => $year_for_post,
'epi_runtime' => $imdb_data['Runtime'] ?? '',
'tv_rated' => $rated,
'awards_short' => imdb_fetcher_translate_awards($imdb_data['Awards'] ?? ''),
];
}else{
$fields=[
'title_english' => $title_for_post,
'release_date' => $year_for_post,
'imdb_rating' => $rating,
'imdbvotecount' => $votes,
'id_imdb_film' => $imdb_id,
'runtime' => $imdb_data['Runtime'] ?? '',
'metascore_film' => $metascore,
'rated_meta' => $rated,
'awards_short' => imdb_fetcher_translate_awards($imdb_data['Awards'] ?? ''),
'budget' => $budget_clean,
'worldwide_gross'=> $gross_worldwide_clean
];
}
foreach($fields as $key=>$val){
if(function_exists('update_field')){
update_field($key,$val,$post_id);
}else{
update_post_meta($post_id,$key,$val);
}
}
// ---------- ژانرها (همان کد) ----------
$genre_map = [
'Action'=>'اکشن','Adventure'=>'ماجراجویی','Animation'=>'انیمیشن','Biography'=>'بیوگرافی',
'Comedy'=>'کمدی','Crime'=>'جنایی','Documentary'=>'مستند','Drama'=>'درام','Family'=>'خانوادگی',
'Fantasy'=>'فانتزی','History'=>'تاریخی','Horror'=>'ترسناک','Music'=>'موسیقی',
'Musical'=>'موزیکال','Mystery'=>'معمایی','Romance'=>'عاشقانه','Sci-Fi'=>'علمی تخیلی',
'Sport'=>'ورزشی','Thriller'=>'هیجان انگیز','War'=>'جنگی','Western'=>'وسترن'
];
$genres = explode(',', $imdb_data['Genre'] ?? '');
$genres = array_map('trim', $genres);
$genres_fa = [];
foreach($genres as $g){
$genres_fa[] = $genre_map[$g] ?? $g;
}
$taxonomy = ($post_type === 'series') ? 'genre-series' : 'genre-movies';
$term_ids = [];
foreach($genres_fa as $g){
$term = term_exists($g, $taxonomy);
if(!$term){
$term = wp_insert_term($g, $taxonomy);
}
if(!is_wp_error($term)){
$term_ids[] = is_array($term) && isset($term['term_id']) ? $term['term_id'] : $term;
}
}
if(!empty($term_ids)){
wp_set_post_terms($post_id, $term_ids, $taxonomy, false);
update_post_meta($post_id, 'genres_list', implode(', ', $genres_fa));
}
// ---------- کشور (همان کد) ----------
$countries_raw = array_map('trim', explode(',', $imdb_data['Country'] ?? ''));
$country_map = [
'United States' => 'آمریکا','USA' => 'آمریکا','UK' => 'انگلستان','United Kingdom' => 'انگلستان',
'France' => 'فرانسه','Germany' => 'آلمان','Italy' => 'ایتالیا','Spain' => 'اسپانیا',
'Portugal' => 'پرتغال','Canada' => 'کانادا','Mexico' => 'مکزیک','Brazil' => 'برزیل',
'Argentina' => 'آرژانتین','Chile' => 'شیلی','Colombia' => 'کلمبیا','Peru' => 'پرو',
'Japan' => 'ژاپن','China' => 'چین','Hong Kong' => 'هنگکنگ','Taiwan' => 'تایوان',
'South Korea' => 'کره جنوبی','North Korea' => 'کره شمالی','India' => 'هند',
'Pakistan' => 'پاکستان','Iran' => 'ایران','Turkey' => 'ترکیه','Egypt' => 'مصر',
'South Africa' => 'آفریقای جنوبی','Morocco' => 'مراکش','Tunisia' => 'تونس',
'Algeria' => 'الجزایر','Nigeria' => 'نیجریه','Kenya' => 'کنیا','Russia' => 'روسیه',
'Ukraine' => 'اوکراین','Poland' => 'لهستان','Czech Republic' => 'جمهوری چک',
'Slovakia' => 'اسلواکی','Hungary' => 'مجارستان','Romania' => 'رومانی',
'Bulgaria' => 'بلغارستان','Greece' => 'یونان','Sweden' => 'سوئد','Norway' => 'نروژ',
'Denmark' => 'دانمارک','Finland' => 'فنلاند','Iceland' => 'ایسلند','Australia' => 'استرالیا',
'New Zealand' => 'نیوزیلند','Saudi Arabia' => 'عربستان','Qatar' => 'قطر',
'United Arab Emirates' => 'امارات','Lebanon' => 'لبنان','Syria' => 'سوریه',
'Iraq' => 'عراق','Israel' => 'اسرائیل','Jordan' => 'اردن','Armenia' => 'ارمنستان',
'Georgia' => 'گرجستان','Azerbaijan' => 'آذربایجان','Kazakhstan' => 'قزاقستان',
'Uzbekistan' => 'ازبکستان','Thailand' => 'تایلند','Vietnam' => 'ویتنام',
'Philippines' => 'فیلیپین','Malaysia' => 'مالزی','Indonesia' => 'اندونزی',
'Singapore' => 'سنگاپور'
];
$countries_fa = [];
foreach ($countries_raw as $c) {
if (!$c) continue;
$translated = $country_map[$c] ?? $c;
$countries_fa[] = $translated;
}
$country_tax = ($post_type === 'series') ? 'country-series' : 'country';
foreach ($countries_fa as $cn) {
if (!term_exists($cn, $country_tax)) {
wp_insert_term($cn, $country_tax);
}
}
if (!empty($countries_fa)) {
wp_set_post_terms($post_id, $countries_fa, $country_tax, false);
update_post_meta($post_id, 'countries_list', implode(', ', $countries_fa));
}
// ---------- زبان (همان کد) ----------
if (!empty($imdb_data['Language'])) {
$languages = array_filter(array_map('trim', explode(',', $imdb_data['Language'])));
$language_translate = [
'English' => 'انگلیسی','Persian' => 'فارسی','Farsi' => 'فارسی',
'French' => 'فرانسوی','German' => 'آلمانی','Italian' => 'ایتالیایی',
'Spanish' => 'اسپانیایی','Japanese' => 'ژاپنی','Chinese' => 'چینی',
'Mandarin' => 'ماندارین','Cantonese' => 'کانتونی','Hindi' => 'هندی',
'Urdu' => 'اردو','Arabic' => 'عربی','Kurdish' => 'کردی','Pashto' => 'پشتو',
'Turkish' => 'ترکی','Azerbaijani' => 'آذری','Armenian' => 'ارمنی',
'Georgian' => 'گرجی','Russian' => 'روسی','Ukrainian' => 'اوکراینی',
'Polish' => 'لهستانی','Czech' => 'چکی','Slovak' => 'اسلواک',
'Slovenian' => 'اسلوونیایی','Croatian' => 'کرواتی','Serbian' => 'صربی',
'Bosnian' => 'بوسنیایی','Bulgarian' => 'بلغاری','Romanian' => 'رومانیایی',
'Hungarian' => 'مجارستانی','Greek' => 'یونانی','Dutch' => 'هلندی',
'Flemish' => 'فلاندری','Swedish' => 'سوئدی','Norwegian' => 'نروژی',
'Danish' => 'دانمارکی','Finnish' => 'فنلاندی','Icelandic' => 'ایسلندی',
'Portuguese' => 'پرتغالی','Brazilian Portuguese' => 'پرتغالی برزیلی',
'Malay' => 'مالایی','Indonesian' => 'اندونزیایی','Filipino' => 'فیلیپینی',
'Tagalog' => 'تاگالوگ','Thai' => 'تایلندی','Vietnamese' => 'ویتنامی',
'Khmer' => 'خمری (کامبوجی)','Lao' => 'لائوسی','Burmese' => 'برمهای',
'Mongolian' => 'مغولی','Nepali' => 'نپالی','Sinhala' => 'سینهالی',
'Tamil' => 'تامیلی','Telugu' => 'تلوگو','Bengali' => 'بنگالی',
'Punjabi' => 'پنجابی','Marathi' => 'مراتی','Gujarati' => 'گجراتی',
'Malayalam' => 'مالایالامی','Kannada' => 'کانادایی (هندی)','Hebrew' => 'عبری',
'Swahili' => 'سواحیلی','Zulu' => 'زولو','Afrikaans' => 'آفریکانس',
'Hausa' => 'هوسا','Amharic' => 'امهری','Somali' => 'سومالیایی',
'Berber' => 'بربری','Latin' => 'لاتین','Esperanto' => 'اسپرانتو',
'Ibo' => 'ایبو','Yoruba' => 'یوروبا','Maori' => 'مائوری',
'Samoan' => 'ساموایی','Tahitian' => 'تاهیتی','Fijian' => 'فیجیایی',
'Hawaiian' => 'هاوایی','Cherokee' => 'چروکی','Inuktitut' => 'اینوكتیتوت',
'Quechua' => 'کچوا','Guarani' => 'گوارانی','Nahuatl' => 'ناهواتل',
'Sanskrit' => 'سانسکریت','Tibetan' => 'تبتی','Uyghur' => 'اویغوری',
'Kazakh' => 'قزاقی','Uzbek' => 'ازبکی','Turkmen' => 'ترکمنی',
'Pashto' => 'پشتو','Sindhi' => 'سندی','Balochi' => 'بلوچی',
'Malagasy' => 'مالاگاسی',
];
$language_terms = [];
$language_tags = [];
foreach($languages as $lang){
$lang_fa = $language_translate[$lang] ?? $lang;
$term = term_exists($lang_fa, 'language');
if($term && isset($term['term_id'])){
$language_terms[] = intval($term['term_id']);
} else {
$new_term = wp_insert_term($lang_fa, 'language');
if(!is_wp_error($new_term) && isset($new_term['term_id'])){
$language_terms[] = intval($new_term['term_id']);
}
}
if(!in_array($lang_fa, $language_tags)){
$language_tags[] = $lang_fa;
}
}
if(!empty($language_terms)){
wp_set_post_terms($post_id, $language_terms, 'language', false);
}
if(!empty($language_tags)){
wp_set_post_tags($post_id, $language_tags, true);
}
}
// ---------- کارگردان (همان کد) ----------
$directors = array_map('trim', explode(',', $imdb_data['Director'] ?? ''));
$director_tax = ($post_type === 'series') ? 'dir-series' : 'director';
foreach ($directors as $d) {
if (!empty($d) && !term_exists($d, $director_tax)) {
wp_insert_term($d, $director_tax);
}
}
if (!empty($directors)) {
wp_set_post_terms($post_id, $directors, $director_tax, false);
update_post_meta($post_id, 'directors_list', implode(', ', $directors));
}
// ---------- بازیگران (همان کد) ----------
$actors = array_map('trim', explode(',', $imdb_data['Actors'] ?? ''));
$actors = array_slice($actors, 0, 5);
$actors_tax = ($post_type === 'series') ? 'act-series' : 'actors';
foreach ($actors as $a) {
if (!term_exists($a, $actors_tax)) {
wp_insert_term($a, $actors_tax);
}
}
wp_set_post_terms($post_id, $actors, $actors_tax, false);
if (!empty($actors)) {
update_post_meta($post_id, 'actors_list', implode(', ', $actors));
}
// ---------- سال انتشار (همان کد) ----------
if (!empty($year)) {
$release_tax = ($post_type === 'series') ? 'release-series' : 'release';
if (!term_exists($year, $release_tax)) {
wp_insert_term($year, $release_tax);
}
wp_set_post_terms($post_id, [$year], $release_tax, false);
update_post_meta($post_id, 'release_year', $year);
}
// ---------- ذخیره بودجه و فروش (همان کد) ----------
if (!empty($budget_clean)) {
update_post_meta($post_id, 'budget_amount', $budget_clean);
}
if (!empty($gross_worldwide_clean)) {
update_post_meta($post_id, 'gross_worldwide_amount', $gross_worldwide_clean);
}
wp_send_json_success(['post_id'=>$post_id]);
}
add_action('wp_ajax_imdb_fetcher_fetch_data','imdb_fetcher_fetch_data');
دانلود سریال The Eternaut بدون سانسور
جستجوهای اخیر
پاک کردن همه
دانلود سریال The Eternaut بدون سانسور مسافر ابدیت
پایان یافته
فصل 1 قسمت 6
بعد از اینکه وقوع بهمن هولناکی که جان بیشتر مردم را میگیرد فردی به نام خوان سالو به همراه دوستانش که از این حادثه جان سالم بدر برده اند باید تلاش کنند تا زنده بمانند. آنها در بین هزارن بازمانده حالا نه تنها باید با چالش های موجود دست و پنجه نرم کنند بلکه متوجه میشوند این تنها شروعی برای تهاجم بیگانگان بوده است و باید با آنها نیز روبرو شوند و...
VIP دانلود و تماشای آنلاین 50,000+ عنوان فیلم و قسمت سریال دانلود پرسرعت - پخش آنلاین بدون قطعی - بدون محدودیت
خرید اشتراک ویژه
باکس دانلود
عوامل و بازیگران
چند شنبه ها میاد قسمت بعدی
این سریال به پایان رسیده.