Skip to content

Commit

Permalink
* 解决图书和音乐加载失败的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jadehh committed Mar 29, 2024
1 parent 8f721e1 commit 35c7e0e
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 339 deletions.
9 changes: 7 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
### 更新日志
### V1.0.4.1 - 2024-03-29
* 解决图书和音乐加载失败的bug
### V1.0.4.2 - 2024-03-29
* 支持小说和音乐代码转nodejs
* 支持push操作
----


<details onclose>

### V1.0.4.1 - 2024-03-29
* 解决图书和音乐加载失败的bug
----

### V1.0.4.0 - 2024-03-27
* 去除已失效链接
----
Expand Down
32 changes: 21 additions & 11 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,19 @@ def js_to_nodejs(js_file_list, type="video"):
jsMoudle = JSMoudle(os.path.join("js", js_file))
modleName = jsMoudle.getName()
write_content = ""
print(jsMoudle.getAppName(), jsMoudle.getJSName())
print(jsMoudle.getAppName(),jsMoudle.getType(), jsMoudle.getJSName())
with open("nodejs/src/spider/tmpSpider.txt", "rb") as f:
contentlist = f.readlines()
for content in contentlist:
write_content = write_content + str(content, encoding="utf-8").replace("temp",
jsMoudle.getJSName()).replace(
"updateTime", GetTimeStamp())
with open("nodejs/src/spider/{}/{}".format(type, js_file), "wb") as f:
f.write(write_content.encode("utf-8"))
if jsMoudle.getType() == "3" :
with open("nodejs/src/spider/{}/{}".format(type, js_file), "wb") as f:
f.write(write_content.encode("utf-8"))
elif jsMoudle.getType() == "10":
with open("nodejs/src/spider/{}/{}".format("book", js_file), "wb") as f:
f.write(write_content.encode("utf-8"))

def nodejs_config(ali_token,is_18):
book_file_list = os.listdir("nodejs/src/spider/book")
Expand Down Expand Up @@ -102,7 +106,7 @@ def getAppName(self):
try:
name = (self.js_str.split("getAppName()")[-1].split("}")[0].split("return")[-1].split('"')[1])
return name
except:
except Exception as e:
return None

def getJSName(self):
Expand Down Expand Up @@ -176,7 +180,6 @@ def write_config(self, ali_name, json_file_list, js_file_list, is_18=True):
site_obj_copy["name"] = jsMoudle.getName()
site_obj_copy["ext"] = {"box": json_file_name, "danmu": False}
site_obj_copy["api"] = "./{}/{}".format(self.js_path, js_file)
print(js_file_name, jsMoudle.getAppName())
if "阿里" in jsMoudle.getAppName() or "厂长直连" in jsMoudle.getAppName():
site_obj_copy["ext"]["token"] = self.ali_token
elif jsMoudle.getAppName() == "泥视频":
Expand Down Expand Up @@ -274,19 +277,26 @@ def build(self,no_18=False):
json_file_list = self.getJsonFileList()
no_18_js_file_list = self.getJsFileList(case=0)
y_js_file_list = self.getJsFileList(case=1)
if no_18 is False:
js_to_nodejs(no_18_js_file_list)
nodejs_config(self.ali_token,no_18)
else:
js_to_nodejs(y_js_file_list,"18")
nodejs_config(self.ali_token,no_18)

book_file_list = self.getJsFileList(case=2)
push_file_list = self.getJsFileList(case=3)
self.write_config(self.ali_name, json_file_list, no_18_js_file_list, is_18=False)
self.write_config(self.ali_name, json_file_list, y_js_file_list, is_18=True)
self.write_book_config(book_file_list)
self.write_push_config(push_file_list)

no_18_js_file_list.extend(book_file_list)
no_18_js_file_list.extend(push_file_list)

if no_18 is False:
js_to_nodejs(no_18_js_file_list)
nodejs_config(self.ali_token,no_18)
else:
js_to_nodejs(y_js_file_list,"18")
nodejs_config(self.ali_token,no_18)




if __name__ == '__main__':
import argparse
Expand Down
6 changes: 2 additions & 4 deletions js/bqg_open.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import {_} from '../lib/cat.js';
import * as Utils from "../lib/utils.js";
import {Spider} from "./spider.js";
import {VodShort} from "../lib/vod.js";
import {BookDetail, BookShort} from "../lib/book.js";

class BQQSpider extends Spider {
Expand All @@ -36,11 +35,10 @@ class BQQSpider extends Spider {

async spiderInit(inReq = null) {
if (inReq !== null) {
this.jsBase = await js2Proxy(inReq, "img", this.getHeader());
this.jsBase = await js2Proxy(inReq, "img", {});
} else {
this.jsBase = await js2Proxy(true, this.siteType, this.siteKey, 'img/', this.getHeader());
this.jsBase = await js2Proxy(true, this.siteType, this.siteKey, 'img/', {});
}

}

async init(cfg) {
Expand Down
2 changes: 1 addition & 1 deletion js/dj0898_book_open.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class DJ0898Spider extends Spider {
book_content: '',
};
const playlist = ["点击播放" + "$" + vod.book_id];
vod.volumes = this.getAppName();
vod.volumes = "世纪DJ音乐网";
vod.urls = playlist.join("#");
return vod
}
Expand Down
2 changes: 1 addition & 1 deletion js/push_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class PushSpider extends Spider {
}

getType() {
return 3
return 4
}

async init(cfg) {
Expand Down
2 changes: 1 addition & 1 deletion js/testSpider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {__jsEvalReturn} from './dj0898_book_open.js';
import {__jsEvalReturn} from './bqg_open.js';
import * as Utils from "../lib/utils.js";


Expand Down
50 changes: 25 additions & 25 deletions nodejs/src/router.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import bqg from './spider/book/bqg.js';
import audiomack from './spider/book/audiomack.js';
import bookan from './spider/book/bookan.js';
import bqg_open from './spider/book/bqg_open.js';
import copymanga from './spider/book/copymanga.js';
import dj0898_book_open from './spider/book/dj0898_book_open.js';
import alist from './spider/pan/alist.js';
import weixine from './spider/video/weixine.js';
import aiyingshi from './spider/video/aiyingshi.js';
import alipansou from './spider/video/alipansou.js';
import aliyunpanshare from './spider/video/aliyunpanshare.js';
import changzhang from './spider/video/changzhang.js';
import douban from './spider/video/douban.js';
import dygangs from './spider/video/dygangs.js';
import liangzi from './spider/video/liangzi.js';
import kkys from './spider/video/kkys.js';
import feifan from './spider/video/feifan.js';
import ffm3u8 from './spider/video/ffm3u8.js';
import gitcafe from './spider/video/gitcafe.js';
import huya from './spider/video/huya.js';
import ikanbot from './spider/video/ikanbot.js';
import push from './spider/video/push.js';
import jianpian from './spider/video/jianpian.js';
import jiafeimao from './spider/video/jiafeimao.js';
import kuaikan from './spider/video/kuaikan.js';
import ffm3u8 from './spider/video/ffm3u8.js';
import jiujiuliu from './spider/video/jiujiuliu.js';
import yiqikan from './spider/video/yiqikan.js';
import huya from './spider/video/huya.js';
import changzhang from './spider/video/changzhang.js';
import kankan70 from './spider/video/kankan70.js';
import kkys from './spider/video/kkys.js';
import kuaikan from './spider/video/kuaikan.js';
import kunyu77 from './spider/video/kunyu77.js';
import liangzi from './spider/video/liangzi.js';
import mp4movie from './spider/video/mp4movie.js';
import sp360 from './spider/video/sp360.js';
import dyttbt from './spider/video/dyttbt.js';
import nangua from './spider/video/nangua.js';
import newvision from './spider/video/newvision.js';
import gitcafe from './spider/video/gitcafe.js';
import xb6v from './spider/video/xb6v.js';
import aiyingshi from './spider/video/aiyingshi.js';
import nivod from './spider/video/nivod.js';
import pan_search from './spider/video/pan_search.js';
import nangua from './spider/video/nangua.js';
import push from './spider/video/push.js';
import sp360 from './spider/video/sp360.js';
import star from './spider/video/star.js';
import aliyunpanshare from './spider/video/aliyunpanshare.js';
import kunyu77 from './spider/video/kunyu77.js';
import feifan from './spider/video/feifan.js';
import kankan70 from './spider/video/kankan70.js';
import wogg from './spider/video/wogg.js';
import douban from './spider/video/douban.js';
import alipansou from './spider/video/alipansou.js';
import nivod from './spider/video/nivod.js';
const spiders = [bqg,copymanga,alist,weixine,dygangs,liangzi,kkys,ikanbot,push,jianpian,jiafeimao,kuaikan,ffm3u8,jiujiuliu,yiqikan,huya,changzhang,mp4movie,sp360,dyttbt,newvision,gitcafe,xb6v,aiyingshi,pan_search,nangua,star,aliyunpanshare,kunyu77,feifan,kankan70,wogg,douban,alipansou,nivod];
import xb6v from './spider/video/xb6v.js';
import yiqikan from './spider/video/yiqikan.js';
const spiders = [audiomack,bookan,bqg_open,copymanga,dj0898_book_open,alist,aiyingshi,alipansou,aliyunpanshare,changzhang,douban,dygangs,feifan,ffm3u8,gitcafe,huya,ikanbot,jianpian,jiujiuliu,kankan70,kkys,kuaikan,kunyu77,liangzi,mp4movie,nangua,newvision,nivod,pan_search,push,sp360,star,wogg,xb6v,yiqikan];
const spiderPrefix = '/spider';

/**
Expand Down
Loading

0 comments on commit 35c7e0e

Please sign in to comment.