вопрос
Здравствуйте,
Вчера купил модули Film Reader v1.6.2 с http://shop.dle.net.tr/ucretli-modul/271-dle-film-reader.html .
Он очень хорошо работает но он грабит информацию только с imdb.com а мне нужно с kinopoisk.ru .
Кто может помочь поправить плагин imdb под кинопосик.ру ?
Скачать плагин: клик.
Вот сам плагин:
Вчера купил модули Film Reader v1.6.2 с http://shop.dle.net.tr/ucretli-modul/271-dle-film-reader.html .
Он очень хорошо работает но он грабит информацию только с imdb.com а мне нужно с kinopoisk.ru .
Кто может помочь поправить плагин imdb под кинопосик.ру ?
Скачать плагин: клик.
Вот сам плагин:
<?php
/*
=====================================================
Author : Mehmet Hanoğlu <dle.net.tr>
-----------------------------------------------------
License : MIT License
-----------------------------------------------------
Copyright (c) 2014
-----------------------------------------------------
Date : 04.03.2014 [1.7]
=====================================================
*/
class FilmReader {
public function get( $url ) {
$html = $this->getURLContent( $url );
$dom = new DOMDocument();
@$dom->loadHTML( $html );
$x = new DOMXPath( $dom );
foreach($x->query("//meta") as $node) {
$_tmp['meta'][$node->getAttribute("property")] = $node->getAttribute("content");
}
preg_match("/(.*?)\s\(([0-9]+)\)/", $_tmp['meta']['og:title'], $name, PREG_OFFSET_CAPTURE);
$film = array(
'img' => $_tmp['meta']['og:image'],
'namelong' => $_tmp['meta']['og:title'],
'name' => $name[1][0],
'year' => $name[2][0],
'url' => $_tmp['meta']['og:url'],
'type' => $_tmp['meta']['og:type'],
'crating' => "",
);
preg_match("/\(([0-9]+) episodes\)/", $html, $eps, PREG_OFFSET_CAPTURE);
unset( $_tmp, $name, $html );
$film['runtime'] = $this->cleanWords( $x->query("//time")->item(0)->nodeValue ); $_temp = array();
foreach($x->query('//span[@itemprop="genre"]/text()') as $node) { $_temp[] = $this->cleanWords( $node->nodeValue ); }
$film['genres'] = implode(", ", $_temp);
$film['ratinga'] = $this->cleanWords( $x->query('//span[@itemprop="ratingValue"]')->item(0)->nodeValue );
$film['ratingb'] = $this->cleanWords( $x->query('//span[@itemprop="bestRating"]')->item(0)->nodeValue );
$film['ratingc'] = $this->cleanWords( $x->query('//span[@itemprop="ratingCount"]')->item(0)->nodeValue );
$film['story'] = $this->cleanWords( $x->query('//div[@itemprop="description"]/p/text()')->item(0)->nodeValue ); $_temp = array();
foreach($x->query('//div[@itemprop="creator"]/a/span[@itemprop="name"]/text()') as $node) { $_temp[] = $this->cleanWords( $node->nodeValue ); }
$film['writers'] = implode(", ", $_temp); $_temp = array();
foreach($x->query('//div[@itemprop="actors"]/a/span[@itemprop="name"]/text()') as $node) { $_temp[] = $this->cleanWords( $node->nodeValue ); }
$film['actors'] = implode(", ", $_temp); $_temp = array();
foreach($x->query('//div[@class="txt-block"]') as $node) { $_data1 = $this->cleanWords( $node->nodeValue ); $_data2 = explode(':', $_data1 ); $_temp[ $_data2[0] ] = trim( substr($_data1, strpos($_data1, ':')+1 ) ); }
$film['country'] = $_temp['Country'];
$film['locations'] = $_temp['Filming Locations'];
$film['language'] = str_replace("|", ", ", $_temp['Language'] );
$film['productionfirm'] = $_temp['Production Co'];
$film['datelocal'] = trim( $_temp['Release Date'] );
$film['namelocal'] = $_temp['Also Known As'];
$film['color'] = $_temp['Color'];
$film['sound'] = str_replace("|", ", ", $_temp['Sound Mix'] );
$film['budget'] = $_temp['Budget'];
$film['aratio'] = $_temp['Aspect Ratio'];
$film['tagline'] = $_temp['Taglines'];
$_temp = explode("_V1", $film['img'] );
if ( strpos( $_temp[0], "/imdb/images/logos/imdb_fb_logo" ) === false ) {
$film['orgimg'] = $_temp[0] . "_V1" . ".jpg";
}
$film['ratinga'] = str_replace( ".", ",", $film['ratinga'] );
//foreach($x->query('//div[@class="mediastrip"]/a') as $node) { $film['screens'][] = "http://www.imdb.com" . $node->getAttribute("href"); }
unset( $_temp );
if ( $film['type'] == "video.tv_show" ) {
$film['episodes'] = $eps[1][0]; unset( $eps );
$film['name'] = str_replace(": The TV Show", "", $film['name']);
$film['namelong'] = str_replace("â", "-", $film['namelong']);
if ( empty( $film['year'] ) ) {
$_temp = explode("(", $film['namelong']); $_temp = str_replace(")", "", $_temp[1]); $_temp = explode(" ", $_temp);
$film['year'] = trim( $_temp[2] ); $_temp = array();
}
if ( empty( $film['name'] ) ) { $_temp = explode("(", $film['namelong'] ); $film['name'] = trim( $_temp[0] ); $_temp = array(); }
$film['years'] = array();
$film['seasons'] = array();
foreach($x->query('//div[@id="titleTVSeries"]/div/span/a') as $node) {
if ( strpos( $node->getAttribute("href"), "?year=" ) != false ) {
preg_match("/year=([0-9]{4})&/", $node->getAttribute("href"), $r);
$film['years'][] = $r[1];
}
else if ( strpos( $node->getAttribute("href"), "?season=" ) != false ) {
preg_match("/season=([0-9]+)&/", $node->getAttribute("href"), $r);
$film['seasons'][] = $r[1];
}
}
sort( $film['years'], SORT_NUMERIC);
sort( $film['seasons'], SORT_NUMERIC);
$film['years'] = implode(",", array_unique( $film['years'] ) );
$film['season_count'] = count( $film['seasons'] );
$film['seasons'] = implode(",", array_unique( $film['seasons'] ) );
} else if ( $film['type'] == "video.movie" ) {
$film['director'] = $this->cleanWords( $x->query('//div[@itemprop="director"]/a/span[@itemprop="name"]')->item(0)->nodeValue );
if ( $x->query('//div[@class="infobar"]/span[@itemprop="contentRating"]')->item(0) ) $film['crating'] = $this->cleanWords( $x->query('//div[@class="infobar"]/span[@itemprop="contentRating"]')->item(0)->getAttribute('content') );
$film['soundtracks'] = $this->cleanWords( $x->query('//div[@id="soundtracks"]/text()')->item(0)->nodeValue );
}
return $film;
}
private function cleanWords( $text ) {
$text = trim( str_replace( array( "\t", " ", "\"", "\r\n", "\n", "»", "»", "»", "See more" ), "", $text ) );
return $text;
}
private function getURLContent($url) {
if ( function_exists('curl_exec') ) {
$ch = curl_init( $url );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_MAXREDIRS, 2);
$output = curl_exec( $ch );
curl_close( $ch );
} else {
$output = file_get_contents($url);
}
return $output;
}
}
?>
Ответил: MaRZoCHi
добавлен плагин KinoPoisk. ( Film Reader v1.6.5 )
http://shop.dle.net.tr/ucretli-modul/271-dle-film-reader.html
http://shop.dle.net.tr/ucretli-modul/271-dle-film-reader.html