代码拉取完成,页面将自动刷新
# encoding: utf-8
# Datetime : 2020/6/1 8:22 PM
# User : zzz
# File : test.py
import requests
import json
from lxml import etree
import discuss_spider
from util import proxy_util
HEADERS = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.100 Safari/537.36',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'none',
'Sec-Fetch-User': '?1',
'Upgrade-Insecure-Requests': '1',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
}
# url = 'https://www.discuss.com.hk/forumdisplay.php?fid=415&filter=0&orderby=dateline&ascdesc=DESC&page=1'
url = 'http://www.cip.cc/'
response = discuss_spider.get_response(url)
# response = requests.get(url, headers=HEADERS, proxies=proxy_util.get_proxy(), timeout=60)
html_res = etree.HTML(response.text)
ip_info = html_res.xpath('//div[@class="data kq-well"]/pre')
if ip_info:
print(ip_info[0].text)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。