feat: Add automatic short link resolution for b23.tv

- Use requests library to follow redirects and resolve b23.tv short links
- Automatically extract BV ID from resolved URL
- Support both short links and full URLs seamlessly
This commit is contained in:
OpenClaw Agent
2026-02-10 12:33:34 +08:00
parent 115d6e042e
commit d72090b957
+8 -1
View File
@@ -64,7 +64,14 @@ class LinkParser:
"""
# Check if it's a known short link pattern
if self.shortlink_resolver.is_bilibili_short_link(url):
return url
# Try to resolve using requests (follows redirects)
try:
import requests
response = requests.head(url, allow_redirects=True, timeout=10)
return response.url
except Exception:
# Fallback: return original URL
return url
return url