Файловый менеджер - Редактировать - /var/www/fetish/scrape/poopeegirls.php
Назад
<?php include('../core/init.php'); use \fetish\db; set_time_limit(0); //copy("http://funnyfilez.funnypart.com/funny_videos_files/FunnyPart-com-chopped_off_thumb_prank_.flv", 'files/test.flv'); foreach (range(6, 9) as $i) { $page = ($i == 1)?'':'-'.$i; echo $i.' - '; scrape_index_page('http://poopeegirls.com/page-'.$i.'.html'); } //scrape_index_page('http://poopeegirls.com/search/?q=alina'); //scrape_video_url('http://www.funnypart.com/funny/chainsaw-massacre.shtml'); function scrape_index_page($url) { $html = file_get_contents($url); preg_match_all("/<div class='thumb'><a href='(.*?)' title='(.*?)'>/s",$html,$matches); //Get URL foreach ($matches[0] as $k => $html) { //Check if the video already exists //$matches[1][$k]; $title = $matches[2][$k]; $source_uri = 'http://poopeegirls.com'.$matches[1][$k]; //echo $source_uri."\n\r"; //Get video URL scrape_video_url($source_uri, $source, $thumb, $file); //Save into Database $uri = rand(1000,9999).'-'.format_uri($title); $check = db::query("SELECT * FROM videos WHERE source_thumb = ?", [$thumb])->first(); if($check){ echo $source_uri.' - Already exists'."\n\r"; }else{ db::query("INSERT INTO videos (uid, title, uri, source_video, source_thumb, source_file, source_uri, source)VALUES(?,?,?,?,?,?,?,?)",[ 1, $title, $uri, $source, $thumb, $file, $source_uri, 'poopeegirls' ]); echo $source_uri."\n\r"; } //die('Done - '.$uri); } } function scrape_video_url($url, &$source, &$thumb, &$file) { $html = file_get_contents($url); preg_match_all("/<video id='video' src='(.*?)' poster='(.*?)' preload='metadata' loop controls><\/video>/s",$html,$matches); $source = $matches[1][0]; $thumb = $matches[2][0]; $parts = parse_url($source); parse_str($parts['query'], $query); $file = $query['f']; } 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
|
Настройка