Файловый менеджер - Редактировать - /var/www/fetish/scrape/heavy-r.php
Назад
<?php include('../core/init.php'); use \fetish\db; set_time_limit(0); /* $source_uri = 'https://www.heavy-r.com/video/116011/2_Girls_1_Cup/'; //Get video URL scrape_video_url($source_uri, $source, $thumb, $title); //Save into Database $uri = rand(1000,9999).'-'.format_uri($title); $name = $uri.'.mp4'; $fileUrl = file_get_contents($source); $fileLocation = 'poo/'.$name; $s3 = new AWS_S3(); if($s3->putObjectString($fileUrl, $_ENV['aws']['bucket'], $fileLocation) ) { //$info = AWS::getObjectInfo(awsBucket, $fileLocation, true); } $source_uri = $_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,'heavyr',date('Y-m-d H:i:s')]); echo 'Done - '.$source_uri; die(); */ foreach (range(1, 177) as $i) { $page = ($i == 1)?'':'-'.$i; echo $i.' - '; scrape_index_page('https://www.heavy-r.com/search/scat_'.$i.'.html'); } //scrape_index_page('https://www.heavy-r.com/search/scat_1.html'); function scrape_index_page($url) { $html = file_get_contents($url); preg_match_all('/\/video\/(.*?)\/(.*?)\/(.*?)/s',$html,$matches); $matches = array_unique($matches[0]); //Get URL foreach ($matches as $k => $val) { $source_uri = 'https://www.heavy-r.com'.$val; //Get video URL scrape_video_url($source_uri, $source, $thumb, $title); /* echo $source_uri .'<br>'; echo $source .'<br>'; echo $thumb .'<br>'; echo $title .'<br>';*/ //Save into Database $uri = rand(1000,9999).'-'.format_uri($title); $name = $uri.'.mp4'; $fileUrl = file_get_contents($source); $fileLocation = 'poo/'.$name; $s3 = new AWS_S3(); if($s3->putObjectString($fileUrl, $_ENV['aws']['bucket'], $fileLocation) ) { //$info = AWS::getObjectInfo(awsBucket, $fileLocation, true); } $source_uri = $_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,'heavyr',date('Y-m-d H:i:s')]); //echo 'Done - '.$source_uri; //die(); } } function scrape_video_url($url, &$source, &$thumb, &$title) { $html = file_get_contents($url); preg_match_all('/<h1 class="video-title">(.*?)<\/h1>/s',$html,$title); preg_match_all('/<video poster="(.*?)" id="video-file">(.*?)<\/video>/s',$html,$matches); preg_match_all('/<source type="video\/mp4" src="(.*?)">/s',$html,$video); $thumb = $matches[1][0]; $source = $video[1][0]; $title = trim($title[1][0]); } 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
|
Настройка