File tree Expand file tree Collapse file tree 11 files changed +75
-27
lines changed
Expand file tree Collapse file tree 11 files changed +75
-27
lines changed Original file line number Diff line number Diff line change 1+ import { invoke } from "@tauri-apps/api/core" ;
2+
3+ export const parseBigo = async ( roomId : number ) => {
4+ const result = await invoke < ParsedResult > ( "parse_bigo" , {
5+ roomId,
6+ } ) ;
7+ return result ;
8+ } ;
Original file line number Diff line number Diff line change 1+ import { invoke } from "@tauri-apps/api/core" ;
2+
3+ export const parseBilibili = async (
4+ roomID : number ,
5+ cookie : string ,
6+ url : string
7+ ) => {
8+ const result = await invoke < ParsedResult > ( "parse_bilibili" , {
9+ roomId : roomID ,
10+ cookie : cookie ,
11+ url : url || null ,
12+ } ) ;
13+ return result ;
14+ } ;
Original file line number Diff line number Diff line change 1+ import { invoke } from "@tauri-apps/api/core" ;
2+
3+ export const parseDouyin = async ( roomID : number ) => {
4+ const result = await invoke < ParsedResult > ( "parse_douyin" , {
5+ roomId : roomID ,
6+ } ) ;
7+ return result ;
8+ } ;
Original file line number Diff line number Diff line change 1+ import { invoke } from "@tauri-apps/api/core" ;
2+
3+ export const parseDouyu = async ( roomID : number ) => {
4+ const result = await invoke < ParsedResult > ( "parse_douyu" , {
5+ roomId : roomID ,
6+ } ) ;
7+ return result ;
8+ } ;
Original file line number Diff line number Diff line change 1+ import { invoke } from "@tauri-apps/api/core" ;
2+
3+ export const parseHuya = async ( roomID : number , url : string ) => {
4+ const result = await invoke < ParsedResult > ( "parse_huya" , {
5+ roomId : roomID || null ,
6+ url : url ,
7+ } ) ;
8+ return result ;
9+ } ;
Original file line number Diff line number Diff line change 1+ export { parseBigo } from "./bigo" ;
2+ export { parseBilibili } from "./bili" ;
3+ export { parseDouyin } from "./douyin" ;
4+ export { parseDouyu } from "./douyu" ;
5+ export { parseHuya } from "./huya" ;
Original file line number Diff line number Diff line change 1+ import { parseBigo } from "~/commands/parser" ;
2+
13import LiveStreamParser from "../base" ;
4+
25import { parseRoomID } from "../utils" ;
3- import { invoke } from "@tauri-apps/api/core" ;
46
57class BigoParser extends LiveStreamParser {
68 constructor ( roomID : number ) {
@@ -9,9 +11,7 @@ class BigoParser extends LiveStreamParser {
911
1012 async parse ( ) : Promise < ParsedResult | Error > {
1113 try {
12- const result = await invoke < ParsedResult > ( "parse_bigo" , {
13- roomId : this . roomID ,
14- } ) ;
14+ const result = await parseBigo ( this . roomID ) ;
1515 return result ;
1616 } catch ( e ) {
1717 return Error ( String ( e ) ) ;
Original file line number Diff line number Diff line change 1+ import { parseBilibili } from "~/commands/parser" ;
2+
13import LiveStreamParser from "../base" ;
2- import { invoke } from "@tauri-apps/api/core" ;
34
45class BilibiliParser extends LiveStreamParser {
56 cookie : string ;
@@ -12,11 +13,7 @@ class BilibiliParser extends LiveStreamParser {
1213
1314 async parse ( ) : Promise < ParsedResult | Error > {
1415 try {
15- const result = await invoke < ParsedResult > ( "parse_bilibili" , {
16- roomId : this . roomID ,
17- cookie : this . cookie ,
18- url : this . url || null ,
19- } ) ;
16+ const result = await parseBilibili ( this . roomID , this . cookie , this . url ) ;
2017 return result ;
2118 } catch ( e ) {
2219 return Error ( String ( e ) ) ;
@@ -26,7 +23,7 @@ class BilibiliParser extends LiveStreamParser {
2623
2724export default function createBilibiliParser (
2825 input : string | number ,
29- cookie : string ,
26+ cookie : string
3027) {
3128 let roomID : number | undefined ;
3229 let url : string | undefined ;
Original file line number Diff line number Diff line change 1+ import { parseDouyin } from "~/commands/parser" ;
2+
13import LiveStreamParser from "../base" ;
4+
25import { parseRoomID } from "../utils" ;
3- import { invoke } from "@tauri-apps/api/core" ;
46
57class DouyinParser extends LiveStreamParser {
68 constructor ( roomID : number ) {
@@ -9,9 +11,7 @@ class DouyinParser extends LiveStreamParser {
911
1012 async parse ( ) : Promise < ParsedResult | Error > {
1113 try {
12- const result = await invoke < ParsedResult > ( "parse_douyin" , {
13- roomId : this . roomID ,
14- } ) ;
14+ const result = await parseDouyin ( this . roomID ) ;
1515 return result ;
1616 } catch ( e ) {
1717 return Error ( String ( e ) ) ;
Original file line number Diff line number Diff line change 1+ import { listen } from "@tauri-apps/api/event" ;
2+
13import { evalResult } from "~/command" ;
4+ import { parseDouyu } from "~/commands/parser" ;
5+
26import LiveStreamParser from "../base" ;
3- import { listen } from "@tauri-apps/api/event" ;
4- import { invoke } from "@tauri-apps/api/core" ;
7+
58import {
69 INVALID_INPUT ,
710 parseRoomID ,
@@ -20,9 +23,7 @@ class DouyuParser extends LiveStreamParser {
2023 } ) ;
2124
2225 try {
23- const result = await invoke < ParsedResult > ( "parse_douyu" , {
24- roomId : this . roomID ,
25- } ) ;
26+ const result = await parseDouyu ( this . roomID ) ;
2627 return result ;
2728 } catch ( e ) {
2829 return Error ( String ( e ) ) ;
@@ -33,7 +34,7 @@ class DouyuParser extends LiveStreamParser {
3334}
3435
3536export default function createDouyuParser (
36- input : string | number ,
37+ input : string | number
3738) : DouyuParser | Error {
3839 let roomID = parseRoomID ( input ) ;
3940 // 斗鱼的房间号可能在查询参数 rid 中
You can’t perform that action at this time.
0 commit comments