当前位置:网站首页>Crawler for querying nicknames and avatars based on qqwebapi
Crawler for querying nicknames and avatars based on qqwebapi
2022-04-23 18:00:00 【Round programmer】
API See for details QQWEB file .
Environmental Science python3.8+win
import requests
import re
from PIL import Image
from io import BytesIO
def getQQPhoto(qqCode):
url ="https://q4.qlogo.cn/g?b=qq&nk={}&s=100".format(qqCode)
headers = {
'Referer': 'http://pic.netbian.com/4kmeinv/index_2.html',
'user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'
}
response = requests.get(url = url, headers = headers).content
# take bytes The result is converted to a byte stream
bytes_stream = BytesIO (response)
# Read picture
roiimg = Image.open(bytes_stream)
roiimg.show() # Show pictures
def getQQName(qqCode):
url = 'http://r.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?g_tk=1518561325&uins=' + qqCode
headers = {
'Referer': 'http://pic.netbian.com/4kmeinv/index_2.html',
'user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'
}
response = requests.get(url = url, headers = headers).text
response= response.encode('iso-8859-1').decode('gbk')
r = re.findall(',"(.*?)",0]}\)', response)[0]
print("NickName: ", r)
if __name__ == '__main__':
nums = list(map(str, input(" Please enter QQ Number ( Separate spaces between multiple signs ):").split()))
for num in nums:
getQQName(num)
getQQPhoto(num)
版权声明
本文为[Round programmer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230545315678.html
边栏推荐
- 消费者灰度实现思路
- 极致体验,揭晓抖音背后的音视频技术
- Tensorflow tensor introduction
- Go file operation
- 20222 return to the workplace
- Open source key component multi_ Button use, including test engineering
- Halo open source project learning (II): entity classes and data tables
- 列錶的使用-增删改查
- Calculation of fishing net road density
- Multi thread crawling Marco Polo network supplier data
猜你喜欢
Land cover / use data product download
2022 Shanghai safety officer C certificate operation certificate examination question bank and simulation examination
[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)
How to install jsonpath package
.104History
Error in created hook: "referenceerror:" promise "undefined“
Go的Gin框架学习
Solving the problem of displaying too many unique values in ArcGIS partition statistics failed
Data stream encryption and decryption of C
2022江西光伏展,中国分布式光伏展会,南昌太阳能利用展
随机推荐
On the method of outputting the complete name of typeID from GCC
Arcpy adds fields and loop assignments to vector data
Operation of 2022 mobile crane driver national question bank simulation examination platform
C language input and output (printf and scanf functions, putchar and getchar functions)
.104History
Halo 开源项目学习(二):实体类与数据表
Cloud native Virtualization: building edge computing instances based on kubevirt
Summary of common server error codes
Logic regression principle and code implementation
cv_ Solution of mismatch between bridge and opencv
Realsense selection comparison d455 d435i d415 t265 3D hardware comparison
Uniapp custom search box adaptation applet alignment capsule
Add animation to the picture under V-for timing
[appium] write scripts by designing Keyword Driven files
Operators in C language
[UDS unified diagnostic service] IV. typical diagnostic service (6) - input / output control unit (0x2F)
Scikit learn sklearn 0.18 official document Chinese version
Flash operates on multiple databases
journal
Data stream encryption and decryption of C