Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/grab/grabers/shufuni.php
Строк: 99
<?php
defined
('_VALID') or die('Restriced Acess!');
class 
VComponent_Admin_grab_shufuni 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'k_visit=3; shfn=cTC6psOvCC5qGNFWzSU7xg=='));
        if (
$html) {
            
preg_match_all('/<div class="MovImgWrap">(.*?)</div></div>/'$html$matches);
            if (isset(
$matches['1']) && $matches['1']) {
                
$this->update_progress('0^Processing videos...');
                
$total_videos   count($matches['1']);
                
$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'        => 'shufuni',
                        
'url'        => '',
                        
'title'        => '',
                        
'desc'        => '',
                        
'tags'      => '',
                        
'category'    => '',
                        
'thumbs'    => array(),
                        
'duration'    => 0,
                        
'embed'        => '',
                        
'size'        => 0,
                        
'file_url'    => ''
                    
);
                    
                    
preg_match('/href="(.*?)"/'$match$matches_url);
                    if (isset(
$matches_url['1']) && $matches_url['1']) {
                        
$video['url']    = 'http://www.shufuni.com'.trim($matches_url['1']);
                        
$this->update_progress($progress.'^Processing '.$video['url']);
                        if (
$this->already_added('shufuni'$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 url...continue!');
                        
$progress sprintf("%01.2f", ($progress+$incr));
                        continue;
                    }
                    
                    
preg_match('/alt="(.*?)"/'$match$matches_title);
                    if (isset(
$matches_title['1']) && $matches_title['1']) {
                        
$video['title'] = strip_tags(htmlspecialchars($matches_title['1']));
                    }
                    
                    
preg_match('/tooltip="Duration">(.*?)</span>/'$match$matches_duration);
                    if (isset(
$matches_duration['1']) && $matches_duration['1']) {
                          
$video['duration'] = $this->duration_to_seconds($matches_duration['1']);
                    }
                    
                    
preg_match('/src="(.*?)" id/'$match$matches_thumb);
                    if (isset(
$matches_thumb['1']) && $matches_thumb['1']) {
                          
$thumb_url       $matches_thumb['1'];
                          
$thumb_url         substr($thumb_url0strrpos($thumb_url'_'));
                        
$video['thumbs'] = array(
                            
$thumb_url.'_0001.jpg',
                            
$thumb_url.'_0002.jpg',
                            
$thumb_url.'_0003.jpg',
                            
$thumb_url.'_0004.jpg',
                            
$thumb_url.'_0005.jpg',
                            
$thumb_url.'_0006.jpg',
                            
$thumb_url.'_0007.jpg',
                            
$thumb_url.'_0008.jpg',
                            
$thumb_url.'_0009.jpg',
                            
$thumb_url.'_0010.jpg',
                            
$thumb_url.'_0011.jpg',
                            
$thumb_url.'_0012.jpg',
                            
$thumb_url.'_0013.jpg',
                            
$thumb_url.'_0014.jpg',
                            
$thumb_url.'_0015.jpg',
                            
$thumb_url.'_0016.jpg',
                            
$thumb_url.'_0017.jpg',
                            
$thumb_url.'_0018.jpg',
                            
$thumb_url.'_0019.jpg',
                            
$thumb_url.'_0020.jpg',
                            
$thumb_url.'_0021.jpg',
                            
$thumb_url.'_0022.jpg',
                            
$thumb_url.'_0023.jpg',
                            
$thumb_url.'_0024.jpg',
                            
$thumb_url.'_0025.jpg',
                            
$thumb_url.'_0026.jpg',
                            
$thumb_url.'_0027.jpg',
                            
$thumb_url.'_0028.jpg',
                            
$thumb_url.'_0029.jpg',
                            
$thumb_url.'_0030.jpg'
                        
);
                    }
                    
                    
preg_match('/class="MovCatLink">(.*?)</a>/'$match$matches_category);
                    if (isset(
$matches_category['1']) && $matches_category['1']) {
                          
$video['category'] = $matches_category['1'];
                    }
                                        
                    if (
$video['title'] && $video['duration'] && $video['thumbs'] && $video['category']) {
                        
$content    $this->clean_html(VCurl::string($video['url'], 'IAgree=yes; StartClick=1; k_visit=3; shfn=cTC6psOvCC5qGNFWzSU7xg=='));
                        
                        
preg_match('/class="CategoriesListCon">(.*?)</span>/'$content$matches_categories);
                        if (isset(
$matches_categories['1']) && $matches_categories['1']) {
                            
$matches_tags str_replace(',&nbsp;'''$matches_categories['1']);
                            
preg_match_all('/<a href="(.*?)" class="VidCatItem">(.*?)</a>/'$matches_tags$matches_tag);
                            
$tags   = array();
                            if (isset(
$matches_tag['2'])) {
                                foreach (
$matches_tag['2'] as $tag) {
                                      
$tag    strtolower(prepare_string($tag));
                                      if (
strlen($tag) > 3) {
                                          
$tags[] = $tag;
                                      }
                                }

                                
$video['tags'] = implode(' '$tags);
                            }
                        }
                        
                        
preg_match('/var _videoCode = "(.*?)";/'$content$matches_code);
                        if (isset(
$matches_code['1']) && $matches_code['1']) {
                              
$video_code    $matches_code['1'];
                        }
                                                
                        if (
$video['tags'] && isset($video_code)) {
                            
$video['embed']    = '<object width="'.$this->vcfg['embed_width'].'" height="'.$this->vcfg['embed_height'].'"><param name="movie" value="http://www.shufuni.com/Flash/" flashvars="videoCode='.$video_code.'&WID="></param><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always" /><embed src="http://www.shufuni.com/Flash/EmbedPlayer.swf" type="application/x-shockwave-flash" width="'.$this->vcfg['embed_width'].'" height="'.$this->vcfg['embed_height'].'" allowFullScreen="true" allowScriptAccess="always" flashvars="videoCode='.$video_code.'&WID="></embed></object>';
                            if (
$this->add_video($video)) {
                                
$progress sprintf("%01.2f", ($progress+$incr));
                                
$this->update_progress($progress.'^Video ('.$video['url'].') embedded!');
                                ++
$this->video_added;
                            } 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'].' (tags, code, id)!';
                        }
                    } 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;
    }
}
Онлайн: 2
Реклама