Файловый менеджер - Редактировать - /var/www/fetish/scrape/xpee.php
Назад
<?php include('../core/init.php'); use \fetish\db; set_time_limit(0); foreach (range(0, 462) as $i) { //$page = ($i == 1)?'':'-'.$i; echo $i.' - '; $page = $i * 30; scrape_index_page('http://www.xpee.com/videos/category/23/girls-pooping/0/0/'.$page); } //scrape_index_page('http://www.xpee.com/videos/category/23/girls-pooping/0/0/13860'); function scrape_index_page($url) { echo 'Scraping - '.$url."\r\n"; $html = file_get_contents($url); preg_match_all('/<a class="avideothumb" data-video-id="(.*?)" href="(.*?)" title="(.*?)">/s',$html,$matches); //print_r($matches); //Get URL foreach ($matches[1] as $key => $val) { if(!empty($matches[3][$key])){ $id = $matches[1][$key]; $source_uri = $matches[2][$key]; $source = 'http://www.xpee.com/application/assets/videos/'.$id.'/video.mp4'; $thumb = 'http://www.xpee.com/application/assets/videos/'.$id.'/preview.jpg'; $title = $matches[3][$key]; //echo $source_uri .'<br>'; //echo $source .'<br>'; //echo $thumb .'<br>'; //echo $title .'<br>'."\r\n"; $uri = rand(1000,9999).'-'.format_uri($title); // Create a stream /*$opts = [ "http" => [ "method" => "GET", "header" => "Accept-language: en\r\n" . "Accept-Encoding: identity;q=1, *;q=0\r\n" . "Referer: ".$source_uri."\r\n" . "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36\r\n" ] ]; $context = stream_context_create($opts); // Open the file using the HTTP headers set above $file = file_get_contents($source, false, $context); //$fileUrl = file_get_contents($source); $fileLocation = 'pee/'.$uri; $s3 = new AWS_S3(); if($s3->putObjectString($file, $_ENV['aws']['bucket'], $fileLocation) ) { //$info = AWS::getObjectInfo(awsBucket, $fileLocation, true); } $source = $_ENV['aws']['cloudfront_url'].$fileLocation; db::query("INSERT INTO videos (title, uri, source_video, source_thumb, source_uri, source, date_fetched)VALUES(?,?,?,?,?,?,?)", [$title,$uri,$source,$thumb,$source_uri,'xpee',date('Y-m-d H:i:s')]);*/ db::query("INSERT INTO queue (title, uri, source_video, source_thumb, source_uri, source, date_created)VALUES(?,?,?,?,?,?,?)", [$title,$uri,$source,$thumb,$source_uri,'xpee',date('Y-m-d H:i:s')]); } } } function format_uri( $string, $separator = '-' ) { $accents_regex = '~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i'; $special_cases = array( '&' => 'and', "'" => ''); $string = strtolower( trim( $string ) ); $string = str_replace( array_keys($special_cases), array_values( $special_cases), $string ); $string = preg_replace( $accents_regex, '$1', htmlentities( $string, ENT_QUOTES, 'UTF-8' ) ); $string = preg_replace("/[^a-z0-9]/u", "$separator", $string); $string = preg_replace("/[$separator]+/u", "$separator", $string); return $string; } ?>
| ver. 1.4 |
Github
|
.
| PHP 7.0.33-0ubuntu0.16.04.16 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка