影刀RPA 域名监控:Whois查询与抢注提醒 影刀RPA 域名监控Whois查询与抢注提醒作者林焱 | 适用人群影刀RPA新手 | 难度★★☆☆☆一、什么情况用这个公司品牌域名被抢注了、竞品注册了相似域名、手里的域名快过期忘了续费……这些事每家互联网公司都可能遇到。用影刀RPA定时查询域名Whois信息 → 监控到期时间 → 竞品域名动态追踪 → 发现域名释放立刻提醒。域名管理从「被动响应」变成「主动出击」。实际场景品牌保护监控相似域名、域名投资监控抢注机会、域名续费提醒、竞品域名动态分析。这篇文章能解决的问题Whois查询注册时间、到期时间、注册商域名到期自动续费提醒竞品域名注册动态监控域名释放通知抢注预警拼多多店群自动化上架方案二、怎么做2.1 环境准备影刀安装目录\python\python.exe-mpipinstallpython-whois2.2 影刀主流程┌──────────────────────────────────────────────┐ │ ① 【读取Excel】 │ │ 读取域名监控列表 │ │ ↓ │ │ ② 【遍历列表】 │ │ 对每个域名执行Whois查询 │ │ ↓ │ │ ③ 【条件判断】 │ │ 域名状态变化即将到期 │ │ ↓ │ │ ④ 【发送企业微信消息】 │ │ 推送域名动态 │ │ ↓ │ │ ⑤ 【写入Excel】 │ │ 更新域名监控台账 │ └──────────────────────────────────────────────┘2.3 核心代码importwhoisimportjsonfromdatetimeimportdatetime,timedeltadefquery_whois(domain,timeout10):查询域名Whois信息try:wwhois.whois(domain)# 提取关键信息info{domain:domain,registrar:w.registrarifw.registrarelse未知,creation_date:None,expiration_date:None,updated_date:None,name_servers:[],status:[],registrant:w.get(name,),}# 处理日期Whois返回的日期格式不统一defparse_date(d):ifisinstance(d,list):dd[0]# 取第一个ifisinstance(d,datetime):returnd.strftime(%Y-%m-%d)ifisinstance(d,str):# 尝试多种格式forfmtin[%Y-%m-%d,%d-%b-%Y,%Y/%m/%d]:try:returndatetime.strptime(d,fmt).strftime(%Y-%m-%d)except:passreturnstr(d)ifdelseNoneinfo[creation_date]parse_date(w.creation_date)info[expiration_date]parse_date(w.expiration_date)info[updated_date]parse_date(w.updated_date)# 域名服务器ifw.name_servers:info[name_servers]list(set(w.name_servers))# 域名状态ifw.status:ifisinstance(w.status,str):info[status][w.status]else:info[status]list(w.status)# 判断是否已注册# 如果creation_date为None域名可能未注册ifinfo[creation_date]isNone:info[registered]Falseelse:info[registered]True# 计算到期剩余天数ifinfo[expiration_date]:try:exp_datedatetime.strptime(info[expiration_date],%Y-%m-%d)info[days_until_expiry](exp_date.date()-datetime.now().date()).daysexcept:info[days_until_expiry]Nonereturninfoexceptwhois.parser.PywhoisErrorase:# 域名可能未注册return{domain:domain,registered:False,error:str(e),}exceptExceptionase:return{domain:domain,registered:None,error:f查询失败:{str(e)[:200]},}# 批量查询 # 从影刀Excel读取domains_to_monitor[{域名:example.com,类型:公司域名,负责人:张三},{域名:example.cn,类型:品牌保护,负责人:张三},{域名:competitor-product.com,类型:竞品监控,负责人:李四},]results[]forrowindomains_to_monitor:domainrow[域名]print(f查询{domain})infoquery_whois(domain)info[type]row.get(类型,)info[owner]row.get(负责人,)results.append(info)# 标注变化ifinfo[registered]:daysinfo.get(days_until_expiry,999)ifdaysisnotNoneanddays30:print(f ⚠️{domain}:{days}天后到期)else:print(f ✅{domain}: 正常 (到期{info[expiration_date]}))elifinfo[registered]isFalse:print(f {domain}: 未注册可注册)outputjson.dumps(results,ensure_asciiFalse)2.4 对比历史状态发现变化defcompare_whois(domain,current,previous_file):对比历史Whois发现变化# 从历史文件中读取上次的状态try:withopen(previous_file,r,encodingutf-8)asf:historyjson.load(f)except:history{}changes[]previoushistory.get(domain,{})# 比较注册商ifcurrent[registrar]!previous.get(registrar):changes.append(f注册商变更{previous.get(registrar,无)}→{current[registrar]})# 比较DNSold_nsset(previous.get(name_servers,[]))new_nsset(current.get(name_servers,[]))ifold_ns!new_ns:addednew_ns-old_ns removedold_ns-new_nsifadded:changes.append(f新增DNS{, .join(added)})ifremoved:changes.append(f移除DNS{, .join(removed)})# 比较到期日期ifcurrent.get(expiration_date)!previous.get(expiration_date):changes.append(f到期日期变更{previous.get(expiration_date,无)}→{current.get(expiration_date)})# 比较状态old_statusset(previous.get(status,[]))new_statusset(current.get(status,[]))ifold_status!new_status:changes.append(f状态变更{old_status}→{new_status})returnchanges2.5 域名抢注监控defmonitor_drop_catch(domains):监控域名是否进入删除期可抢注candidates[]fordomainindomains:infoquery_whois(domain)# 检查域名状态是否包含 pendingDelete 或 redemptionPeriodstatuses[s.lower()forsininfo.get(status,[])]forstatusinstatuses:ifpendingdeleteinstatus:# 域名即将释放可以抢注ifinfo.get(expiration_date):try:exp_datedatetime.strptime(info[expiration_date],%Y-%m-%d)# pendingDelete通常在过期后35-40天drop_dateexp_datetimedelta(days40)candidates.append({domain:domain,status:pendingDelete,estimated_drop_date:drop_date.strftime(%Y-%m-%d),priority:高,})except:passelifredemptionperiodinstatus:candidates.append({domain:domain,status:redemptionPeriod,priority:中,})returncandidates三、有什么坑坑1Whois查询频率限制各个注册局的Whois服务器都有频率限制同一个IP短时间内查询太多会触发限流。批量查询要做好间隔控制。importtimefordomainindomains:infoquery_whois(domain)results.append(info)time.sleep(2)# 每个查询间隔2秒防止触发限流坑2Whois数据格式不统一TEMU店群如何管理运营不同顶级域名的Whois返回格式完全不同。.com是一种格式.cn是另一种python-whois库尽力解析了但也不是100%兼容。如果解析失败可以手动解析原始文本importwhois wwhois.whois(example.cn)# 如果结构化数据解析不好直接看原始文本raww.textprint(raw)坑3WHOIS隐私保护很多域名开启了WHOIS隐私保护Privacy Protection你查到的registrant信息是被隐藏的。这不是你的问题而是域名持有者主动开启了隐私保护。坑4域名抢注的不确定性pendingDelete状态不等于一定会释放——原持有者可能在redemptionPeriod期间高价赎回。而且域名释放时间不是精确的是按注册局批量处理节奏来的。影刀监控只能给你「提醒」不能保证抢到。坑5python-whois在某些Windows环境下的问题有些Windows环境下python-whois安装后会缺少依赖如dnspython。# 如果安装后报错补装依赖pipinstallpython-whois dnspython总结影刀做域名监控核心是python-whois库定时查询。对比历史状态发现域名转移/续费/变更到期前30天提醒续费。域名抢注只能做「预警」不能保证「抢到」。批量查询注意限流间隔。

相关新闻

最新新闻

SerenityOS 命令行选项解析指南:getopt 与 getopt_long 用法、返回值与底层实现

SerenityOS 命令行选项解析指南:getopt 与 getopt_long 用法、返回值与底层实现

SerenityOS 命令行选项解析指南:getopt 与 getopt_long 用法、返回值与底层实现 【免费下载链接】serenity The Serenity Operating System 🐞 项目地址: https://gitcode.com/GitHub_Trending/se/serenity 导读 本文以 getopt(3) 手册 为核心&a…

2026/9/23 4:54:42
轻量服务器还是ECS?大促云服务器选购与避坑实战指南

轻量服务器还是ECS?大促云服务器选购与避坑实战指南

每年大促节点,群里永远有人在问同一个问题:“38元的轻量服务器到底怎么抢?为什么我每次点进去都是已售罄?68元直购和99元的ECS我到底选哪个?”作为一个常年帮团队和自己采购云服务器的老用户,我太清楚这种纠…

2026/9/24 14:25:52
为 AI 代理的 Review 动作编写 Cedar 审批门控策略:review-agent-governance 策略编写实战指南

为 AI 代理的 Review 动作编写 Cedar 审批门控策略:review-agent-governance 策略编写实战指南

为 AI 代理的 Review 动作编写 Cedar 审批门控策略:review-agent-governance 策略编写实战指南 【免费下载链接】agents Multi-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, and Google Antigravity 项目地址:…

2026/9/24 14:49:33
PaddleOCR 手写数学公式识别算法 CAN 实战指南:Counting-Aware Network 训练、评估与推理部署

PaddleOCR 手写数学公式识别算法 CAN 实战指南:Counting-Aware Network 训练、评估与推理部署

PaddleOCR 手写数学公式识别算法 CAN 实战指南:Counting-Aware Network 训练、评估与推理部署 【免费下载链接】PaddleOCR Turn any PDF or image document into structured data for your AI. A powerful, lightweight OCR toolkit that bridges the gap between i…

2026/9/23 8:01:38
Spring源码解析:构造器注入的类型转换与候选匹配机制

Spring源码解析:构造器注入的类型转换与候选匹配机制

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/9/24 14:28:18
openai-agents-python 多模型接入指南:深入解析 AnyLLMModel 适配层与 any-llm 路由

openai-agents-python 多模型接入指南:深入解析 AnyLLMModel 适配层与 any-llm 路由

openai-agents-python 多模型接入指南:深入解析 AnyLLMModel 适配层与 any-llm 路由 【免费下载链接】openai-agents-python A lightweight, powerful framework for multi-agent workflows 项目地址: https://gitcode.com/GitHub_Trending/op/openai-agents-pyth…

2026/9/24 11:09:24

日新闻

周新闻