前言
大众点评拥有大量高质量评论信息、种草信息,同时也有非常严格的反扒机制。
今天我们一起使用 Python破解大众点评字体加密,获取极具商业价值的信息。
本文知识点:
requests 的使用xpath 的使用svg 字体处理开发环境:
解释器: Python 3.6.5 | Anaconda, Inc.编辑器: pycharm 专业版目标地址
http://www.dianping.com/shop/130096343/review_all代码
导入工具
kie", "Host": "www.dianping.com", "Referer": "http://www.dianping.com/shop/130096343/review_all", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36", } import requests import re 获取数据 # ctrl + r headers = { "Cookie": "加上自己的coo response = requests.get('http://www.dianping.com/shop/130096343/review_all', headers=headers) # http://www.dianping.com/shop/130096343/review_all print(response.text) with open('01 网页数据_加密.html', mode='w', encoding='utf-8') as f: f.write(response.text) css_url = re.findall('<link rel="stylesheet" type="text/css" href="(//s3plus.meituan.*?)">', response.text) css_url = 'http:' + css_url[0] css_response = requests.get(css_url) with open('02 css样式.css', mode='w', encoding='utf-8') as f: f.write(css_response.text) print(css_response.text) svg_url = re.findall(r'svgmtsi\[class\^="eb"\].*?background-image: url\((.*?)\);', css_response.text) svg_url = 'http:' + svg_url[0] svg_response = requests.get(svg_url) with open('03 svgy隐射表.svg', mode='w', encoding='utf-8') as f: f.write(svg_response.text) print(svg_url) 加python学习qq群:775690737 送python零基础入门学习资料+99个源码详细项目视频讲解地址
https://www.bilibili.com/video/BV1uC4y1t78d/