def test_get_season_id(): media_id = "28223066" assert get_season_id(media_id=media_id) == "28770"
if episode_id := get_video_info(avid=avid)["episode_id"]: resource_id.episode_id = episode_id else: resource_id.avid = avid elif (bvid_match := regex.acg_video.bv.origin.match(args.url)) or \ (bvid_match := regex.acg_video.bv.short.match(args.url)): from bilili.api.acg_video import get_video_info bvid = bvid_match.group("bvid") if episode_id := get_video_info(bvid=bvid)["episode_id"]: resource_id.episode_id = episode_id else: resource_id.bvid = bvid elif media_id_match := regex.bangumi.md.origin.match(args.url): from bilili.api.bangumi import get_season_id media_id = media_id_match.group("media_id") resource_id.season_id = get_season_id(media_id=media_id) elif (episode_id_match := regex.bangumi.ep.origin.match(args.url)) or \ (episode_id_match := regex.bangumi.ep.short.match(args.url)): episode_id = episode_id_match.group("episode_id") resource_id.episode_id = episode_id elif (season_id_match := regex.bangumi.ss.origin.match(args.url)) or \ (season_id_match := regex.bangumi.ss.short.match(args.url)): season_id = season_id_match.group("season_id") resource_id.season_id = season_id else: print("视频地址有误!") sys.exit(1) if resource_id.avid or resource_id.bvid: from bilili.parser.acg_video import get_title, get_list, get_playurl bili_type = "acg_video"