Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/grab/grabers/sextube.php
Строк: 82
<?php
defined
('_VALID') or die('Restriced Acess!');
class 
VComponent_Admin_grab_sextube extends VComponent_Admin_grab_grab
{
    public function 
__construct($url$user_id$category$status$unique)
    {
        
parent::__construct();
        
$this->url        $url;
        
$this->user_id    $user_id;
        
$this->category    $category;
        
$this->status    $status;
        
$this->unique    $unique;
    }
    
    public function 
get_videos()
    {
        
$count    0;
        
$this->update_progress('0^Parsing remote html...');
        
$html    $this->clean_html(VCurl::string($this->url'slutload=201akpgvcparf6r84e216lovq0'));
        if (
$html) {
            
preg_match_all('/<a href="http://www.sextube.com/media/(.*?)</a>/'$html$matches);
            if (isset(
$matches['0']) && $matches['0']) {
                
$this->update_progress('0^Processing videos...');
                
$total_videos     count($matches['0']);
                
$incr            round((100/$total_videos), 2);
                
$progress        0;
                foreach (
$matches['1'] as $match) {
                    ++
$count;
                    if (
$count $this->overflow) {
                        
$this->errors[]    = 'Overflow reached (500)! Aborting!';
                        return 
FALSE;
                    }
                    
                    
$video    = array(
                        
'site'        => 'slutload',
                        
'url'        => '',
                        
'title'        => '',
                        
'desc'        => '',
                        
'tags'      => '',
                        
'category'    => '',
                        
'thumbs'    => array(),
                        
'duration'    => 0,
                        
'embed'        => '',
                        
'size'        => 0,
                        
'file_url'    => ''
                    
);
                    
                    
preg_match('/<a href="(.*?)" /'$match$matches_url);
                    if (isset(
$matches_url['1']) && $matches_url['1']) {
                        
$video['url']    = $matches_url['1'];
                        
$this->update_progress($progress.'^Processing '.$video['url'].' ('.$video['title'].') ...');
                        if (
$this->already_added('redtube'$video['url'])) {
                            
$this->update_progress($progress.'^Video already added!');
                            
$progress sprintf("%01.2f", ($progress+$incr));
                            ++
$this->video_already;
                            continue;
                        } 
                    } else {
                        
$this->update_progress($progress.'^Failed to find video title...continue!');
                        
$progress sprintf("%01.2f", ($progress+$incr));
                        continue;
                    }
                    
                    echo 
VF::debug($video);
                    die();
                    
                    
preg_match('/<b>(.*?)</b>/'$match$matches_title);
                    if (isset(
$matches_title['1']) && $matches_title['1']) {
                        
$video['title'] = htmlspecialchars(strip_tags($matches_title['1']));
                    }
                    
                    echo 
VF::debug($video);
                    die();
                    
                    
preg_match('/<span class="d">(.*?)$/'$match$matches_duration);
                    if (isset(
$matches_duration['1'])) {
                          
$video['duration'] = $this->duration_to_seconds($matches_duration['1']);
                    }
                    
                    
preg_match('/class="t" src="(.*?)" onmouseout/'$match$matches_thumb);
                    if (isset(
$matches_thumb['1'])) {
                          
$thumb_url  $matches_thumb['1'];
                        
$thumb_url  substr($thumb_url0strrpos($thumb_url'_'));
                        
$video_id   intval(substr($thumb_urlstrrpos($thumb_url'/')+1));
                        
$video['thumbs'] = array(
                            
$thumb_url.'_002.jpg',
                            
$thumb_url.'_003.jpg',
                            
$thumb_url.'_004.jpg',
                            
$thumb_url.'_005.jpg',
                            
$thumb_url.'_006.jpg',
                            
$thumb_url.'_007.jpg',
                            
$thumb_url.'_008.jpg',
                            
$thumb_url.'_009.jpg',
                            
$thumb_url.'_010.jpg',
                            
$thumb_url.'_011.jpg',
                            
$thumb_url.'_012.jpg',
                            
$thumb_url.'_013.jpg',
                            
$thumb_url.'_014.jpg',
                            
$thumb_url.'_015.jpg'
                        
);
                    }
                  
                    if (
$video['title'] && $video['duration'] && $video['thumbs'] && isset($video_id)) {
                        
$tags        = array();
                        
$tags_arr    explode(' 'strtolower(prepare_string($video['title'])));
                        foreach (
$tags_arr as $tag) {
                            if (
strlen($tag) >= 5) {
                                
$tags[] = $tag;
                            }
                        }
                        
                        
$video['tags']  = implode(' '$tags);
                        
$video['embed'] = '<object wmode="transparent" height="'.$this->vcfg['embed_height'].'" width="'.$this->vcfg['embed_width'].'"><param name="movie" value="http://embed.redtube.com/player/"><param name="FlashVars" value="id='.$video_id.'&style=redtube"><embed src="http://embed.redtube.com/player/?id='.$video_id.'&style=redtube" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" height="'.$this->vcfg['embed_height'].'" width="'.$this->vcfg['embed_width'].'" /></object>';
                        
                        if (
$this->add_video($video)) {
                            ++
$this->video_added;
                            
$progress sprintf("%01.2f", ($progress+$incr));
                            
$this->update_progress($progress.'^Video ('.$video['url'].') embedded!');
                        } else {
                            
$this->update_progress($progress.'^Failed to add video database entry!');
                            
$progress sprintf("%01.2f", ($progress+$incr));
                            
$this->errors[] = 'Failed to add '.$video['url'].'!';
                        }
                    } else {
                        
$this->update_progress($progress.'^Failed to get video details for '.$video['url'].'!');
                        
$progress sprintf("%01.2f", ($progress+$incr));
                        
$this->errors[] = 'Failed to get video details for '.$video['url'].'!';
                    }
                }
            } else {
                
$this->update_progress('100^No videos found while parsing remote html!!!');
                
$this->errors[] = 'No videos found while parsing '.$this->url.'!';
            }
        } else {
            
$this->update_progress('100^Failed to download remote html page!!!');
            
$this->errors[] = 'Failed to download '.$this->url.'!';
        }
        
        if (
$this->errors) {
            return 
FALSE;
        }
        
        return 
TRUE;
    }
}
Онлайн: 3
Реклама