Skip to content

Commit

Permalink
Merge pull request #150 from jadehh/143-源名称-西瓜卡通
Browse files Browse the repository at this point in the history
* 解决弹幕ParseXML方法报错
  • Loading branch information
jadehh authored Sep 9, 2024
2 parents 5ffdf70 + a353bf1 commit 9103569
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 19 deletions.
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "Python: 当前文件",
"type": "python",
Expand Down
19 changes: 12 additions & 7 deletions js/testSpider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {__jsEvalReturn} from './wogg.js';
import {__jsEvalReturn} from '../js/jianpian.js';

import * as Utils from "../lib/utils.js";

Expand Down Expand Up @@ -51,7 +51,7 @@ async function testMusicPlay(vodDetail) {
}

async function test() {
let siteKey = 'wogg';
let siteKey = 'jianpian';
let siteType = 3;
await spider.init({
skey: siteKey, stype: siteType, ext: {
Expand All @@ -68,17 +68,22 @@ async function test() {
let classes = JSON.parse(await spider.home(true));
console.debug(JSON.stringify(classes))


//测试首页列表
let homeVod = JSON.parse(await spider.homeVod())
console.debug(JSON.stringify(homeVod));


// 测试详情
let detail1 = JSON.parse(await spider.detail("/index.php/voddetail/84022.html"))
let detail1 = JSON.parse(await spider.detail("562381"))
await testPlay(detail1)

/***
*
* "HD粤语中英双字$ftp://a.gbl.114s.com:20320/9607/潜行-2023_HD粤语中英双字.mp4#HD国语中英双字$ftp://a.gbl.114s.com:20320/8224/潜行-2023_HD国语中英双字.mp4#BD国粤双语中字$ftp://a.gbl.114s.com:20320/1413/潜行-2023_BD国粤双语中字.mp4"
*/



//测试首页列表
let homeVod = JSON.parse(await spider.homeVod())
console.debug(JSON.stringify(homeVod));



Expand Down
143 changes: 143 additions & 0 deletions js/xgcartoon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/*
* @Author: jadehh
* @Date: 2024-06-21 15:47:27
* @LastEditTime: 2024-06-21 16:20:30
* @LastEditors: jadehh
* @Description:
* @FilePath: \TVSpider\js\xgcartoon.js
* @
*/
import * as Utils from "../lib/utils.js";
import {_, load} from "../lib/cat.js";
import {VodDetail, VodShort} from "../lib/vod.js";
import {Spider} from "./spider.js";


class XGCartoonSpider extends Spider {
constructor() {
super();
this.siteUrl = "https://cn.xgcartoon.com/"
this.nextObj = {}
}


getName() {
return `🍉┃西瓜卡通┃🍉`
}

getAppName() {
return "西瓜卡通"
}


getJSName() {
return "xgcartoon"
}

getType() {
return 3
}


async setClasses() {
let $ = await this.getHtml(this.siteUrl)
let navElements = $('[class="index-tab"]').find("a")
for (const navElement of navElements){
let type_name = $(navElement).text()
let type_id = navElement.attribs.href
this.classes.push(this.getTypeDic(type_name,type_id))
}
let x = 0
}


async parseVodShortListFromJson(obj) {
let vod_list = []
for (const data of obj) {
let vodShort = new VodShort()
vodShort.vod_id = data["vodId"]
vodShort.vod_name = data["vodName"]
vodShort.vod_remarks = data["watchingCountDesc"]
vodShort.vod_pic = data["coverImg"]
vod_list.push(vodShort)
}
return vod_list
}

async parseVodDetailfromJson(obj) {
let vodDetail = new VodDetail()

return vodDetail
}

async setHomeVod() {

}

async setCategory(tid, pg, filter, extend) {



}

async setDetail(id) {

}

async setPlay(flag, id, flags) {

}

async setSearch(wd, quick) {

}

}

let spider = new XGCartoonSpider()

async function init(cfg) {
await spider.init(cfg)
}

async function home(filter) {
return await spider.home(filter)
}

async function homeVod() {
return await spider.homeVod()
}

async function category(tid, pg, filter, extend) {
return await spider.category(tid, pg, filter, extend)
}

async function detail(id) {
return await spider.detail(id)
}

async function play(flag, id, flags) {
return await spider.play(flag, id, flags)
}

async function search(wd, quick) {
return await spider.search(wd, quick)
}

async function proxy(segments, headers) {
return await spider.proxy(segments, headers)
}

export function __jsEvalReturn() {
return {
init: init,
home: home,
homeVod: homeVod,
category: category,
detail: detail,
play: play,
search: search,
proxy: proxy
};
}
export {spider}
12 changes: 0 additions & 12 deletions lib/bilibili_ASS_Danmaku_Downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@
*/
function parseXML(json) {
let list = [];
/**
* <d p="{time},{type},{size},{color},{timestamp},{pool},{uid_crc32},{row_id}">
*
* {Text}
* time为弹幕在视频里的时间 -->
* type为弹幕类型 -->
* size为字体大小 -->
* color为十进制的RGB颜色(16进制转10进制) -->
* timestamp为弹幕发送时间戳(unix时间戳) -->
* pool为弹幕池 -->
* uid_crc32为发送者uid的crc32 -->
*/
Array.from(json.danmuku).forEach(x => {
let start = Number(x[0]);
let content = x[4];
Expand Down

0 comments on commit 9103569

Please sign in to comment.