-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·78 lines (63 loc) · 2.32 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
<?php
use IceSweetPear\phpspider\ZSpider;
require './vendor/autoload.php';
require './autoload.php';
$file = fopen('./zzz.csv', 'w+');
$config = [
'start' => 'https://www.26jio.com',
'cache' => 'array',
'process' => 0,
'socket' => '',
];
$tasks = [
'%' => [
'name' => '1',
'page' => false,
'data' => [
'page' => function ($pageInfo) {
print_r(['1' => $pageInfo['url']]);
},
],
'nextUrlSub' => '<li><a href="@" class="contbl"><span>国产',
// 'nextRule' => '0',//0 0-3
'%' => [
'name' => '2',
'page' => true,
'data' => [
'page' => function ($pageInfo) {
print_r(['2' => $pageInfo['url']]);
},
],
'nextUrlSub' => '<a href="@" class="next pagegbk"',
'%' => [
'name' => '3',
'page' => false,
'data' => [
'page' => function ($pageInfo) {
},
],
'nextUrlSub' => '<a href="@" class="" target="_blank">',
'%' => [
'name' => '4',
'page' => false,
'data' => [
'page' => function ($pageInfo)use($file) {
print_r(['pageList' => $pageInfo['url']]);
$html = $pageInfo['html'];
$link = str_substr("var down_url = '", "';", $html, true);
$title = str_substr('<dd class="film_title"><h4>', "</h4></dd>", $html, true);
$link = str_replace('https://d.220zx.com/', 'https://992do09.com/', $link);
$data = [
$title,
$link
];
fputcsv($file, $data);
},
],
'nextUrlSub' => '',
],
],
],
],
];
(new ZSpider($config))->start($tasks);