import 'dart:convert'; class VideoDetailResponse { int? code; String? message; int? ttl; VideoDetailData? data; VideoDetailResponse({ this.code, this.message, this.ttl, this.data, }); VideoDetailResponse.fromJson(Map json) { code = json["code"]; message = json["message"]; ttl = json["ttl"]; data = json["data"] == null ? null : VideoDetailData.fromJson(json["data"]); } Map toJson() { final Map data = {}; data["code"] = code; data["message"] = message; data["ttl"] = ttl; data["data"] = data; return data; } } class VideoDetailData { String? bvid; int? aid; int? videos; int? tid; String? tname; int? copyright; String? pic; String? title; int? pubdate; int? ctime; String? desc; List? descV2; int? state; int? duration; Map? rights; Owner? owner; Stat? stat; String? videoDynamic; int? cid; Dimension? dimension; dynamic premiere; int? teenageMode; bool? isChargeableSeason; bool? isStory; bool? noCache; List? pages; Subtitle? subtitle; // Label? label; UgcSeason? ugcSeason; bool? isSeasonDisplay; UserGarb? userGarb; HonorReply? honorReply; String? likeIcon; bool? needJumpBv; String? epId; VideoDetailData({ this.bvid, this.aid, this.videos, this.tid, this.tname, this.copyright, this.pic, this.title, this.pubdate, this.ctime, this.desc, this.descV2, this.state, this.duration, this.rights, this.owner, this.stat, this.videoDynamic, this.cid, this.dimension, this.premiere, this.teenageMode, this.isChargeableSeason, this.isStory, this.noCache, this.pages, this.subtitle, this.ugcSeason, this.isSeasonDisplay, this.userGarb, this.honorReply, this.likeIcon, this.needJumpBv, this.epId, }); VideoDetailData.fromJson(Map json) { bvid = json["bvid"]; aid = json["aid"]; videos = json["videos"]; tid = json["tid"]; tname = json["tname"]; copyright = json["copyright"]; pic = json["pic"]; title = json["title"]; pubdate = json["pubdate"]; ctime = json["ctime"]; desc = json["desc"]; descV2 = json["desc_v2"] == null ? [] : List.from(json["desc_v2"]!.map((e) => DescV2.fromJson(e))); state = json["state"]; duration = json["duration"]; rights = Map.from(json["rights"]!).map((k, v) => MapEntry(k, v)); owner = json["owner"] == null ? null : Owner.fromJson(json["owner"]); stat = json["stat"] == null ? null : Stat.fromJson(json["stat"]); videoDynamic = json["dynamic"]; cid = json["cid"]; dimension = json["dimension"] == null ? null : Dimension.fromJson(json["dimension"]); premiere = json["premiere"]; teenageMode = json["teenage_mode"]; isChargeableSeason = json["is_chargeable_season"]; isStory = json["is_story"]; noCache = json["no_cache"]; pages = json["pages"] == null ? [] : List.from(json["pages"]!.map((e) => Part.fromJson(e))); subtitle = json["subtitle"] == null ? null : Subtitle.fromJson(json["subtitle"]); ugcSeason = json["ugc_season"] != null ? UgcSeason.fromJson(json["ugc_season"]) : null; isSeasonDisplay = json["is_season_display"]; userGarb = json["user_garb"] == null ? null : UserGarb.fromJson(json["user_garb"]); honorReply = json["honor_reply"] == null ? null : HonorReply.fromJson(json["honor_reply"]); likeIcon = json["like_icon"]; needJumpBv = json["need_jump_bv"]; if (json['redirect_url'] != null) { epId = resolveEpId(json['redirect_url']); } } String resolveEpId(url) { RegExp regex = RegExp(r'\d+'); Iterable matches = regex.allMatches(url); List numbers = []; for (Match match in matches) { numbers.add(match.group(0)!); } return numbers[0]; } Map toJson() => { "bvid": bvid, "aid": aid, "videos": videos, "tid": tid, "tname": tname, "copyright": copyright, "pic": pic, "title": title, "pubdate": pubdate, "ctime": ctime, "desc": desc, "desc_v2": descV2 == null ? [] : List.from(descV2!.map((e) => e.toJson())), "state": state, "duration": duration, "rights": Map.from(rights!).map((k, v) => MapEntry(k, v)), "owner": owner?.toJson(), "stat": stat?.toJson(), "dynamic": videoDynamic, "cid": cid, "dimension": dimension?.toJson(), "premiere": premiere, "teenage_mode": teenageMode, "is_chargeable_season": isChargeableSeason, "is_story": isStory, "no_cache": noCache, "pages": pages == null ? [] : List.from(pages!.map((e) => e.toJson())), "subtitle": subtitle?.toJson(), "is_season_display": isSeasonDisplay, "user_garb": userGarb?.toJson(), "honor_reply": honorReply?.toJson(), "like_icon": likeIcon, "need_jump_bv": needJumpBv, }; } class DescV2 { String? rawText; int? type; int? bizId; DescV2({ this.rawText, this.type, this.bizId, }); fromRawJson(String str) { return DescV2.fromJson(json.decode(str)); } String toRawJson() => json.encode(toJson()); DescV2.fromJson(Map json) { rawText = json["raw_text"]; type = json["type"]; bizId = json["biz_id"]; } Map toJson() { final Map data = {}; data["raw_text"] = rawText; data["type"] = type; data["biz_id"] = bizId; return data; } } class Dimension { int? width; int? height; int? rotate; Dimension({ this.width, this.height, this.rotate, }); fromRawJson(String str) => Dimension.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); Dimension.fromJson(Map json) { width = json["width"]; height = json["height"]; rotate = json["rotate"]; } Map toJson() { final Map data = {}; data["width"] = width; data["height"] = height; data["rotate"] = rotate; data["data"] = data; return data; } } class HonorReply { List? honor; HonorReply({ this.honor, }); fromRawJson(String str) => HonorReply.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); HonorReply.fromJson(Map json) { honor = json["honor"] == null ? [] : List.from(json["honor"]!.map((x) => Honor.fromJson(x))); } Map toJson() { final Map data = {}; data["honor"] = honor == null ? [] : List.from(honor!.map((x) => x.toJson())); return data; } } class Honor { int? aid; int? type; String? desc; int? weeklyRecommendNum; Honor({ this.aid, this.type, this.desc, this.weeklyRecommendNum, }); fromRawJson(String str) => Honor.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); Honor.fromJson(Map json) { aid = json["aid"]; type = json["type"]; desc = json["desc"]; weeklyRecommendNum = json["weekly_recommend_num"]; } Map toJson() { final Map data = {}; data["aid"] = aid; data["type"] = type; data["desc"] = desc; data["weekly_recommend_num"] = weeklyRecommendNum; return data; } } class Owner { int? mid; String? name; String? face; Owner({ this.mid, this.name, this.face, }); fromRawJson(String str) => Owner.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); Owner.fromJson(Map json) { mid = json["mid"]; name = json["name"]; face = json["face"]; } Map toJson() { final Map data = {}; data["mid"] = mid; data["name"] = name; data["face"] = face; return data; } } class Part { int? cid; int? page; String? from; String? pagePart; int? duration; String? vid; String? weblink; Dimension? dimension; String? firstFrame; Part({ this.cid, this.page, this.from, this.pagePart, this.duration, this.vid, this.weblink, this.dimension, this.firstFrame, }); fromRawJson(String str) => Part.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); Part.fromJson(Map json) { cid = json["cid"]; page = json["page"]; from = json["from"]; pagePart = json["part"]; duration = json["duration"]; vid = json["vid"]; weblink = json["weblink"]; dimension = json["dimension"] == null ? null : Dimension.fromJson(json["dimension"]); firstFrame = json["first_frame"]; } Map toJson() { final Map data = {}; data["cid"] = cid; data["page"] = page; data["from"] = from; data["part"] = pagePart; data["duration"] = duration; data["vid"] = vid; data["weblink"] = weblink; data["dimension"] = dimension?.toJson(); data["first_frame"] = firstFrame; return data; } } class Stat { int? aid; int? view; int? danmaku; int? reply; int? favorite; int? coin; int? share; int? nowRank; int? hisRank; int? like; int? dislike; String? evaluation; String? argueMsg; Stat({ this.aid, this.view, this.danmaku, this.reply, this.favorite, this.coin, this.share, this.nowRank, this.hisRank, this.like, this.dislike, this.evaluation, this.argueMsg, }); fromRawJson(String str) => Stat.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); Stat.fromJson(Map json) { aid = json["aid"]; view = json["view"]; danmaku = json["danmaku"]; reply = json["reply"]; favorite = json["favorite"]; coin = json["coin"]; share = json["share"]; nowRank = json["now_rank"]; hisRank = json["his_rank"]; like = json["like"]; dislike = json["dislike"]; evaluation = json["evaluation"]; argueMsg = json["argue_msg"]; } Map toJson() { final Map data = {}; data["aid"] = aid; data["view"] = view; data["danmaku"] = danmaku; data["reply"] = reply; data["favorite"] = favorite; data["coin"] = coin; data["share"] = share; data["now_rank"] = nowRank; data["his_rank"] = hisRank; data["like"] = like; data["dislike"] = dislike; data["evaluation"] = evaluation; data["argue_msg"] = argueMsg; return data; } } class Subtitle { bool? allowSubmit; List? list; Subtitle({ this.allowSubmit, this.list, }); fromRawJson(String str) => Subtitle.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); Subtitle.fromJson(Map json) { allowSubmit = json["allow_submit"]; list = json["list"] == null ? [] : List.from(json["list"]!.map((x) => x)); } Map toJson() { final Map data = {}; data["allow_submit"] = allowSubmit; data["list"] = list == null ? [] : List.from(list!.map((x) => x)); return data; } } class UserGarb { String? urlImageAniCut; UserGarb({ this.urlImageAniCut, }); fromRawJson(String str) => UserGarb.fromJson(json.decode(str)); String toRawJson() => json.encode(toJson()); UserGarb.fromJson(Map json) { urlImageAniCut = json["url_image_ani_cut"]; } Map toJson() => {"url_image_ani_cut": urlImageAniCut}; } class Label {} class UgcSeason { UgcSeason({ this.id, this.title, this.cover, this.mid, this.intro, this.signState, this.attribute, this.sections, this.stat, this.epCount, this.seasonType, this.isPaySeason, }); int? id; String? title; String? cover; int? mid; String? intro; int? signState; int? attribute; List? sections; Stat? stat; int? epCount; int? seasonType; bool? isPaySeason; UgcSeason.fromJson(Map json) { id = json['id']; title = json['title']; cover = json['cover']; mid = json['mid']; intro = json['intro']; signState = json['sign_state']; attribute = json['attribute']; sections = json['sections'] != null ? json['sections'] .map((e) => SectionItem.fromJson(e)) .toList() : []; stat = Stat.fromJson(json['stat']); epCount = json['ep_count']; seasonType = json['season_type']; isPaySeason = json['is_pay_count']; } } class SectionItem { SectionItem({ this.seasonId, this.id, this.title, this.type, this.episodes, }); int? seasonId; int? id; String? title; int? type; List? episodes; SectionItem.fromJson(Map json) { seasonId = json['season_id']; id = json['id']; title = json['title']; type = json['type']; episodes = json['episodes'] .map((e) => EpisodeItem.fromJson(e)) .toList(); } } class EpisodeItem { EpisodeItem({ this.seasonId, this.sectionId, this.id, this.aid, this.cid, this.title, this.attribute, this.page, this.bvid, }); int? seasonId; int? sectionId; int? id; int? aid; int? cid; String? title; int? attribute; Part? page; String? bvid; EpisodeItem.fromJson(Map json) { seasonId = json['season_id']; sectionId = json['sectionId']; id = json['id']; aid = json['aid']; cid = json['cid']; title = json['title']; attribute = json['attribute']; page = Part.fromJson(json['page']); bvid = json['bvid']; } }