Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/grab/grabers/keezmovies.php
Строк: 86
<?php
defined
('_VALID') or die('Restriced Acess!');
class 
VComponent_Admin_grab_keezmovies extends VComponent_Admin_grab_grab
{
    public function 
__construct($url$user_id$category$status)
    {
        
parent::__construct();
        
$this->url        $url;
        
$this->user_id    $user_id;
        
$this->category    $category;
        
$this->status    $status;
    }
    
    public function 
get_videos()
    {
        
$count    0;
        
$html    $this->clean_html(VCurl::string($this->url'age_verified=1'));
        if (
$html) {
            
preg_match_all('/<li id='video_(.*?)</li>/', $html, $matches);
            if (isset($matches['
1']) && $matches['1']) {
                foreach ($matches['
1'] as $match) {                    
                    ++$count;
                    if ($count > $this->overflow) {
                        $this->errors[]    = '
Overflow reached (500)! Aborting!';
                        return FALSE;
                    }
                    
                    if (strpos($match, '
style="display: none;"') !== FALSE OR
                        strpos($match, '
target="_blank"') !== FALSE) {
                        continue;
                    }
                    
                    $video    = array(
                        '
site'        => 'keezmovies',
                        '
url'        => '',
                        '
title'        => '',
                        '
desc'        => '',
                        '
tags'      => '',
                        '
category'    => '',
                        '
thumbs'    => array(),
                        '
duration'    => 0,
                        '
embed'        => '',
                        '
size'        => 0,
                        '
file_url'    => ''
                    );
                    
                    preg_match('
/<a href="(.*?)" class="video_a" title="(.*?)">/', $match, $matches_url);
                    if (isset($matches_url['
1']) && $matches_url['1'] &&
                        isset($matches_url['
2']) && $matches_url['2']) {
                        $video['
url']     = $matches_url['1'];
                        $video['
title']    = strip_tags(stripslashes($matches_url['2']));
                        if ($this->already_added('
keezmovies', $video['url'])) {
                            ++$this->video_already;
                            continue;
                        }
                      } else {
                          continue;
                      }
                    
                    preg_match('
/<var class="duration">(.*?)</var>/', $match, $matches_duration);
                    if (!isset($matches_duration['
1']) OR empty($matches_duration['1'])) {
                        preg_match('
/<var class="duration absolute">(.*?)</var>/', $match, $matches_duration);
                        if (!isset($matches_duration['
1']) OR empty($matches_duration['1'])) {
                            preg_match('
/<span class="vd_dr">(.*?)</span>/', $match, $matches_duration);
                        }
                    }
                    
                      if (isset($matches_duration['
1'])) {
                          $video['
duration'] = $this->duration_to_seconds($matches_duration['1']);
                      }
                    
                    preg_match('
/<img src="(.*?)"/', $match, $matches_thumb);
                    if (!isset($matches_thumb['
1']) OR $matches_thumb['1'] == '') {
                        preg_match('
/<img src='(.*?)'data-srcdata/', $match, $matches_thumb);
                    }
                    
                    if (isset($matches_thumb['
1']) && $matches_thumb['1']) {
                        $thumb_url          = explode('
?', $matches_thumb['1']);
                        $thumb_url            = $thumb_url['
0'];
                        $thumb_url            = substr($thumb_url, 0, strrpos($thumb_url, '
/'));
                        $video['
thumbs']     = array(
                            $thumb_url.'
/1.jpg',
                            $thumb_url.'
/2.jpg',
                            $thumb_url.'
/3.jpg',
                            $thumb_url.'
/4.jpg',
                            $thumb_url.'
/5.jpg',
                            $thumb_url.'
/6.jpg',
                            $thumb_url.'
/7.jpg',
                            $thumb_url.'
/8.jpg',
                            $thumb_url.'
/9.jpg',
                            $thumb_url.'
/10.jpg',
                            $thumb_url.'
/11.jpg',
                            $thumb_url.'
/12.jpg',
                            $thumb_url.'
/13.jpg',
                            $thumb_url.'
/14.jpg',
                            $thumb_url.'
/15.jpg',
                            $thumb_url.'
/16.jpg',
                        );
                    }
                    
                    $video['
embed'] = '<iframe src="'.str_replace('/video/', '/embed/', $video['url']).'" frameborder="0" height="'.$this->vcfg['embed_height'].'" width="'.$this->vcfg['embed_width'].'" scrolling="no" name="keezmovies_embed_video"></iframe>';
                    
                    if ($video['
url'] && $video['title'] && $video['duration'] && $video['thumbs']) {
                        $content        = $this->clean_html(VCurl::string($video['
url'], 'age_verified=1'));
                        
                        preg_match('
/<p><b>Categories:</b>(.*?)</p>/', $content, $match_category);
                        if (isset($match_category['
1']) && !empty($match_category['1'])) {
                            preg_match('
/<a href="(.*?)>(.*?)</a>/', $match_category['1'], $match_c);
                            if (isset(
$match_c['2']) && $match_c['2']) {
                                
$video['category']    = trim(htmlspecialchars(strip_tags($match_c['2']), ENT_QUOTES, 'UTF-8'));
                            }                            
                        }

                        preg_match('/<p><b>Tags:</b>(.*?)</p>/', 
$content$matches_tags);
                        if (isset(
$matches_tags['1']) && $matches_tags['1']) {
                            preg_match_all('/<a rel="
tag" href="(.*?)">(.*?)</a>/', $matches_tags['1'], $matches_tag);
                            
$tags   = array();
                            if (isset(
$matches_tag['2']) && $matches_tag['2']) {
                                foreach (
$matches_tag['2'] as $tag) {
                                    
$tags[] = strtolower(prepare_string($tag));
                                }

                                
$video['tags'] = implode(' ', $tags);
                            }
                        }
                        
                        if (
$video['tags'] && $video['category']) {                        
                            if (
$this->add_video($video)) {
                                ++
$this->video_added;
                            } else {
                                
$this->errors[] = 'Failed to add '.$video['url'].'!';
                            }
                        } else {
                            
$this->errors[] = 'Failed to get video details for '.$video['url'].' (tags and category)!';    
                        }
                    } else {
                        
$this->errors[] = 'Failed to get video details for '.$video['url'].'!';
                    }
                }
            } else {
                
$this->errors[] = 'No videos found while parsing '.$this->url.'!';
            }
        } else {
            
$this->errors[] = 'Failed to download '.$this->url.'!';
        }
        
        if (
$this->errors) {
            return FALSE;
        }
        
        return TRUE;
    }
    
    protected function duration_to_seconds(
$duration)
    {
        
$duration   = str_replace(array('m', 's'), array(':', ''), $duration);
        
$duration   = explode(':', $duration);
        
$minutes    = sprintf('%01d', $duration['0']);
        
$seconds    = sprintf('%01d', $duration['1']);

        return ((
$minutes * 60) + $seconds);
    }
}
Онлайн: 2
Реклама