Skip to content

Commit

Permalink
Revert "删除旧文件"
Browse files Browse the repository at this point in the history
This reverts commit 5ead902.
  • Loading branch information
yhf7952 committed Mar 25, 2018
1 parent 84f057d commit be7bddf
Show file tree
Hide file tree
Showing 13 changed files with 9,383 additions and 0 deletions.
1 change: 1 addition & 0 deletions .user.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
open_basedir=/www/wwwroot/php/:/tmp/:/proc/
182 changes: 182 additions & 0 deletions 91.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<?php
//error_reporting(0);
#引入模块
require 'lib/phpQuery.php';
require 'lib/QueryList.php';
require 'core/readHtml.php';
require "lib/Medoo.php";

use Medoo\Medoo;
use QL\QueryList;

$db = new medoo([
'database_type' => 'sqlite',
'database_file' => 'db/91.db'
]);

function getList($domain="http://www.91porn.com",$page = 1){

$jinghua = $_COOKIE["jinghua"];

$url = $domain."/video.php?". ($jinghua == 2 ? "" : "category=rf") ."&page=".$page;

//echo $url;

$html = readHtml($url);

//echo $html;

$html = preg_replace('/<span class="title">(.*)/', '', $html);

$rules = array(
//采集id为one这个元素里面的纯文本内容
'pic' => array('.imagechannelhd>a>img,.imagechannel>a>img','src'),
'title' => array('.imagechannelhd>a>img,.imagechannel>a>img','title'),
'link' => array('.imagechannelhd>a,.imagechannel>a','href'),
);
$data = QueryList::Query($html,$rules)->data;
//print_r($data);
return $data;
}


#获取URL
$domain="http://www.91porn.com";
if($_REQUEST["domain"]){
$domain = urldecode($_REQUEST["domain"]);
}
$page=1;
if($_REQUEST["page"]){
$page = $_REQUEST["page"];
}
$list = getList($domain,$page);
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<title>视频列表-91视频预览</title>
<!--<script type="text/javascript" src="http://tajs.qq.com/stats?sId=37342703" charset="UTF-8"></script>-->
<link rel="stylesheet" href="frozenui/css/frozen.css">
<link rel="stylesheet" href="frozenui/css/demo.css">
<script src="frozenui/lib/zepto.min.js"></script>
<!--<script src="frozenui/js/frozen.js"></script>-->
</head>
<body ontouchstart>
<header class="ui-header ui-header-positive ui-border-b">
<i class="ui-icon-return" onclick="history.back()"></i><h1>视频列表</h1><button onclick="window.location.href='index.php';" class="ui-btn">回首页</button>
</header>

<section class="ui-container">
<section id="panel">
<div class="demo-item">
<p class="demo-desc">第<b><?php echo $page?></b>页</p>


<div class="demo-block">
<div class="ui-form ui-border-t">
<form action="#">
<div class="ui-form-item ui-form-item-switch ui-border-b">
<p>
只看精华
</p>
<label class="ui-switch">
<input type="checkbox" id="jinghua" checked="">
</label>
</div>
</form>
</div>

<section class="ui-panel">
<ul class="ui-grid-trisect">
<?php
foreach ($list as $key => $value) { ?>
<li data-href="91v.php?title=<?php echo urlencode($value["title"]) ?>&url=<?php echo urlencode($value["link"]) ?>">
<div class="ui-border">
<div class="ui-grid-trisect-img">
<span style="background-image:url('<?php echo $value["pic"]?>')"></span>
</div>
<div style="padding: 2%">
<?php
//获取viewkey
$urlarr=parse_url($value["link"]);
parse_str($urlarr['query'],$parr);
$viewkey = $parr["viewkey"];

//判断数据库中是否有缓存
$dbResult=$db->select("videos","link",["url" => $viewkey]);
?>
<h4 class="ui-nowrap-multi" style="height:50px">
<?php
if($dbResult){
echo '<label class="ui-label" style="background-color: #5cb85c;color:white;">已缓存</label>';
}
echo $value["title"]
?></h4>
</div>
</div>
</li>
<?php } ?>

</ul>
</section>
</div>
</div>
</section>

<?php if($page>1){ ?>
<div><a href="91.php?page=<?php echo $page - 1 ?>&domain=<?php echo urlencode($domain) ?>" class="ui-btn-lg">上一页</a><br></div>
<?php } ?>
<a href="91.php?page=<?php echo $page + 1 ?>&domain=<?php echo urlencode($domain) ?>" class="ui-btn-lg ui-btn-primary">下一页</a>
</div>

</section>
<script src="https://cdn.bootcss.com/jquery/2.1.2/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script>

$("[data-href]").click(function(){
location.href = ($(this).data('href'));
});

$(function(){
$("#jinghua").click(function(){
$this = $(this);

if($this.is(":checked")){
$.cookie("jinghua","1");
}else{
$.cookie("jinghua","2");
}
location.reload();
});

if($.cookie("jinghua") == "2"){
$("#jinghua").removeAttr("checked");
}
});
</script>
</body>
</html>



















172 changes: 172 additions & 0 deletions 91v.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
<?php
//error_reporting(0);
#引入模块
require 'lib/phpQuery.php';
require 'lib/QueryList.php';
require 'core/readHtml.php';
require "lib/Medoo.php";
include "lib/Snoopy.class.php";
include "core/myfunction.php";

use Medoo\Medoo;
use QL\QueryList;

$db = new medoo([
'database_type' => 'sqlite',
'database_file' => 'db/91.db'
]);

//echo $_REQUEST["proxy"] ? 'tcp://'.$_REQUEST["proxy"] : '';

//根据地址,获取视频地址
function getList($url){

#获取URL
/*$url = $_REQUEST["url"];
$video=$db->select("videos","Video",["URL" => $url]);
if($data){
return $video[0]["Video"];
}*/

#$html = readHtml($url,urldecode($_REQUEST["proxyip"]));
$html = getHtml($url);

$rules = array(
//采集id为one这个元素里面的纯文本内容
'video' => array('source','src')
);
$data = QueryList::Query($html,$rules)->data;
//print_r($data);

$link = $data[0]["video"];

//print_r($db->id());
if($link){
global $db,$viewkey;

$db->insert("videos",[
"url" => $viewkey,
"link" => $link
]);
}


return $link;
}

//$video = getList();



function getHtml($url){

$ip = randIp();
$snoopy = new Snoopy;

#$snoopy->proxy_host = "165.227.104.78";
$snoopy->proxy_port = "3128";
#$snoopy->_isproxy = true;

$snoopy->cookies["PHPSESSID"] = 'fsef'; //伪装sessionid
#$snoopy->agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36"; //伪装浏览器
//$snoopy->referer = 'http://www.4wei.cn'; //伪装来源页地址 http_referer
$snoopy->rawheaders["Pragma"] = "no-cache"; //cache 的http头信息
$snoopy->rawheaders["Accept-language"] = "zh-cn"; //cache 的http头信息
$snoopy->rawheaders["Content-Type"] = "text/html; charset=utf-8"; //cache 的http头信息
$snoopy->rawheaders["CLIENT-IP"] = $ip; //伪装ip
$snoopy->rawheaders["HTTP_X_FORWARDED_FOR"] = $ip; //伪装ip
#$snoopy->fetch("http://www.checkip.net");
$snoopy->fetch($url);

return $snoopy->results;
}


#获取URL
$url = urldecode($_REQUEST["url"]);

$urlarr=parse_url($url);
parse_str($urlarr['query'],$parr);
$viewkey = $parr["viewkey"];

$dbResult=$db->select("videos","link",["url" => $viewkey]);

//print_r($dbResult);
//$video = '';

//数据在缓存中,直接取
if($dbResult){
//global $video;
$video = $dbResult[0];
$catch=true;
//echo $video;
}else{
global $video;
$video = getList($url);
//echo "src";
//$video = getVideo($url);
}

?>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<title>视频详情-91视频预览</title>
<link rel="stylesheet" href="frozenui/css/frozen.css">
<link rel="stylesheet" href="frozenui/css/demo.css">
</head>
<body>
<header class="ui-header ui-header-positive ui-border-b">
<i class="ui-icon-return" onclick="history.back()"></i><a href="91.php" style="position: absolute;left: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;列表页</a><h1>视频详情</h1><button onclick="window.location.href='index.php';" class="ui-btn">回首页</button>
</header>

<section class="ui-container">
<?php if($video){ ?>
<div class="ui-tooltips ui-tooltips-guide">
<div class="ui-tooltips-cnt ui-tooltips-cnt-link ui-border-b">
<i class="ui-icon-talk"></i><?php if($catch) echo "通过缓存"?>加载成功
</div>
</div>
<?php } ?>

<?php if(!$video){ ?>
<div class="ui-tooltips ui-tooltips-warn">
<div class="ui-tooltips-cnt ui-border-b">
<i></i>获取失败,请刷新重试
</div>
</div>

<?php } ?>

<p class="demo-desc"><?php echo urldecode($_REQUEST["title"]) ?></p>
<video width="100%" controls="controls">
<source src="<?php echo $video; ?>" type="video/mp4">
</video>
</section>
</body>
</html>



















Binary file added core/.DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions core/db.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

include("../Medoo.php");

use Medoo\Medoo;

$db = new medoo([
'database_type' => 'sqlite',
'database_file' => dirname(__FILE__).'/../db/91.db'
]);

/* $id = $db->insert("videos",[
"url"=>'aa',
"link"=>'bb',
]);
print_r($id);
*/
//$db->query("INSERT INTO videos ('url', 'link') VALUES ('aa', 'bb')");

print_r($db->select("videos","*"));
9 changes: 9 additions & 0 deletions core/myfunction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/*
* 获取随机IP地址,用于伪装
*/
function randIp(){
return rand(50,250).".".rand(50,250).".".rand(50,250).".".rand(50,250);
}

?>
Loading

0 comments on commit be7bddf

Please sign in to comment.