Thread: Imdb
View Single Post
  #17  
Old 23rd November 2018, 17:51
Tankcsapda Tankcsapda is offline
Member
 
Join Date: Nov 2011
Hungary
Posts: 10
Default
https://www.bvlist.com/showpost.php?p=52832&postcount=7

Quote:
Originally Posted by Napon View Post
your code not working and there more to edit lang upload takeupload so on with https


Code:
<?php
function cleanstring( $imputString )
{
    $whatToCleanArray = array(
        chr( 13 ),
        chr( 10 ),
        chr( 13 ).chr( 10 ),
        chr( 10 ).chr( 13 ),
        "\n",
        "  ",
        "   ",
        "    ",
        "\n\n",
        "\n\r",
        "<br>",
        "<br/>",
        "<br />"
    );
    $cleanWithArray = array( "", "", "", "", "", "", "", "", "", "", "", "", "" );
    $cleaned = str_replace( $whatToCleanArray, $cleanWithArray, $imputString );
    $cleaned = trim( $cleaned );
    return $cleaned;
}

function fetch_data( $url, $cleantext = true )
{
    @ini_set( "user_agent", "TS_SE via cURL/PHP" );
    $data = false;
    $timeout = 10;
    if ( function_exists( "curl_init" ) && ( $ch = curl_init( ) ) )
    {
        $CURLUSED = true;
        curl_setopt( $ch, CURLOPT_URL, $url );
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
        curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
        $data = curl_exec( $ch );
        curl_close( $ch );
    }
    if ( !isset( $CURLUSED ) && !$data && ini_get( "allow_url_fopen" ) )
    {
        $old = ini_set( "default_socket_timeout", $timeout );
        $contents = "";
        if ( $handle = @fopen( $url, "rb" ) )
        {
            ini_set( "default_socket_timeout", $old );
            stream_set_timeout( $handle, $timeout );
            stream_set_blocking( $handle, 0 );
            while ( !feof( $handle ) )
            {
                $contents .= fread( $handle, 8192 );
            }
            fclose( $handle );
            $data = $contents;
            unset( $contents );
        }
    }
    return $data ? $cleantext == true ? cleanstring( $data ) : $data : false;
}  

function match_all($regex, $str, $i = 0) {
    if (preg_match_all( $regex, $str, $matches ) === false) {
        return false;
    }

    return $matches[$i];
}

function get_match($regex, $content) {
    preg_match( $regex, $content, $matches );
    return (isset( $matches[1] ) ? trim( $matches[1] ) : false);
}

function match($regex, $str, $i = 0) {
    if (preg_match( $regex, $str, $match ) == 1) {
        return $match[$i];
    }

    return false;
}

  @error_reporting (E_ALL & ~E_NOTICE);
  @ini_set ('error_reporting', E_ALL & ~E_NOTICE);
  @ini_set ('display_errors', '0');
  @ini_set ('log_errors', '1');
  @ini_set ('max_execution_time', '20000');
  @ini_set ('max_input_time', '20000');
  define ('TS_IMDB_VERSION', '0.9 by xam');
  if (((!defined ('IN_TRACKER') OR !defined ('IN_SCRIPT_TSSEv56')) OR !defined ('TU_VERSION')))
  {
    exit ('<font face=\'verdana\' size=\'2\' color=\'darkred\'><b>Error!</b> Direct initialization of this file is not allowed.</font>');
  }

  $regex = '#https://www.imdb.com/title/(.*)/#U';
  preg_match ($regex, $t_link, $_id_);
  $_id_ = $_id_[1];
  $url = '' . 'https://www.imdb.com/title/' . $_id_ . '/';
  $text = fetch_data ($url);

  $poster = match( '/poster">.*?<img.*?src="(.*?)".*?<\/td>/ms', $text, 1 );

if (( ( $poster != '' && strrpos( $poster, 'nopicture' ) === false ) && strrpos( $poster, 'ad.doubleclick' ) === false )) {
    file_put_contents( '' . $torrent_dir . '/images/' . $_id_ . '.jpg', fetch_data( $poster, false ) );
    $poster = '' . $BASEURL . '/' . $torrent_dir . '/images/' . $_id_ . '.jpg';
}
else {
    $poster = '';
}

$directors = array(  );
foreach (match_all( '/<a.*?>(.*?)<\/a>/ms', match( '/Director.?:(.*?)(<\/div>|>.?and )/ms', $text, 1 ), 1 ) as $m) {
    array_push( $directors, $m );
}
$directors = strip_tags( implode( ', ', $directors ) );

$writers = array(  );
foreach (match_all( '/<a.*?>(.*?)<\/a>/ms', match( '/Writer.?:(.*?)(<\/div>|>.?and )/ms', $text, 1 ), 1 ) as $m) {

    if (!preg_match( '#more credit#', $m )) {
        array_push( $writers, $m );
        continue;
    }
}
$writers = strip_tags( implode( ', ', $writers ) );

$stars = array(  );
foreach (match_all( '/<a.*?>(.*?)<\/a>/ms', match( '/Stars.?:(.*?)(<\/div>| See full cast and crew)/ms', $text, 1 ), 1 ) as $m) {

    if (!preg_match( '#more credit#', $m )) {
        array_push( $stars, $m );
        continue;
    }
}
$stars = strip_tags( implode( ', ', $stars ) );

  $regex = '#<title>(.*)</title>#U';
  preg_match_all ($regex, $text, $title, PREG_SET_ORDER);
  $regex = '#<div class="txt-block"><h4 class="inline">Budget:</h4>(.*)</div>#U';
  preg_match_all ($regex, $text, $budget, PREG_SET_ORDER);
  $regex = '#<div class="txt-block"><h4 class="inline">Also Known As:</h4>(.*)<span class="see-more inline"#U';
  preg_match_all ($regex, $text, $alsoknownas, PREG_SET_ORDER);
  $regex = '#<div class="txt-block"><h4 class="inline">Aspect Ratio:</h4>(.*)</div>#U';
  preg_match_all ($regex, $text, $aspectratio, PREG_SET_ORDER);
  $regex = '#<a[^>]* data-video="(.*)"[^>]*>(.*)<span#U';
  preg_match_all ($regex, $text, $trailer, PREG_SET_ORDER);
  $regex = '#<div class="txt-block"><h4 class="inline">Taglines:</h4>(.*)</div>#U';
  preg_match_all ($regex, $text, $taglines, PREG_SET_ORDER);
  $regex = '#<div class="txt-block"><h4 class="inline">Filming Locations:</h4>(.*)<span class="see-more inline"#U';
  preg_match_all ($regex, $text, $filminglocations, PREG_SET_ORDER);
  $title = strip_tags ($title[0][1]);
  $trailers = '' . 'https://www.imdb.com/video/imdb/' . $trailer[0][1] . '';
  
  $langs = array(  );
   foreach (match_all( '/<a.*?>(.*?)<\/a>/ms', match( '/Language.?:(.*?)(<\/div>|See more)/ms', $text, 1 ), 1 ) as $m) {
    array_push( $langs, $m );
}

  $genres = array(  );
   foreach (match_all( '/<a.*?>(.*?)<\/a>/ms', match( '/Genre.?:(.*?)(<\/div>|See more)/ms', $text, 1 ), 1 ) as $m) {
    array_push( $genres, $m );
}

  $soundmix = array(  );
   foreach (match_all( '/<a.*?>(.*?)<\/a>/ms', match( '/Sound Mix.?:(.*?)(<\/div>|See more)/ms', $text, 1 ), 1 ) as $m) {
    array_push( $soundmix, $m );
}

  $country = array(  );
   foreach (match_all( '/<a.*?>(.*?)<\/a>/ms', match( '/Country.?:(.*?)(<\/div>|See more)/ms', $text, 1 ), 1 ) as $m) {
    array_push( $country, $m );
}

  $plotkeywords = array(  );
   foreach (match_all( '/<a.*?>(.*?)<\/a>/ms', match( '/Plot Keywords.?:(.*?)(<\/div>|See more)/ms', $text, 1 ), 1 ) as $m) {
    array_push( $plotkeywords, $m );
}

  $langs = strip_tags( implode( ' | ', $langs ) ); 
  $genres = strip_tags( implode( ' | ', $genres ) );
  $soundmix = strip_tags( implode( ' | ', $soundmix ) );
  $country = strip_tags( implode( ' | ', $country ) );
  $plotkeywords = strip_tags( implode( ' | ', $plotkeywords ) );  
  $rating = strip_tags( match( '/itemprop="ratingValue">([0-9].[0-9])<\/span>/ms', $text, 1 ) );
  $votes = strip_tags( match( '/<span itemprop="ratingCount">(.*?)<\/span>/ms', $text, 1 ) );
  $release_date = strip_tags( match( '/Release Date:<\/h4>.*?([0-9][0-9]? (January|February|March|April|May|June|July|August|September|October|November|December) (19|20)[0-9][0-9]).*?(\(|<span)/ms', $text, 1 ) );
  $run_time = strip_tags( get_match( '/Runtime:<\/h4>(.*)<\/div>/isU', $text ) );
  $storyline = strip_tags( match( '/Storyline<\/h2>(.*?)(<em|<\/p>|<span)/ms', $text, 1 ) );
  
  $officialsites = get_match( '/Official Sites:<\/h4>(.*)<span class="see-more inline">/isU', $text );
  if ($officialsites !== false)
  $officialsites = str_replace('/offsite/', 'https://www.imdb.com/offsite/', $officialsites);
  $officialsites = str_replace('<a ', '<a target="_blank" ', $officialsites);

  preg_match_all( '#<div class="mediastrip">(.*)<\/div>#isU', $text, $photos );
  if (isset( $photos['1']['0'] )) {
    preg_match_all( '#https:\/\/m\.media-amazon.com\/images\/M\/(.*)\.jpg#isU', $photos['1']['0'], $photourls );
}

$extra = '';
$photoarray = array(  );

if (( isset( $photourls['0'] ) && 0 < count( $photourls['0'] ) )) {
    foreach ($photourls['0'] as $pid => $photo) {
        $ext = get_extension( $photo );
        $photoname = '' . $torrent_dir . '/images/' . $_id_ . '_photo' . $pid . '.' . $ext;

        if (file_exists( $photoname )) {
            @unlink( $photoname );
        }


        if ($handle = fopen( $photoname, 'x' )) {
            if (fwrite( $handle, fetch_data( $photo, false ) )) {
                $photoarray[] = $BASEURL . '/' . $photoname;
            }

            fclose( $handle );
            continue;
        }
    }


    if (( $photoarray && count( $photoarray ) )) {
        $extra = '<br /><br /><div align="center">';
        foreach ($photoarray as $photo) {
            $extra .= ' <img src="' . $photo . '" alt="" title="" border="0" /> ';
        }

        $extra .= '</div>';
    }
}
  
  $t_link = '' . '<table width=\'100%\' border=\'0\' align=\'center\' class=\'none\'><tr><td colspan=\'2\' class=\'none\' align=\'left\'><b>' . $title . '</b></td></tr><tr><td class=\'none\' align=\'center\' valign=\'top\'>' . ($poster ? '<img src=\'' . $poster . '\' border=\'0\' alt=\'' . $title . '\' title=\'' . $title . '\'>' : '') . '</td><td class=\'none\' valign=\'top\' align=\'left\'>' . ($alsoknownas[0][1] ? '<b>Also known as:</b> ' . strip_tags (str_replace ('more', '', $alsoknownas[0][1])) . '<br />' : '') . ($officialsites ? '<b>Official sites:</b> ' . $officialsites . '<br />' : '') . '<b>Director/s:</b> ' . $directors . '<br />' . '<b>Writer/s:</b> ' . $writers . '<br />' . '<b>Stars:</b> ' . $stars . '<br />' . '<b>Genre:</b> ' . $genres . '<br />' . ($release_date ? '<b>Release date:</b> ' . $release_date . '<br />' : '') . '<b>User Rating:</b> ' . $rating . '/10 (' . ($votes ? $votes : 'awaiting 5') . ' votes)' . ('' . '<br /><b>Language:</b> '. $langs .'<br /><b>Country:</b> ' . $country . '<br />') . ($filminglocations[0][1] ? '<b>Filming locations:</b> ' . strip_tags (str_replace ('more', '', $filminglocations[0][1])) . '<br />' : '') . ($run_time ? '<b>Runtime:</b> ' . $run_time . '' : '') . ($budget[0][1] ? '<br /><b>Budget:</b> ' . $budget[0][1] . '' : '') . ($soundmix ? '<br /><b>Sound mix:</b> ' . $soundmix . '' : '') . ($aspectratio[0][1] ? '<br /><b>Aspect ratio:</b> ' . $aspectratio[0][1] . '' : '') . '<br /><b>Storyline:</b> ' . $storyline . ($plotkeywords ? '<br /><b>Plot keywords:</b> ' . $plotkeywords . '' : '') . ($taglines[0][1] ? '<br /><b>Taglines:</b> ' . strip_tags (str_replace ('more', '', $taglines[0][1])) . '' : '') . ('' . '<br /><b>IMDb link:</b> <a href=\'' . $t_link . '\' target=\'_blank\' alt=\'' . $title . '\' title=\'' . $title . '\'>' . $t_link . '</a>' . $extra . '</td></tr></table>' . ($trailer[0][1] ? '<br /><table width=\'100%\' border=\'0\' cellpadding=\'5\' cellspacing=\'0\'><tr><td align=\'center\' class=\'subheader\'><a href=\'' . $trailers . '\' target=\'_blank\' alt=\'' . $title . '\' title=\'' . $title . '\'><img border="0" class="inlineimg" src=\'' . $BASEURL . '/images/trailer.png\'></a></td></tr></table>' : '') . '');
  ?>
Reply With Quote