kamikat / bilibili-get

Bilibili video downloader.
MIT License
187 stars 26 forks source link

empty taskList: fixed #16

Closed cyphunk closed 5 years ago

cyphunk commented 5 years ago

I'd rather submit the changes here than fork and make a pull request.

Had issues downloading "The Leader" the Anime on Karl Marx: https://www.bilibili.com/bangumi/play/ep261461

Appears that the format of the initial pages JSON is slightly different

diff --git a/lib/extractor.js b/lib/extractor.js
index d107332..fcff692 100644
--- a/lib/extractor.js
+++ b/lib/extractor.js
@@ -168,13 +168,14 @@ var findBangumiInfo = function* ({ url, bangumi_id, cookie }) {
var videoInfo = Object.assign({
info: {
title: json.mediaInfo.title,
-      creator: json.upInfo && json.upInfo.uname,
-      creator_id: json.upInfo && json.upInfo.mid,
-      publish_at: (json.pubInfo && json.pubInfo.pub_time) || json.mediaInfo.publish.pub_date,
+      creator: json.epInfo && json.epInfo.from,
+      creator_id: json.epInfo && json.epInfo.id,
+      publish_at: (json.pubInfo && json.pubInfo.pub_time) || (json.mediaInfo.publish && json.mediaInfo.publish.pub_date) || (json.mediaInfo.pub && json.mediaInfo.pub.time),
},
-    season_type: json.mediaInfo.season_type || (json.mediaInfo.param && json.mediaInfo.param.season_type),
-    parts: (json.epList || json.mediaInfo.episodes).map(({ aid, cid, index_title, ep_id, index }) => ({
-      aid, cid, index, index_title, episode_id: ep_id
+    season_type: json.mediaInfo.ssType || (json.mediaInfo.param && json.mediaInfo.param.season_type),
+    parts: (json.epList || json.mediaInfo.episodes).map((
+    { aid, cid, title, i, id  }) => ({
+      aid, cid, index: i,  index_title: title, episode_id: id
}))
});
debug('extracting bangumi info: success.');
cyphunk commented 5 years ago

I should note that it is likely that this part of the change will break other things?

+    parts: (json.epList || json.mediaInfo.episodes).map((
+    { aid, cid, title, i, id  }) => ({
+      aid, cid, index: i,  index_title: title, episode_id: id
cyphunk commented 5 years ago

made it more backward compatible and will make a fork+pull request with new changes