feat: Add mobile opus URL support for Bilibili
- Support m.bilibili.com/opus/{id} for dynamic posts
- Handle mobile URLs when resolving short links
This commit is contained in:
@@ -32,6 +32,7 @@ class LinkParser:
|
||||
BILIBILI_ARTICLE_PATTERN = re.compile(r'https?://(?:www\.)?bilibili\.com/(?:article|read)/([a-zA-Z0-9]+)')
|
||||
BILIBILI_SPACE_PATTERN = re.compile(r'https?://(?:space\.)?bilibili\.com/(\d+)')
|
||||
BILIBILI_MOBILE_SPACE_PATTERN = re.compile(r'https?://m\.bilibili\.com/space/(\d+)')
|
||||
BILIBILI_MOBILE_OPUS_PATTERN = re.compile(r'https?://m\.bilibili\.com/opus/(\d+)')
|
||||
BILIBILI_FAVLIST_PATTERN = re.compile(r'https?://(?:space\.)?bilibili\.com/\d+/favlist\?fid=(\d+)')
|
||||
BILIBILI_OPUS_PATTERN = re.compile(r'https?://(?:www\.)?bilibili\.com/opus/(\d+)')
|
||||
BILIBILI_SERIES_PATTERN = re.compile(r'https?://(?:space\.)?bilibili\.com/\d+/lists/(\d+)\?type=series')
|
||||
@@ -122,6 +123,15 @@ class LinkParser:
|
||||
"id": match.group(1)
|
||||
}
|
||||
|
||||
# Try mobile opus (移动端动态)
|
||||
match = self.BILIBILI_MOBILE_OPUS_PATTERN.match(url)
|
||||
if match:
|
||||
return {
|
||||
"platform": "bilibili",
|
||||
"type": "opus",
|
||||
"id": match.group(1)
|
||||
}
|
||||
|
||||
# Try video
|
||||
match = self.BILIBILI_VIDEO_PATTERN.match(url)
|
||||
if match:
|
||||
|
||||
Reference in New Issue
Block a user