Mysql数据库结构:用来存放采集的QQ信息。
QQ截图20190310164426.jpg

PHP文件(qq.php):用来处理返回的QQ信息
<?php
header("Content-Type: text/html; charset=UTF-8");
$qqnum = $_GET["qqnum"];

function send_post($url, $post_data) {
$postdata = http_build_query($post_data);
$options = array(

  'http' => array(
  'method' => 'POST',
  'header' => 
  "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n" . 
  "Cookie: uin=AAAAAAAAA;skey=AAAAAAAAA;\r\n", 
  'content' => $postdata,

));
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}

$post_data = array(
"keyword" => "$qqnum",
"ldw" => "BBBBBBBBB"
);

$str = send_post('http://cgi.find.qq.com/qqfind/buddy/search_v2', $post_data);
$arr = json_decode($str,true);

$uin = $arrresultinfo_list[uin];

//echo "<pre>";print_r($arr);echo "<pre>";查看返回数据,筛选有效数据

if($uin == $qqnum){
$birthday = $arrresultinfo_listbirthday."-".$arr[result][buddy][info_list][0][birthday][month]."-".$arrresultinfo_listbirthday;
$phone = $arrresultinfo_list[phone];
$college = $arrresultinfo_list[college];
$lnick = $arrresultinfo_list[lnick];
$city = $arrresultinfo_list[city];
$personal = $arrresultinfo_list[personal];
$province = $arrresultinfo_list[province];
$occupation = $arrresultinfo_list[occupation];
$gender = $arrresultinfo_list[gender];
$url = $arrresultinfo_list[url];
$homepage = $arrresultinfo_list[homepage];
$country = $arrresultinfo_list[country];
$nick = $arrresultinfo_list[nick];
$email = $arrresultinfo_list[email];
$wpa_ck = $arrresultinfo_list[wpa_ck];
$mobile = $arrresultinfo_list[mobile];

$con = mysql_connect("localhost","qqdata","CCCCCCCCC");
mysql_select_db("qqdata", $con);
mysql_query("INSERT INTO data (birthday,phone,college,uin,lnick,city,personal,province,occupation,url,homepage,country,nick,email,wpa_ck,mobile,gender) VALUES ('$birthday','$phone','$college','$uin','$lnick','$city','$personal','$province','$occupation','$url','$homepage','$country','$nick','$email','$wpa_ck','$mobile','$gender')");
mysql_close($con);
echo "user qq ".$uin." ok";
}
else{
echo "not user qq";
}
?>

需要你登陆mail.qq.com,获取uin和skey,并填写在对应AAAAAAAAA处。
需要您访问find.qq.com,抓取ldw参数,并填写在对应BBBBBBBBB处。
需要您填写mysql_connect函数中的数据库密码,并填写在对应CCCCCCCCC处。

start.py 用来赋值QQ并开始采集
#coding:utf-8
import urllib2
import re
import time
from bs4 import BeautifulSoup

line = 102486
while True:
page = urllib2.urlopen('http://qq.mimaz.org/qq.php?qqnum='+str(line))
contents = page.read()
print(contents)
time.sleep(1)
line = line + 1

链接请改为您的php文件存放链接,运行start.py
QQ截图20190310165227.jpg

采集的开始QQ号段为line数值。
QQ截图20190310170008.jpg

运行效果视频
20190306_224711.mp4

标签: none

仅有一条评论

  1. rabbit

    太厉害了

添加新评论