I collected Banhua's spatial data set in Python. In addition to meizhao, I found her other secrets again!

Five packs of spicy strips! 2021-09-15 12:35:32
collected banhua spatial data set

Hello everyone , I'm spicy .

My roommate knows that I repaired the computer for ban Hua last time , Chased me three blocks , He scolded me for being an unworthy son , Blame me for not taking him . Finally, he licked his face and begged me for a move , This product wants to chase ban Hua ! Spicy, I'm for the two brothers ( closed ) rib ( money ) insert ( do ) The knife ( things ), I agreed without hesitation . But I only have class flowers QQ And wechat , Then start with what she usually sends , Hence the article , But in the end, I found another secret of her !

Collect data target

website :QQ Space  Insert picture description here

Tool use

development environment :win10、python3.7 development tool :pycharm、Chrome tool kit :selenium,re,time

Focus on learning

  • selenium Use -gtk Encryption method of - Acquisition of data information


selenium To test tools, you need to configure and install drivers first Bloggers use chorme browser , download chormedrive Driver download address Driver download address When the download is complete, the driver exe Put it in Python The installation directory  Insert picture description here

Analysis of project ideas

control selenium Sign in QQ Space

    driver = webdriver.Chrome()  # This is chormedriver The address of
   driver.find_element_by_id('u').send_keys("QQ Number ")  
   driver.find_element_by_id('p').send_keys(“QQ password ”)  

Get friends QQ Nicknames and QQ name  Insert picture description here g_tk Find the encryption method for the encryption parameters  Insert picture description here  Insert picture description here g_tk The value is cookie Value for encryption p_skey The value of  Insert picture description here adopt selenium Extract to the current web page cookie value  Insert picture description here Python Decryption code

def getGTK(cookie):
   hashes = 5381
   for letter in cookie['p_skey']:
       hashes += (hashes << 5) + ord(letter)
   return hashes & 0x7fffffff
cookie = {}  # initialization cookie Dictionaries
for elem in driver.get_cookies():  # take cookies
   cookie[elem['name']] = elem['value']
gtk = tool.getGTK(cookie)  # adopt getGTK Function calculation gtk

Get friends QQ There are many ways to , Only if you can extract it Get links to friends' information  Insert picture description here Get linked data information  Insert picture description here

Simple source code display

import json
import re
from selenium import webdriver
import time
def getGTK(cookie):
hashes = 5381
for letter in cookie['p_skey']:
hashes += (hashes << 5) + ord(letter)
return hashes & 0x7fffffff
# Keywords that encapsulate functions
def start_spider():
driver = webdriver.Chrome()
# time.sleep(10)
# time.sleep(5)
driver.find_element_by_name('u').send_keys('qq Number ')
# time.sleep(5)
driver.find_element_by_name('p').send_keys('qq password ')
cookie = {}
for i in driver.get_cookies():
cookie[i['name']] = i['value']
gtk = getGTK(cookie)
driver.get('https://user.qzone.qq.com/proxy/domain/r.qzone.qq.com/cgi-bin/tfriend/friend_hat_get.cgi?hat_seed=1&uin=1727948159fupdate=2&g_tk=' + str(
gtk) + '&qzonetoken=e794139a284d6ea9e0b26826e541b55df37d0667a3544f534de25aebdb64628d3ab75e1d7104bbb22a' + '&g_tk=' + str(
friend_list = driver.page_source
# print(friend_list)
abtract_pattern = '''"(.*?)":{
qq_name_list = re.findall(abtract_pattern, str(friend_list)) # Array
for qq_info in qq_name_list:
qq_num = qq_info[0]
qq_name = qq_info[1]
if qq_num == " other party QQ Number ": # I only got one
count = 0
begin = 0
driver.get('https://user.qzone.qq.com/proxy/domain/taotao.qq.com/cgi-bin/emotion_cgi_msglist_v6?uin=' + qq_num + '&ftype=0&sort=0&pos=' + str(
begin) + '&num=40&replynum=200&g_tk=' + str(
gtk) + '&callback=_preloadCallback&code_version=1&format=jsonp&need_private_comment=1&qzonetoken=e794139a284d6ea9e0b26826e541b55df37d0667a3544f534de25aebdb64628d3ab75e1d7104bbb22a&g_tk=' + str(
msg_json = driver.page_source
# print(msg_json)
msg_json_list = re.findall('_preloadCallback\((.*?)\);', str(msg_json))
data = json.loads(msg_json_list[0])
# print(data)
for text in data['msglist']:
content = text['content']
createTime = text['createTime']
f = open("shuoshuo.text", "a", encoding="utf-8")
f.write('{},{},{},{}\n\n'.format(qq_num, qq_name, createTime, content))

Renderings show




I successfully climbed down the data of class flower space , Mainly about the content of , Through her words I found out that she likes Wang Junkai , And it's the kind of iron powder , Now my roommate is dead , Ah, poor boy ...

PS: Purely technical exchange and learning , All the data captured are public data , No illegal profit-making , Finally, my roommate gave me the money to invite him to dinner and drink 【 Everyone has had this time 】, Finally, I would like to remind you , Do not use reptiles for illegal operations , Be sure to obey the law !

本文为[Five packs of spicy strips!]所创,转载请带上原文链接,感谢

  1. Realizing the function of sending e-mail automatically with Python
  2. Smtpauthenticationerror in Python: solution
  3. 8 steps to teach you how to solve Sudoku in Python! (including source code)
  4. Python change la vie | identifier facilement des centaines de numéros de livraison
  5. Python change life | utilisation de modèles reconnus par ocr
  6. Bibliothèques Python utiles et intéressantes - - psutil
  7. 3. Traitement des données pandas
  8. 【Python编程基础】控制流之链式比较运算符
  9. MFC uses Python scripting language
  10. 【Python編程基礎】控制流之鏈式比較運算符
  11. 【 base de programmation python】 opérateur de comparaison de chaîne pour le flux de contrôle
  12. Python game development, pyGame module, python implementation of Xiaole games
  13. Mise en œuvre du Code de vérification unique (OTP) avec le cadre de repos Django
  14. Python - eval ()
  15. Python - Programmation orientée objet - _Rapport()
  16. Différence entre python - rep (), Str ()
  17. Python - Programmation orientée objet - _Appel()
  18. Python calling matlab script
  19. Python - Programmation orientée objet - _Nouveau() et mode Singleton
  20. Python - Programmation orientée objet - méthode magique (méthode de double soulignement)
  21. Python - Programmation orientée objet - pratique (6)
  22. Python - Programmation orientée objet - réflexion hasattr, GetAttr, GetAttr, delattr
  23. Python - Programmation orientée objet - _Dict
  24. Python - pydantic (2) Modèle imbriqué
  25. Non-ASCII character ‘\xe5‘ in file kf1.py on line 4, but no encoding declared; see http://python.or
  26. python笔记(一)
  27. Non - ASCII character 'xe5' in file kf1.py on Line 4, but no Encoding declared;Voirhttp://python.or
  28. Notes Python (1)
  29. Talk about how JMeter executes Python scripts concurrently
  30. In Beijing, you can't see the moon in the Mid Autumn Festival. Draw a blood red moon in Python
  31. Un des pandas crée un objet
  32. Machine learning | unitary regression model Python practical case
  33. Draw a "Lollipop chart" with Excel and python
  34. Python uses scikit learn to calculate TF-IDF
  35. Getting started with Python Basics_ 3 conditional statements and iterative loops
  36. Python dynamic properties and features
  37. 云计算开发:Python内置函数-min()函数详解
  38. [Python skill] how to speed up loop operation and numpy array operation
  39. 雲計算開發:Python內置函數-min()函數詳解
  40. Développement de l'informatique en nuage: explication détaillée de la fonction intégrée python - min ()
  41. 从0起步学Python(附程序实例讲解)第1讲
  42. 从0起步学Python(附程序实例讲解)第1讲
  43. Apprendre Python à partir de 0 (avec des exemples de programme) leçon 1
  44. Apprendre Python à partir de 0 (avec des exemples de programme) leçon 1
  45. With Python, I'll take you to enjoy it for a month when the Mid Autumn Festival is coming
  46. You can't write interface software in Python! Which software on sale has no UI?
  47. Python国内外原题解析及源码1~15
  48. Python实现长篇英文自动纠错~
  49. Python implémente la correction automatique des erreurs en anglais long
  50. Analyse des problèmes originaux et code source de Python au pays et à l'étranger 1 ~ 15
  51. 一张思维导图学Python之表白
  52. Python教学中课程思政建设的研究探索2
  53. Recherche sur la construction idéologique et politique du Programme d'études dans l'enseignement Python 2
  54. Une présentation de la cartographie mentale Python
  55. Python高级用法总结(8)-函数式编程
  56. Python + Mirai development QQ robot starting tutorial (2021.9.9 test is valid)
  57. Python Advanced use Summary (8) - functional Programming
  58. How to get started with Python and share learning methods for free. All you want to know is here
  59. Python + Mirai development QQ robot starting tutorial (2021.9.9 test is valid)
  60. Python基础第1讲(含代码、Python最新安装包、父与子的编程之旅:与小卡特一起学Python中文版)