Skip to content

Commit

Permalink
🐛 fix: support festival link for batch download (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
SigureMo authored Oct 2, 2024
1 parent 9166610 commit 1b6eea8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/yutto/extractor/ugc_video_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class UgcVideoBatchExtractor(BatchExtractor):
REGEX_AV_ID = re.compile(r"av(?P<aid>\d+)(\?p=(?P<page>\d+))?")
REGEX_BV_ID = re.compile(r"(?P<bvid>(bv|BV)\w+)(\?p=(?P<page>\d+))?")

REGEX_BV_SPECIAL_PAGE = re.compile(r"https?://www\.bilibili\.com/festival/.+(?P<bvid>(bv|BV)\w+)")

avid: AvId

def resolve_shortcut(self, id: str) -> tuple[bool, str]:
Expand All @@ -47,7 +49,11 @@ def resolve_shortcut(self, id: str) -> tuple[bool, str]:
return matched, url

def match(self, url: str) -> bool:
if (match_obj := self.REGEX_AV.match(url)) or (match_obj := self.REGEX_BV.match(url)):
if (
(match_obj := self.REGEX_AV.match(url))
or (match_obj := self.REGEX_BV.match(url))
or (match_obj := self.REGEX_BV_SPECIAL_PAGE.match(url))
):
if "aid" in match_obj.groupdict().keys():
self.avid = AId(match_obj.group("aid"))
else:
Expand Down

0 comments on commit 1b6eea8

Please sign in to comment.