react-native-consumet 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/extension-registry.json +9 -4
- package/lib/commonjs/extractors/filemoon.js.map +1 -1
- package/lib/commonjs/extractors/megacloud.js +48 -11
- package/lib/commonjs/extractors/megacloud.js.map +1 -1
- package/lib/commonjs/models/lightnovel-parser.js.map +1 -1
- package/lib/commonjs/models/types.js +0 -1
- package/lib/commonjs/models/types.js.map +1 -1
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js +30 -25
- package/lib/commonjs/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/commonjs/utils/ExtractorManager.js +84 -8
- package/lib/commonjs/utils/ExtractorManager.js.map +1 -1
- package/lib/commonjs/utils/ProviderManager.js +1 -2
- package/lib/commonjs/utils/ProviderManager.js.map +1 -1
- package/lib/commonjs/utils/constants.js +3 -3
- package/lib/module/extension-registry.json +9 -4
- package/lib/module/extractors/filemoon.js.map +1 -1
- package/lib/module/extractors/megacloud.js +48 -11
- package/lib/module/extractors/megacloud.js.map +1 -1
- package/lib/module/models/lightnovel-parser.js.map +1 -1
- package/lib/module/models/types.js +0 -1
- package/lib/module/models/types.js.map +1 -1
- package/lib/module/providers/anime/animepahe/create-animepahe.js +30 -25
- package/lib/module/providers/anime/animepahe/create-animepahe.js.map +1 -1
- package/lib/module/utils/ExtractorManager.js +84 -8
- package/lib/module/utils/ExtractorManager.js.map +1 -1
- package/lib/module/utils/ProviderManager.js +1 -2
- package/lib/module/utils/ProviderManager.js.map +1 -1
- package/lib/module/utils/constants.js +3 -3
- package/lib/typescript/commonjs/src/extractors/filemoon.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/extractors/megacloud.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/extension-manifest.d.ts +2 -0
- package/lib/typescript/commonjs/src/models/extension-manifest.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/lightnovel-parser.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/models/types.d.ts +0 -1
- package/lib/typescript/commonjs/src/models/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts +20 -3
- package/lib/typescript/commonjs/src/utils/ExtractorManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts +1 -1
- package/lib/typescript/commonjs/src/utils/ProviderManager.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/filemoon.d.ts.map +1 -1
- package/lib/typescript/module/src/extractors/megacloud.d.ts.map +1 -1
- package/lib/typescript/module/src/models/extension-manifest.d.ts +2 -0
- package/lib/typescript/module/src/models/extension-manifest.d.ts.map +1 -1
- package/lib/typescript/module/src/models/lightnovel-parser.d.ts.map +1 -1
- package/lib/typescript/module/src/models/types.d.ts +0 -1
- package/lib/typescript/module/src/models/types.d.ts.map +1 -1
- package/lib/typescript/module/src/providers/anime/animepahe/create-animepahe.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/ExtractorManager.d.ts +20 -3
- package/lib/typescript/module/src/utils/ExtractorManager.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/ProviderManager.d.ts +1 -1
- package/lib/typescript/module/src/utils/ProviderManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/extension-registry.json +9 -4
- package/src/extractors/megacloud.ts +50 -13
- package/src/models/extension-manifest.ts +3 -0
- package/src/models/types.ts +0 -1
- package/src/providers/anime/animepahe/create-animepahe.ts +32 -21
- package/src/utils/ExtractorManager.ts +92 -9
- package/src/utils/ProviderManager.ts +1 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import type { ExtractorContext, IVideoExtractor, ExtractorContextConfig } from '../models';
|
|
2
|
+
import { StreamingServers } from '../models';
|
|
3
3
|
import type { ExtractorInfo } from '../models/extension-manifest';
|
|
4
4
|
import createExtractorContext from './create-extractor-context';
|
|
5
5
|
import { defaultExtractors } from './extension-utils';
|
|
@@ -11,6 +11,12 @@ export class ExtractorManager {
|
|
|
11
11
|
private staticExtractors!: Record<string, any>;
|
|
12
12
|
private extractorContext: ExtractorContext;
|
|
13
13
|
|
|
14
|
+
// Map of server name aliases to their actual extractor names
|
|
15
|
+
private extractorAliases: Map<string, string> = new Map([
|
|
16
|
+
['upcloud', 'megacloud'],
|
|
17
|
+
['akcloud', 'megacloud'],
|
|
18
|
+
]);
|
|
19
|
+
|
|
14
20
|
constructor(registry: typeof extensionRegistry, extractorConfig: ExtractorContextConfig = {}) {
|
|
15
21
|
this.extractorContext = createExtractorContext(extractorConfig);
|
|
16
22
|
this.initializeStaticExtractors();
|
|
@@ -52,22 +58,100 @@ export class ExtractorManager {
|
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
/**
|
|
55
|
-
*
|
|
61
|
+
* @param extractorId server name or extractor ID (case-insensitive) like 'megacloud' or 'MegaCloud'
|
|
62
|
+
* @returns ExtractorInfo or undefined if not found
|
|
63
|
+
* - Also handles server names with suffixes like 'megacloud-hd-1', 'kwik-pahe', etc.
|
|
64
|
+
* - Resolves aliases like 'upcloud' -> 'megacloud', 'akcloud' -> 'megacloud'
|
|
56
65
|
*/
|
|
57
|
-
getExtractorMetadata(extractorId:
|
|
58
|
-
|
|
66
|
+
getExtractorMetadata(extractorId: string): ExtractorInfo | undefined {
|
|
67
|
+
const lowerExtractorId = extractorId.toLowerCase();
|
|
68
|
+
|
|
69
|
+
// Check if this is an alias and resolve it
|
|
70
|
+
const resolvedId = this.extractorAliases.get(lowerExtractorId) || lowerExtractorId;
|
|
71
|
+
|
|
72
|
+
// First try exact match with resolved ID
|
|
73
|
+
const exactMatch = this.extractorRegistry.get(resolvedId);
|
|
74
|
+
if (exactMatch) {
|
|
75
|
+
return exactMatch;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// If no exact match, try to extract base name from patterns like:
|
|
79
|
+
// - 'megacloud-hd-1' -> 'megacloud'
|
|
80
|
+
// - 'kwik-pahe' -> 'kwik'
|
|
81
|
+
// - 'streamsb-backup' -> 'streamsb'
|
|
82
|
+
const baseExtractorName = this.extractBaseExtractorName(extractorId);
|
|
83
|
+
if (baseExtractorName) {
|
|
84
|
+
// Check if base name is an alias
|
|
85
|
+
const resolvedBaseName = this.extractorAliases.get(baseExtractorName) || baseExtractorName;
|
|
86
|
+
const baseMatch = this.extractorRegistry.get(resolvedBaseName);
|
|
87
|
+
if (baseMatch) {
|
|
88
|
+
return baseMatch;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Extract the base extractor name from server names with suffixes and resolve aliases
|
|
97
|
+
* Examples:
|
|
98
|
+
* - 'megacloud-hd-1' -> 'megacloud'
|
|
99
|
+
* - 'kwik-pahe' -> 'kwik'
|
|
100
|
+
* - 'upcloud' -> 'megacloud' (alias resolved)
|
|
101
|
+
* - 'akcloud' -> 'megacloud' (alias resolved)
|
|
102
|
+
* - 'MegaCloud' -> 'megacloud'
|
|
103
|
+
*/
|
|
104
|
+
public extractBaseExtractorName(serverName: string): string | null {
|
|
105
|
+
const lowerName = serverName.toLowerCase();
|
|
106
|
+
|
|
107
|
+
// Get all extractor values from StreamingServers enum
|
|
108
|
+
const knownExtractors = Object.values(StreamingServers as Record<string, string>);
|
|
109
|
+
|
|
110
|
+
// Check aliases first
|
|
111
|
+
for (const [alias] of this.extractorAliases) {
|
|
112
|
+
if (lowerName.startsWith(alias)) {
|
|
113
|
+
// Return the resolved alias target
|
|
114
|
+
return this.extractorAliases.get(alias)!;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Check if the server name starts with any known extractor
|
|
119
|
+
for (const extractor of knownExtractors) {
|
|
120
|
+
if (lowerName.startsWith(extractor.toLowerCase())) {
|
|
121
|
+
return extractor.toLowerCase();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// If no match found, try splitting by hyphen and taking first part
|
|
126
|
+
const firstPart = lowerName.split('-')[0];
|
|
127
|
+
|
|
128
|
+
// Check if first part is an alias
|
|
129
|
+
if (firstPart && this.extractorAliases.has(firstPart)) {
|
|
130
|
+
return this.extractorAliases.get(firstPart)!;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Check if first part is a known extractor
|
|
134
|
+
if (firstPart && knownExtractors.some((e) => e.toLowerCase() === firstPart)) {
|
|
135
|
+
return firstPart;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return null;
|
|
59
139
|
}
|
|
60
140
|
|
|
61
141
|
/**
|
|
62
142
|
* Load an extractor by ID from the registry
|
|
143
|
+
* Handles server names with suffixes like 'megacloud-hd-1', 'kwik-pahe', etc.
|
|
144
|
+
* Also resolves aliases like 'upcloud' -> 'megacloud', 'akcloud' -> 'megacloud'
|
|
63
145
|
*/
|
|
64
146
|
async loadExtractor(extractorId: StreamingServers): Promise<IVideoExtractor> {
|
|
65
147
|
const metadata = this.getExtractorMetadata(extractorId as StreamingServers);
|
|
66
148
|
if (!metadata) {
|
|
67
|
-
//
|
|
68
|
-
const
|
|
149
|
+
// Try to extract base name and look for static extractor
|
|
150
|
+
const baseName = this.extractBaseExtractorName(extractorId) || extractorId;
|
|
151
|
+
const resolvedName = this.extractorAliases.get(baseName.toLowerCase()) || baseName;
|
|
152
|
+
const staticExtractor = this.staticExtractors[resolvedName.toLowerCase()];
|
|
69
153
|
if (staticExtractor) {
|
|
70
|
-
//console.log(`🔧 Using static fallback for extractor '${extractorId}'`);
|
|
154
|
+
//console.log(`🔧 Using static fallback for extractor '${extractorId}' (resolved: '${resolvedName}')`);
|
|
71
155
|
return staticExtractor;
|
|
72
156
|
}
|
|
73
157
|
throw new Error(`Extractor '${extractorId}' not found in registry or static extractors`);
|
|
@@ -195,7 +279,6 @@ export class ExtractorManager {
|
|
|
195
279
|
return {
|
|
196
280
|
SubOrSub: { SUB: 'sub', DUB: 'dub', BOTH: 'both' },
|
|
197
281
|
StreamingServers: {
|
|
198
|
-
VidCloud: 'vidcloud',
|
|
199
282
|
StreamSB: 'streamsb',
|
|
200
283
|
StreamTape: 'streamtape',
|
|
201
284
|
VidStreaming: 'vidstreaming',
|
|
@@ -55,7 +55,7 @@ export class ProviderManager {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* Get extension metadata by ID
|
|
58
|
+
* Get extension metadata by ID/ name (case-insensitive) like 'zoro' or 'Zoro'
|
|
59
59
|
*/
|
|
60
60
|
getExtensionMetadata(extensionId: string): ExtensionManifest {
|
|
61
61
|
if (!extensionId) throw new Error('Extension id/name is required');
|
|
@@ -342,7 +342,6 @@ export class ProviderManager {
|
|
|
342
342
|
MangaParser: this.providerContext.MangaParser,
|
|
343
343
|
SubOrDub: { SUB: 'sub', DUB: 'dub', BOTH: 'both' },
|
|
344
344
|
StreamingServers: {
|
|
345
|
-
VidCloud: 'vidcloud',
|
|
346
345
|
StreamSB: 'streamsb',
|
|
347
346
|
StreamTape: 'streamtape',
|
|
348
347
|
VidStreaming: 'vidstreaming',
|