文本混淆反爬 - SVG映射反爬虫

浏览器中显示的数字,在HTML中却没有,相应的地方存在着个数对等的 vhk08k 这种字符串,由此猜测数字 0-9 分别与一个 这种字符串 对应,映射解决

import requests
from scrapy import Selector

url = 'http://www.porters.vip/confusion/food.html'
response = requests.get(url)
html = Selector(text=response.text)
mappings = {'vhk08k': '0', 'vhk6zl': '1', 'vhk9or': '2', 'vhkfln': '3', 'vhkbvu': '4',
            'vhk84t': '5', 'vhkvxd': '6', 'vhkqsc': '7', 'vhkjj4': '8', 'vhk0f1': '9'
            }
class_values = html.xpath('//div[@class="col more"]/d/@class').extract()
number = ''
for i in class_values:
    number += mappings.get(i, '-')
print(number)

有问题请联系博主:
微信:hrvrap
qq:2580419087

你可能感兴趣的:(文本混淆反爬 - SVG映射反爬虫)