Вход Регистрация
Файл: adultscript-2.0.3-pro/files/admin/modules/grab/grabers/manhub.php
Строк: 93
<?php
defined
('_VALID') or die('Restriced Acess!');
define('_RESIZE_THUMB'TRUE);
class 
VComponent_Admin_grab_manhub 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('/<p class="">(.*?)</p>/'$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'        => 'manhub',
                        
'url'        => '',
                        
'title'        => '',
                        
'desc'        => '',
                        
'tags'      => '',
                        
'category'    => '',
                        
'thumbs'    => array(),
                        
'duration'    => 0,
                        
'embed'        => '',
                        
'size'        => 0,
                        
'file_url'    => ''
                    
);
                    
                    
preg_match('/<a href="(.*?)" class="vidoverlay1" 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.manhub.com'.trim($matches_url['1']);
                        
$video['title']    = strip_tags(trim($matches_url['2']));
                        
$this->update_progress($progress.'^Processing '.$video['url'].' ...');
                        if (
$this->already_added('pornhub'$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('/<b class="v-duration rcorner">(.*?)</b>/'$match$matches_duration);
                      if (isset(
$matches_duration['1'])) {
                          
$video['duration'] = $this->duration_to_seconds($matches_duration['1']);
                      }
                    
                    
preg_match('/<img src="(.*?)" onmouseover/'$match$matches_thumb); 
                    if (isset(
$matches_thumb['1']) && !empty($matches_thumb['1'])) {
                        
$thumb_url            trim($matches_thumb['1']);
                        
$thumb_url            substr($thumb_url0strrpos($thumb_url'_'));
                        
preg_match('/value="(.*?)" />/'$match$matches_names);
                        if (isset(
$matches_names['1']) && !empty($matches_names['1'])) {
                            
$thumbs                trim($matches_names['1']);
                            
$thumbs                explode(','$thumbs);
                            
$video['thumbs']    = array();
                            foreach (
$thumbs as $thumb) {
                                
$video['thumbs'][] = $thumb_url.'_'.$thumb.'.jpg';
                            }
                        }
                      }
                      
                    if (
$video['url'] && $video['title'] && $video['duration'] && $video['thumbs']) {
                        
$content $this->clean_html(VCurl::string($video['url']));
                        
preg_match('/Tags: (.*?)<br>/'$content$matches_tags);
                          if (isset(
$matches_tags['1'])) {
                              
preg_match_all('/<a href="(.*?)" >(.*?)</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);
                              }
                          }
                          
                          
preg_match('/Category: <a href="(.*?)" >(.*?)</a>/'$content$matches_category);
                          if (isset(
$matches_category['2']) && $matches_category['2']) {
                              
$video['category'] = trim($matches_category['2']);
                          }
                          
                          
preg_match('/<iframe width="655" height="525" scrolling="no" src="(.*?)" frameborder="0"></iframe>/'$content$matches_embed);
                          if (isset(
$matches_embed['1']) && !empty($matches_embed['1'])) {
                              
$embed_url trim($matches_embed['1']);
                          }

                        
$video['embed'] = '<iframe width="'.$this->vcfg['embed_width'].'" height="'.$this->vcfg['embed_height'].'" scrolling="no" src="'.$embed_url.'" frameborder="0"></iframe>';
                        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'].'!';
                    }
                }
            } 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;
    }
}
Онлайн: 1
Реклама