Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/grab/grabers/pornerbros.php
Строк: 108
<?php
defined
('_VALID') or die('Restriced Acess!');
define('_RESIZE_THUMB'TRUE);
class 
VComponent_Admin_grab_pornerbros 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));
        if (
$html) {
            
preg_match_all('/<div class="contents_gallery_item">(.*?)</div>/'$html$matches);
            if (isset(
$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'        => 'pornerbros',
                        
'url'        => '',
                        
'title'        => '',
                        
'desc'        => '',
                        
'tags'      => '',
                        
'category'    => '',
                        
'thumbs'    => array(),
                        
'duration'    => 0,
                        
'embed'        => '',
                        
'size'        => 0,
                        
'file_url'    => ''
                    
);
                    
                    
preg_match('/<a href="(.*?)" title="(.*?)"/'$match$matches_url);
                    if (isset(
$matches_url['1']) && !empty($matches_url['1']) &&
                        isset(
$matches_url['2']) && !empty($matches_url['2'])) {
                        
$video['url']    = 'http://www.pornerbros.com'.trim($matches_url['1']);
                        
$video['title']    = strip_tags(trim($matches_url['2']));
                        
                        
$this->update_progress($progress.'^Processing '.$video['url'].' ...');
                        if (
$this->already_added('pornerbros'$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;
                      }
                    
                    
preg_match('/<span class="contents_gallery_length">(.*?)</span>/'$match$matches_duration);
                      if (isset(
$matches_duration['1']) && !empty($matches_duration['1'])) {
                          
$video['duration'] = $this->duration_to_seconds($matches_duration['1']);
                      }
                    
                    
preg_match('/gid="(.*?)" src="(.*)" thumbs=/'$match$matches_thumb);
                    if (!
$matches_thumb) {
                        
preg_match('/gid="(.*?)" src = '' class='lazy' data-original="(.*?)" thumbs=/'$match$matches_thumb);
                    }
                    
                    if (isset(
$matches_thumb['1']) && !empty($matches_thumb['1']) &&
                        isset(
$matches_thumb['2']) && !empty($matches_thumb['2'])) {
                        
$video_id        = (int) $matches_thumb['1'];
                        
$thumb_arr        explode('_'trim($matches_thumb['2']));
                        
$thumb_url        substr($thumb_arr['0'], 0strrpos($thumb_arr['0'], '/'));
                        
$thumb_size        $thumb_arr['1'];
                        
                        
$video['thumbs']    = array(
                            
$thumb_url.'/1_'.$thumb_size,
                            
$thumb_url.'/2_'.$thumb_size,
                            
$thumb_url.'/3_'.$thumb_size,
                            
$thumb_url.'/4_'.$thumb_size,
                            
$thumb_url.'/5_'.$thumb_size,
                            
$thumb_url.'/6_'.$thumb_size,
                            
$thumb_url.'/7_'.$thumb_size,
                            
$thumb_url.'/8_'.$thumb_size,
                            
$thumb_url.'/9_'.$thumb_size,
                            
$thumb_url.'/10_'.$thumb_size
                        
);
                      }
                      
                    if (
$video['title'] && $video['duration'] && $video['thumbs'] && isset($video_id)) {
                        
$content $this->clean_html(VCurl::string($video['url']));
                        
                        
preg_match('/id="contents_post_category">Categories: <a href="(.*?)" title="(.*?)"/'$content$matches_categories);
                        if (isset(
$matches_categories['2']) && !empty($matches_categories['2'])) {
                            
$video['category'] = trim(strip_tags($matches_categories['2']));
                        }
                        
                        
preg_match('/id="contents_post_tags">Tags: (.*?)</p>/'$content$matches_tags);
                          if (isset(
$matches_tags['1']) && !empty($matches_tags['1'])) {
                              
preg_match_all('/<a rel="nofollow" href="(.*?)" title="(.*?)">(.*?)</a>/'$matches_tags['1'], $matches_tag);
                              
$tags   = array();
                              if (isset(
$matches_tag['2'])) {
                                  foreach (
$matches_tag['2'] as $tag) {
                                      
$tags[] = strtolower(prepare_string($tag));
                                  }
        
                                  
$video['tags'] = implode(' '$tags);
                              }
                          }
                          
                          if (
$video['category'] && $video['tags']) {
                              
$video['embed'] = '<object type="application/x-shockwave-flash" data="http://www.pornerbros.com/player/videoplayer_embed.swf" width="'.$this->vcfg['embed_width'].'" height="'.$this->vcfg['embed_height'].'"><param name="movie" value="http://www.pornerbros.com/player/videoplayer_embed.swf" /><param name="allowfullscreen" value="true" /><param value="always" name="allowScriptAccess" /><param name="FlashVars" value="xmlfile=http://www.pornerbros.com/content/'.$video_id.'.xml?embed=true" /></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'].' (category, tags)!');
                              
$progress sprintf("%01.2f", ($progress+$incr));                                           
                            
$this->errors[] = 'Failed to get video details for '.$video['url'].' (category, tags)!';
                        }
                    } 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
Реклама