Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function auto($url){
- $post = curl_init();
- curl_setopt($post, CURLOPT_URL, $url);
- curl_setopt($post,
- CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($post,
- CURLOPT_FOLLOWLOCATION, 1);
- $result = curl_exec($post);
- curl_close($post);
- return $result;
- }
- function xx($x){
- echo '<pre>';
- print_r($x);
- echo '</pre>';
- }
- function change_mal_info($a){
- if(preg_match('/English/', $a) && preg_match('/Synonyms/', $a)){
- $b = str_replace("\r\nSynonyms:", ', ', $a);
- $c = str_replace("English:", "Synonyms:", $b);
- }elseif(preg_match('/English/', $a) && !preg_match('/Synonyms/', $a)){
- $c = str_replace("English:", "Synonyms:", $a);
- }else{
- $c = $a;
- }
- return str_replace(array('Synonyms', 'Premiered', 'Genres'), array('Alternatif', 'Seasons', 'Genre'), $c);
- }
- function mal($uri){
- $source = auto($uri);
- preg_match('/js-scrollfix-bottom"(.*?)Statistics/s', $source, $nne);
- preg_match_all('/ratingValue">(.*?)</s', $source, $sco);
- $string= substr($nne[1], strpos($nne[1], '<h2>Alternative Titles</h2>'));;
- preg_match_all('/href="(.*?)">/s', $string, $matches);
- foreach($matches[1] as $link){
- $ganti[] = '<a href="'.$link.'">';
- }
- $new = str_replace(array_merge(array('<span class="dark_text">','</span> ', '</div>', '</a>', '<br />', '<h2>', 'Information</h2>', 'Alternative Titles</h2>', ' ', ' ',"\r", "\n"), $ganti), '', $string);
- $news = str_replace('</span>', '',$new);
- $text = change_mal_info(str_replace(array('<div class="spaceit_pad">','<div class="spaceit">', '<div>'), "\r\n", $news));
- $mal_info['score'] = $sco[1][0];
- $mall = explode("\r\n", $text);
- foreach($mall as $anim){
- $exp = explode(':', $anim);
- $mal_info[strtolower($exp[0])] = $exp[1];
- }
- $mal_info['alter'] = $mal_info['alternatif'].', '.$mal_info['japanese'];
- unset($mal_info['broadcast']);
- unset($mal_info['japanese']);
- unset($mal_info['rating']);
- unset($mal_info['source']);
- unset($mal_info['producers']);
- unset($mal_info['licensors']);
- unset($mal_info['type']);
- unset($mal_info['status']);
- unset( $mal_info['alternatif']);
- $mal_info = array_filter($mal_info);
- return $mal_info;
- }
- $mal = mal('https://myanimelist.net/anime/1/Cowboy_Bebop');
- xx($mal);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement