coomer-downloader 3.3.2 → 3.4.1
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/README.md +14 -3
- package/biome.json +6 -4
- package/dist/index.js +196 -68
- package/docs/images/Screenshot 01.jpg +0 -0
- package/package.json +2 -1
- package/src/api/bunkr.ts +5 -2
- package/src/api/coomer-api.ts +23 -6
- package/src/api/gofile.ts +2 -1
- package/src/api/index.ts +1 -1
- package/src/api/nsfw.xxx.ts +6 -4
- package/src/api/plain-curl.ts +2 -1
- package/src/cli/args-handler.ts +17 -12
- package/src/cli/ui/app.tsx +12 -11
- package/src/cli/ui/components/preview.tsx +1 -1
- package/src/cli/ui/hooks/downloader.ts +24 -14
- package/src/index.ts +28 -5
- package/src/logger/index.ts +15 -0
- package/src/services/downloader.ts +28 -7
- package/src/services/file.ts +4 -70
- package/src/services/filelist.ts +86 -0
- package/src/types/index.ts +3 -2
- package/src/utils/duplicates.ts +23 -0
- package/src/utils/filters.ts +15 -15
- package/src/utils/io.ts +25 -0
- package/src/utils/mediatypes.ts +13 -0
- package/src/utils/timer.ts +3 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MediaType } from '../types';
|
|
2
|
+
|
|
3
|
+
export function isImage(name: string) {
|
|
4
|
+
return /\.(jpg|jpeg|png|gif|bmp|tiff|webp|avif)$/i.test(name);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function isVideo(name: string) {
|
|
8
|
+
return /\.(mp4|m4v|avi|mov|mkv|webm|flv|wmv|mpeg|mpg|3gp)$/i.test(name);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function testMediaType(name: string, type: MediaType) {
|
|
12
|
+
return type === 'image' ? isImage(name) : isVideo(name);
|
|
13
|
+
}
|
package/src/utils/timer.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Subject } from 'rxjs';
|
|
2
|
+
import type { AbortControllerSubject } from '../types';
|
|
2
3
|
|
|
3
4
|
export class Timer {
|
|
4
5
|
private timer: NodeJS.Timeout | undefined;
|
|
@@ -34,8 +35,8 @@ export class Timer {
|
|
|
34
35
|
|
|
35
36
|
static withAbortController(
|
|
36
37
|
timeout: number,
|
|
37
|
-
abortControllerSubject: Subject<
|
|
38
|
-
message:
|
|
38
|
+
abortControllerSubject: Subject<AbortControllerSubject>,
|
|
39
|
+
message: AbortControllerSubject = 'TIMEOUT',
|
|
39
40
|
) {
|
|
40
41
|
const callback = () => {
|
|
41
42
|
abortControllerSubject.next(message);
|