国内高匿免费代理 爬虫代码

Lan
Lan
2021-11-27 / 2 评论 / 380 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年11月27日,已超过853天没有更新,若内容或图片失效,请留言反馈。

只爬了ip
结果

import requests
import parsel
import base64
import re

res = requests.get('http://ip.yqie.com/proxygaoni/index.htm')
res.encoding = 'utf-8'
for i in parsel.Selector(res.text).xpath("//tr/td[2]").extract():
    print(base64.b64decode(re.findall(f'window\.atob\("(.*?)"\)', i)[0]).decode())

新增一个lxml的xpath版本

import base64
import re

import requests
from lxml import etree

res = requests.get('http://ip.yqie.com/proxygaoni/index.htm')
res.encoding = 'utf-8'
for i in etree.HTML(res.text).xpath('//tr/td[2]/script'):
    print(base64.b64decode(re.findall(f'window\.atob\("(.*?)"\)', i.text)[0]).decode())
2

评论 (2)

取消
  1. 头像
    牛子
    Windows 10 · Google Chrome

    表情表情

    回复
    1. 头像
      桐谷和人
      Windows 10 · Google Chrome
      @ 牛子

      就很顶

      回复