-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
200 lines (174 loc) · 8.64 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
include './config.php';
include './src/function.php';
print_r($head); //网页开头
echo '<body>';
include_once("./src/baidu_js_push.php");
print_r($header); //顶端导航
?>
<div id='content'>
<div id='head2'>
<?php
date_default_timezone_set("Asia/Shanghai");
if(isset($_COOKIE['search'])){
$searchs = unserialize($_COOKIE['search']);
print_r("<div><form action='./dx.php' method='POST'><p>继续上一次搜索<input type='hidden' type='text' name='wd' value=".$searchs[0]."> <input id='ipt' onmousemove='red(this)' onmouseout='black(this)' type='submit' value=".$searchs[0].">".date('Y/m/d/H:i',$searchs[1])."</p></form></div>");
}
if(isset($_COOKIE['dt'])){
$dt = unserialize($_COOKIE['dt']);
$n = $dt[1];
$file="./data/".$dt[0].".p"; //读出缓存
if(file_exists($file)){
$handle=fopen($file,'r');
$array=unserialize(fread($handle,filesize($file)));
print_r("<div><form action=\"./play.php\" method='POST'><p>继续上一次观看");
print_r("<input type=\"hidden\" name=\"wd\" value=".$dt[0].">");
print_r("<input type=\"hidden\" name=\"id\" value=".$n.">");
if(isset($_COOKIE['jishu'])){
print_r("<input type=\"hidden\" name=\"js\" value=".$_COOKIE['jishu'].">");
}
print_r("<input id='ipt' onmousemove='red(this)' onmouseout='black(this)' type=\"submit\" value=".$array[$n]['title'].@$array[$n]["tag"][$_COOKIE['jishu']]."></p></form></div>");
}
}
if(isset($_COOKIE['search1'])){
$searchs = unserialize($_COOKIE['search1']);
print_r("<div><form action='./dm.php' method='POST'><p>继续上一次搜索<input type='hidden' type='text' name='wd' value=".$searchs[0]."> <input id='ipt' onmousemove='red(this)' onmouseout='black(this)' type='submit' value=".$searchs[0].">".date('Y/m/d/H:i',$searchs[1])."</p></form></div>");
}
?>
</div>
<?php
$url = 'https://www.iqiyi.com/';
$name0=array("爱奇艺电影","爱奇艺电视剧");
$rlue1=array('/<div id="dianying" class="qy-mod-wrap-side">[\s\S]*?<\/p><\/div><\/div><\/li><\/ul>\s*?<\/div><\/div><\/div><\/div>/','/<div id="dianshiju" class="qy-mod-wrap-side">[\s\S]*?<\/p><\/div><\/div><\/li><\/ul>\s*?<\/div><\/div><\/div><\/div>/');
$rlue2='/<img src=".*\.j?pn?g" srcset="[^<]*alt="([^<]*)" class="qy-mod-cover">/';
function updata($url,$rlue1,$rlue2){
$html = curl_get($url);
preg_match_all($rlue1,$html,$py1);
preg_match_all($rlue2,$py1[0][0],$py2);
return $py2[1]; //名称集合
}
date_default_timezone_set("Asia/Shanghai");
for($i=0;$i<sizeof($rlue1);$i++){
$file="./data/aqy".$i.".dp";
//读出缓存
if(file_exists($file)){
$handle=fopen($file,'r');// 存在 读取内容
$aqy[$i]=unserialize(fread($handle,filesize($file)));
// 是否更新本地内容
$time=time()-filemtime($file);
if($time>86400){ // 缓存文件太久才会更新 86400 24H
$aqy[$i] = updata($url,$rlue1[$i],$rlue2);
if(false!==fopen($file,'w+')){
file_put_contents($file,serialize($aqy[$i]));//写入缓存
}
}
}
else{
$aqy[$i] = updata($url,$rlue1[$i],$rlue2);
// 并更新本地内容
if(false!==fopen($file,'w+')){
file_put_contents($file,serialize($aqy[$i]));//写入缓存
}
}
}
$url ="https://v.qq.com/";
// $name=array('腾讯电影','腾讯电视剧','腾讯综艺','腾讯动漫');
// $rlue1=array('/<div class="mod_hd mod_column_hd">\s*?<h2 class="mod_title">电影排行榜[\S\s]*?<\/span>\s*?<\/a>\s*?<\/div>\s*?<\/div>\s*?<\/div>\s*?<\/div>/','/<div class="mod_hd mod_column_hd">\s*?<h2 class="mod_title">电视剧频道排行[\S\s]*?<\/span>\s*?<\/a>\s*?<\/div>\s*?<\/div>\s*?<\/div>\s*?<\/div>/','/<div class="mod_hd mod_column_hd">\s*?<h2 class="mod_title">综艺排行榜[\S\s]*?<\/span>\s*?<\/a>\s*?<\/div>\s*?<\/div>\s*?<\/div>\s*?<\/div>/','/<div class="mod_hd mod_column_hd">\s*?<h2 class="mod_title">动漫排行榜[\S\s]*?<\/span>\s*?<\/a>\s*?<\/div>\s*?<\/div>\s*?<\/div>\s*?<\/div>/');
$name1=array('腾讯电影','腾讯电视剧');
$rlue1=array('/<div class="mod_hd mod_column_hd">\s*?<h2 class="mod_title">电影排行榜[\S\s]*?<\/span>\s*?<\/a>\s*?<\/div>\s*?<\/div>\s*?<\/div>\s*?<\/div>/','/<div class="mod_hd mod_column_hd">\s*?<h2 class="mod_title">电视剧频道排行[\S\s]*?<\/span>\s*?<\/a>\s*?<\/div>\s*?<\/div>\s*?<\/div>\s*?<\/div>/');
$rlue2='/<span class="rank_title">(.*?)<\/span>\s*?<span class="rank_desc">.*?<\/span>\s*?<span class="rank_update">[\s\S]*?<\/span>/';
for($i=0;$i<sizeof($rlue1);$i++){
$file="./data/txsp".$i.".dp";
//读出缓存
if(file_exists($file)){
$handle = fopen($file,'r');// 存在 读取内容 只建立网页 只API 只爬取
$txsp[$i] = unserialize(fread($handle,filesize($file)));
$time=time()-filemtime($file);
if($time>604800){ // 缓存文件太久才会更新 86400 24H*7 604800
$txsp[$i] = updata($url,$rlue1[$i],$rlue2);
if(false!==fopen($file,'w+')){
file_put_contents($file,serialize($txsp[$i]));//写入缓存
}
}
}
else{
$txsp[$i] = updata($url,$rlue1[$i],$rlue2);
if(false!==fopen($file,'w+')){
file_put_contents($file,serialize($txsp[$i]));//写入缓存
}
}
}
function drawlist($title){
for($i=0;$i<sizeof($title)&$i<10;$i++){
print_r('<li><a href="./dx.php?wd='.$title[$i].'" onmousemove="red(this)" onmouseout="black(this)" target="_blank" style="color: black;text-decoration:none;">'.($i+1).'.'.$title[$i].'</a></li>');
}
}
// 电影排行榜 爱奇艺、腾讯
print_r("<div id='movie'><ul id='movie-info' style='width:20px;'>电影热播排行榜</ul><ul id='movie-info'><li style='color: cornflowerblue;'>爱奇艺</li>");
drawlist($aqy[0]);
echo "</ul><ul id='movie-info'><li style='color: cornflowerblue;'>腾讯视频</li>";
drawlist($txsp[0]);
echo "</ul></div>";
// 电视剧排行 爱奇艺、腾讯
print_r("<div id='movie'><ul id='movie-info' style='width:20px;'>电视剧热播排行榜</ul><ul id='movie-info'><li style='color: cornflowerblue;'>爱奇艺</li>");
drawlist($aqy[1]);
echo "</ul><ul id='movie-info'><li style='color: cornflowerblue;'>腾讯视频</li>";
drawlist($txsp[1]);
echo "</ul></div>";
// 哔哩哔哩番剧榜
$url = "https://www.bilibili.com/v/popular/rank/bangumi";
// $url = "https://www.bilibili.com/v/popular/rank/guochan";
$rlue1 = '/<a href="\/\/www.bilibili.com\/bangumi\/play\/.*?" target="_blank" class="title">(.*?)<\/a>/';
$file="./data/everyday.dp";
//读出缓存
if(file_exists($file)){
$handle = fopen($file,'r');// 存在 读取内容 只建立网页 只API 只爬取
$title = unserialize(fread($handle,filesize($file)));
$time=time()-filemtime($file);
if($time>604800){ // 缓存文件太久才会更新 86400 24H*7 604800
$html = curl_get($url);
preg_match_all($rlue1,$html,$py1);
$title = $py1[1];
if(false!==fopen($file,'w+')){
file_put_contents($file,serialize($title));//写入缓存
}
}
}
else{
$html = curl_get($url);
preg_match_all($rlue1,$html,$py1);
$title = $py1[1];
if(false!==fopen($file,'w+')){
file_put_contents($file,serialize($title));//写入缓存
}
}
// print_r($title);
// 待添加 精彩推荐
print_r("<div id='movie'><ul id='movie-info'style='width:20px;'>其他</ul><ul id='movie-info'><li style='color: cornflowerblue;'>哔哩哔哩番剧榜</li>");
for($i=0;$i<5;$i++){
$title5[$i] = $title[$i];
}
drawlist($title5);
echo "</ul><ul id='movie-info'><li style='color: cornflowerblue;'>官方链接</li>";
// 爱奇艺、腾讯视频链接
print_r('
<li><a href="https://www.bilibili.com/" onmousemove="red(this)" onmouseout="black(this)" target="_blank" style="color: black;text-decoration:none;">哔哩哔哩</a></li>
<li><a href="https://www.iqiyi.com/" onmousemove="red(this)" onmouseout="black(this)" target="_blank" style="color: black;text-decoration:none;">爱奇艺</a></li>
<li><a href="https://v.qq.com/" onmousemove="red(this)" onmouseout="black(this)" target="_blank" style="color: black;text-decoration:none;">腾讯视频</a></li>
<li><a href="https://www.youku.com/" onmousemove="red(this)" onmouseout="black(this)" target="_blank" style="color: black;text-decoration:none;">优酷</a></li>
<li><a href="http://www.pptv.com/" onmousemove="red(this)" onmouseout="black(this)" target="_blank" style="color: black;text-decoration:none;">PPTV</a></li>
</ul></div>');
// 鼠标移动选择 变红特效
echo '<script>
function red(x){
x.style.color="red";
}
function black(x){
x.style.color="black";
}
</script>';
echo '</div>';
print_r($footer);
?>
</body>
</html>