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 | < ?php
require 'phpQuery/phpQuery/phpQuery.php';
$loginurl='http://www.pixiv.net/index.php';
$pixiv_id='你的PIXIV_id';
$password='password';
//以上為一些登入基本資訊
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_USERAGENT,'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; (R1 1.5); InfoPath.2)');
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($curl, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_COOKIESESSION,true);
curl_setopt($curl, CURLOPT_URL, $loginurl);
curl_setopt($curl, CURLOPT_POSTFIELDS, 'mode=login&pixiv_id='.$pixiv_id.'&pass='.$password );
curl_exec($curl);
//登入的動作
$p=1;//設定起始頁
$bookmark_rest='show';//hide為非公開 show為公開
do{
$url='http://www.pixiv.net/bookmark.php?type=user&rest='.$bookmark_rest.'&p='.$p; //bookmark網址
curl_setopt($curl, CURLOPT_URL, $url);
$profile=curl_exec($curl);
phpQuery::newDocument($profile)->find('html > body > div#wrapper > div#pixiv > div#content2');
$title = pq('div[align="right"] > a') -> html();
preg_match('/次の(.*?)件/',$title,$match);
//是否有下一頁的判斷用
$title2 = pq('form#f > div[style="width:140px;height:120px;float:left;text-align:center;"]') -> html();
$title2=preg_replace('/\n/', '',$title2);
$title2=preg_replace('/<input (.*?)/>/', '',$title2);
$title2=preg_replace('/<img (.*?)/>/', '',$title2);
preg_match_all('/<a href="member.php\?id=(.*?)">< \/a><div style=\"padding-top:5px;\">(.*?)< \/div>/', $title2,$match2,PREG_SET_ORDER);
foreach ($match2 as $val) {
echo 'http://www.pixiv.net/member.php?id='.$val[1].' - '.$val[2]."\n";
}//映出所有的繪師
$p++;
}while(!empty($match));
curl_close($curl);
?>
|