我已经看过很多像这样的帖子,但他们并没有帮助我,因为我很擅长这个。请记住,我已经为我创建了这个脚本。主要问题是当我在几分钟后运行脚本时它崩溃了所有东西,但它之前没有这样做。从某种意义上说,它似乎比以前更加延迟。现在我唯一的解决方法是设置"刷新内容"到60秒然后脚本运行的时间太长太慢了,我的味道很慢但运行一段时间后最终仍然会在一段时间后崩溃。
<?php
set_time_limit(0);
require_once '../wp-load.php';
require_once'../wp-admin/includes/taxonomy.php';
global $wpdb;
$start = $_GET['start'];
$nextstart = $start + 1;
$query = $wpdb->prepare("SELECT id, anime_name2, wordpress_id FROM
1tmarz_animes WHERE wordpress_created='1' AND episode_created='0' ORDER BY
id ASC LIMIT $start,1");
$wpdb->query( $query );
if ( $wpdb->num_rows ) {
$post_data = $wpdb->get_results( $query, OBJECT);
echo '<pre>';
print_r($post_data);
echo '</pre>';
$importid = $post_data[0]->id;
$anime_name = html_entity_decode($post_data[0]->anime_name2);
$anime_id = $post_data[0]->wordpress_id;
$post_thumbnail_id = get_post_thumbnail_id( $anime_id );
$post_link = get_permalink( $anime_id );
echo 'thumb id: '.$post_thumbnail_id.'<br>';
echo 'post_link: '.$post_link.'<br>';
echo $anime_name.'<br>';
}
// create category
//$cid = wp_insert_term( $anime_name, 'category');
//$catid = $cid['term_id'];
echo 'cat olustur<br>';
$catid = wp_create_category($anime_name);
echo 'catid: '.$catid.'<br>';
// select episodes
$anime_content_episode = '';
$query2 = $wpdb->prepare("SELECT * FROM 1tmarz_episodes WHERE
animes_id='".$importid."' ORDER BY episode_name3 ASC");
$wpdb->query( $query2 );
if ( $wpdb->num_rows ) {
$episode_datas = $wpdb->get_results( $query2, OBJECT);
$kacepisode = count($episode_datas);
if ($kacepisode > 30) {
echo 'cok lan bu';
echo '<meta http-equiv="refresh"
content="1;URL=\'http://www.web.com/scrape/import_episode.php?
start='.$nextstart.'\'">';
exit;
}
foreach ($episode_datas as $episode_data) {
/*
echo '<pre>';
print_r($episode_data);
echo '</pre>';
*/
$episode_bolum = $episode_data->episode_name;
$episode_name = $anime_name.' '.$episode_bolum;
$downloadlink = $episode_data->downloadlink;
$embed = $episode_data->embed;
preg_match('/src="([^"]+)"/', $embed, $match);
$embed_link = $match[1];
$servers_array = unserialize($episode_data->servers);
/*
echo '<pre>';
print_r($servers_array);
echo '</pre>';
*/
echo $anime_name.'<br>';
echo $downloadlink.'<br>';
echo $embed_link.'<br>';
$embed_content= '[vc_row][vc_column][vc_column_text]
<div id="information"><a href="'.$post_link.'">Anime Information</a>
</div>
[/vc_column_text][/vc_column][/vc_row]';
$embed_content.='[vc_row][vc_column][vc_tta_tabs active_section="1"
no_fill_content_area="true"]';
$embed_content.= '[vc_tta_section title="Mirror 1"
tab_id="1494732255558-35fdcb11-d9bb0eae-d19849b1-22f8ac8e-df8b2398-
88ce3281"]
[vc_column_text]
[iframe src="'.$embed_link.'" allowfullscreen="true" frameborder="0"
scrolling="no" width="640" height="360"]
[/vc_column_text][/vc_tta_section]';
$serverk = 2;
foreach ($servers_array as $server_url) {
$embed_content.= '[vc_tta_section title="Mirror '.$serverk.'"
tab_id="1494732255558-35fdcb11-d9bb0eae-d19849b1-22f8ac8e-df8b2398-
88ce3281'.$serverk.'"][vc_column_text]
[iframe src="'.$server_url.'" allowfullscreen="true" frameborder="0"
scrolling="no" width="640" height="360"]
[/vc_column_text][/vc_tta_section]';
$serverk++;
}
$embed_content.='[/vc_tta_tabs][/vc_column][/vc_row]';
$new_post = array(
'post_title' => 'Watch '.$episode_name.' </br> English Subbed',
'post_content' => $embed_content,
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => 1,
'post_type' => 'post',
'post_category' => array($catid)
);
$post_id = wp_insert_post($new_post);
echo 'new id: '.$post_id.'<br>';
$reference = array();
$reference[] = array('reference' => '', 'type' => 'name', 'value' =>
'robots', 'content' => 'Index,Follow');
$reference[] = array('reference' => '', 'type' => 'property', 'value' =>
'og:type', 'content' => 'website');
$reference[] = array('reference' => '', 'type' => 'name', 'value' =>
'keywords', 'content' => $episode_name.', '.$episode_name.' English
Subbed, Watch '.$episode_name.', Stream '.$episode_name.',
'.$episode_name.' animetv, stream '.$episode_name.', '.$episode_name.'
HD, streaming '.$episode_name.' eng sub, '.$episode_name.',
'.$episode_name.' download, '.$episode_name.' full episode, stream
'.$anime_name.',' );
$mtm_data = serialize($reference);
update_post_meta( $post_id, '_yoast_wpseo_metadesc', 'Watch
'.$anime_name.' for free in 1080p HD' );
update_post_meta( $post_id, '_yoast_wpseo_focuskw', $anime_name );
update_post_meta( $post_id, '_yoast_wpseo_focuskw_text_input',
$anime_name );
update_post_meta( $post_id, '_thumbnail_id', $post_thumbnail_id);
update_post_meta( $post_id, 'mtm_data', $mtm_data);
update_post_meta( $post_id, '_wpb_vc_js_status', 'true');
update_post_meta( $post_id, '_vc_post_settings', 'a:1:
{s:10:"vc_grid_id";a:0:{}}');
update_post_meta( $post_id, '_subbed', 'field_58fa509a036d2');
update_post_meta( $post_id, 'subbed', 'Subbed');
update_post_meta( $post_id, '_download', 'field_5917d34221664');
update_post_meta( $post_id, 'download', '<a href="'.$downloadlink.'"
target="_blank">Link</a>');
update_post_meta( $post_id, 'subbed', 'Subbed');
update_post_meta( $post_id, 'subbed', 'Subbed');
$episode_link = get_permalink( $post_id );
$anime_content_episode.= '<tr>
<td>'.$episode_bolum.'</td>
<td><a href="'.$episode_link.'">Link</a></td>
</tr>';
sleep(1);
}
} else {
echo 'ee yokmus';
echo '<meta http-equiv="refresh"
content="1;URL=\'http://www.web.com/scrape/import_episode.php?
start='.$nextstart.'\'">';
exit;
}
// DELETE n1 FROM 1tmarz_episodes n1, 1tmarz_episodes n2 WHERE n1.id >
n2.id AND n1.episode_url = n2.episode_url
$anime_content_html = '<table>
<tbody>
<tr> </p>
<p><b>Links</b></li>
<tr>
<td>Quality:</td>
<td>1080p</td>
<td></td>
</tr>
'.$anime_content_episode.'
</tbody>
</table>';
$content_post = get_post($anime_id);
$contento = str_replace('%episode_list%', $anime_content_html,
$content_post->post_content);
$my_post = array(
'ID' => $anime_id,
'post_content' => $contento
);
wp_update_post( $my_post );
$query = $wpdb->prepare("UPDATE 1tmarz_animes SET episode_created='1'
WHERE id='".$importid."'");
$wpdb->query( $query );
echo 'bitti '.$anime_id.'<br>';
?>
<meta http-equiv="refresh" content="1">