@heavstaltech/api 1.0.0 → 1.0.3
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 +42 -0
- package/dist/index.d.mts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +152 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +148 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @heavstaltech/api
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+

|
|
3
5
|

|
|
4
6
|

|
|
5
7
|

|
|
@@ -102,6 +104,29 @@ console.log(fb);
|
|
|
102
104
|
|
|
103
105
|
---
|
|
104
106
|
|
|
107
|
+
#### Twitter / X (Video & Audio)
|
|
108
|
+
Download videos from **Twitter** or **X.com**. Automatically handles link conversion and provides HD/SD options.
|
|
109
|
+
|
|
110
|
+
> **Alias:** You can use `downloader.twitter` or `downloader.xdl`.
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
// Supports both twitter.com and x.com links
|
|
114
|
+
const video = await downloader.xdl("https://x.com/ElonMusk/status/...");
|
|
115
|
+
|
|
116
|
+
console.log(video);
|
|
117
|
+
/* Output:
|
|
118
|
+
{
|
|
119
|
+
status: true,
|
|
120
|
+
desc: "Tweet Caption...",
|
|
121
|
+
thumbnail: "https://...",
|
|
122
|
+
video_sd: "https://...", // Standard Definition
|
|
123
|
+
video_hd: "https://..." // High Definition
|
|
124
|
+
}
|
|
125
|
+
*/
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
105
130
|
### 2. YouTube (Search & Download)
|
|
106
131
|
|
|
107
132
|
**Note:** Powered by `@distube/ytdl-core` and `yt-search`.
|
|
@@ -181,6 +206,23 @@ const fonts = await tools.styleText("Heavstal Tech");
|
|
|
181
206
|
console.log(fonts);
|
|
182
207
|
```
|
|
183
208
|
|
|
209
|
+
#### Morse Code Converter
|
|
210
|
+
Convert text to International Morse Code and vice versa. Supports letters, numbers, and punctuation.
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
import { tools } from '@heavstaltech/api';
|
|
214
|
+
|
|
215
|
+
// 1. Encode (Text -> Morse)
|
|
216
|
+
const encoded = await tools.morse("HELLO WORLD", "encode");
|
|
217
|
+
console.log(encoded);
|
|
218
|
+
// Output: .... . .-.. .-.. --- / .-- --- .-. .-.. -..
|
|
219
|
+
|
|
220
|
+
// 2. Decode (Morse -> Text)
|
|
221
|
+
const decoded = await tools.morse("... --- ...", "decode");
|
|
222
|
+
console.log(decoded);
|
|
223
|
+
// Output: SOS
|
|
224
|
+
```
|
|
225
|
+
|
|
184
226
|
---
|
|
185
227
|
|
|
186
228
|
## 📝 License
|
package/dist/index.d.mts
CHANGED
|
@@ -64,6 +64,15 @@ interface UtilsResult {
|
|
|
64
64
|
status: boolean;
|
|
65
65
|
data: Buffer | string | any;
|
|
66
66
|
}
|
|
67
|
+
interface TwitterResult {
|
|
68
|
+
author: Author;
|
|
69
|
+
status: boolean;
|
|
70
|
+
desc: string;
|
|
71
|
+
thumbnail: string;
|
|
72
|
+
video_sd?: string;
|
|
73
|
+
video_hd?: string;
|
|
74
|
+
audio?: string;
|
|
75
|
+
}
|
|
67
76
|
|
|
68
77
|
/**
|
|
69
78
|
* Main TikTok Function
|
|
@@ -86,6 +95,12 @@ declare const fbdl: (url: string) => Promise<SocialResult[]>;
|
|
|
86
95
|
*/
|
|
87
96
|
declare const igdl: (url: string) => Promise<SocialResult[]>;
|
|
88
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Twitter/X Video Downloader
|
|
100
|
+
* x.com and twitter.com links
|
|
101
|
+
*/
|
|
102
|
+
declare const twitter: (url: string) => Promise<TwitterResult>;
|
|
103
|
+
|
|
89
104
|
declare const search$1: (query: string) => Promise<YouTubeSearchResult[]>;
|
|
90
105
|
declare const ytmp3: (url: string) => Promise<YouTubeResult>;
|
|
91
106
|
declare const ytmp4: (url: string) => Promise<YouTubeResult>;
|
|
@@ -103,6 +118,11 @@ declare const styleText: (text: string) => Promise<{
|
|
|
103
118
|
result: string;
|
|
104
119
|
}[]>;
|
|
105
120
|
declare const wattpad: (query: string) => Promise<any[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Morse Code Engine
|
|
123
|
+
* Encodes Text to Morse OR Decodes Morse to Text
|
|
124
|
+
*/
|
|
125
|
+
declare const morse: (input: string, mode?: "encode" | "decode") => Promise<string>;
|
|
106
126
|
declare const chords: (query: string) => Promise<any>;
|
|
107
127
|
|
|
108
128
|
declare const downloader: {
|
|
@@ -110,6 +130,8 @@ declare const downloader: {
|
|
|
110
130
|
tiktokSlide: (url: string) => Promise<TikTokResult>;
|
|
111
131
|
igdl: (url: string) => Promise<SocialResult[]>;
|
|
112
132
|
fbdl: (url: string) => Promise<SocialResult[]>;
|
|
133
|
+
twitter: (url: string) => Promise<TwitterResult>;
|
|
134
|
+
xdl: (url: string) => Promise<TwitterResult>;
|
|
113
135
|
ytmp3: (url: string) => Promise<YouTubeResult>;
|
|
114
136
|
ytmp4: (url: string) => Promise<YouTubeResult>;
|
|
115
137
|
play: (query: string, type?: "mp3" | "mp4") => Promise<YouTubeResult>;
|
|
@@ -127,6 +149,7 @@ declare const tools: {
|
|
|
127
149
|
name: string;
|
|
128
150
|
result: string;
|
|
129
151
|
}[]>;
|
|
152
|
+
morse: (input: string, mode?: "encode" | "decode") => Promise<string>;
|
|
130
153
|
};
|
|
131
154
|
declare const _default: {
|
|
132
155
|
downloader: {
|
|
@@ -134,6 +157,8 @@ declare const _default: {
|
|
|
134
157
|
tiktokSlide: (url: string) => Promise<TikTokResult>;
|
|
135
158
|
igdl: (url: string) => Promise<SocialResult[]>;
|
|
136
159
|
fbdl: (url: string) => Promise<SocialResult[]>;
|
|
160
|
+
twitter: (url: string) => Promise<TwitterResult>;
|
|
161
|
+
xdl: (url: string) => Promise<TwitterResult>;
|
|
137
162
|
ytmp3: (url: string) => Promise<YouTubeResult>;
|
|
138
163
|
ytmp4: (url: string) => Promise<YouTubeResult>;
|
|
139
164
|
play: (query: string, type?: "mp3" | "mp4") => Promise<YouTubeResult>;
|
|
@@ -151,7 +176,8 @@ declare const _default: {
|
|
|
151
176
|
name: string;
|
|
152
177
|
result: string;
|
|
153
178
|
}[]>;
|
|
179
|
+
morse: (input: string, mode?: "encode" | "decode") => Promise<string>;
|
|
154
180
|
};
|
|
155
181
|
};
|
|
156
182
|
|
|
157
|
-
export { AUTHOR, type Author, type SocialResult, type TikTokResult, type UtilsResult, type YouTubeResult, type YouTubeSearchResult, chords, _default as default, downloader, fbdl, igdl, play, remini, search, ssweb, styleText, tiktok, tiktokSlide, tools, wattpad, search$1 as ytSearch, ytmp3, ytmp4 };
|
|
183
|
+
export { AUTHOR, type Author, type SocialResult, type TikTokResult, type TwitterResult, type UtilsResult, type YouTubeResult, type YouTubeSearchResult, chords, _default as default, downloader, fbdl, igdl, morse, play, remini, search, ssweb, styleText, tiktok, tiktokSlide, tools, twitter, wattpad, twitter as xdl, search$1 as ytSearch, ytmp3, ytmp4 };
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,15 @@ interface UtilsResult {
|
|
|
64
64
|
status: boolean;
|
|
65
65
|
data: Buffer | string | any;
|
|
66
66
|
}
|
|
67
|
+
interface TwitterResult {
|
|
68
|
+
author: Author;
|
|
69
|
+
status: boolean;
|
|
70
|
+
desc: string;
|
|
71
|
+
thumbnail: string;
|
|
72
|
+
video_sd?: string;
|
|
73
|
+
video_hd?: string;
|
|
74
|
+
audio?: string;
|
|
75
|
+
}
|
|
67
76
|
|
|
68
77
|
/**
|
|
69
78
|
* Main TikTok Function
|
|
@@ -86,6 +95,12 @@ declare const fbdl: (url: string) => Promise<SocialResult[]>;
|
|
|
86
95
|
*/
|
|
87
96
|
declare const igdl: (url: string) => Promise<SocialResult[]>;
|
|
88
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Twitter/X Video Downloader
|
|
100
|
+
* x.com and twitter.com links
|
|
101
|
+
*/
|
|
102
|
+
declare const twitter: (url: string) => Promise<TwitterResult>;
|
|
103
|
+
|
|
89
104
|
declare const search$1: (query: string) => Promise<YouTubeSearchResult[]>;
|
|
90
105
|
declare const ytmp3: (url: string) => Promise<YouTubeResult>;
|
|
91
106
|
declare const ytmp4: (url: string) => Promise<YouTubeResult>;
|
|
@@ -103,6 +118,11 @@ declare const styleText: (text: string) => Promise<{
|
|
|
103
118
|
result: string;
|
|
104
119
|
}[]>;
|
|
105
120
|
declare const wattpad: (query: string) => Promise<any[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Morse Code Engine
|
|
123
|
+
* Encodes Text to Morse OR Decodes Morse to Text
|
|
124
|
+
*/
|
|
125
|
+
declare const morse: (input: string, mode?: "encode" | "decode") => Promise<string>;
|
|
106
126
|
declare const chords: (query: string) => Promise<any>;
|
|
107
127
|
|
|
108
128
|
declare const downloader: {
|
|
@@ -110,6 +130,8 @@ declare const downloader: {
|
|
|
110
130
|
tiktokSlide: (url: string) => Promise<TikTokResult>;
|
|
111
131
|
igdl: (url: string) => Promise<SocialResult[]>;
|
|
112
132
|
fbdl: (url: string) => Promise<SocialResult[]>;
|
|
133
|
+
twitter: (url: string) => Promise<TwitterResult>;
|
|
134
|
+
xdl: (url: string) => Promise<TwitterResult>;
|
|
113
135
|
ytmp3: (url: string) => Promise<YouTubeResult>;
|
|
114
136
|
ytmp4: (url: string) => Promise<YouTubeResult>;
|
|
115
137
|
play: (query: string, type?: "mp3" | "mp4") => Promise<YouTubeResult>;
|
|
@@ -127,6 +149,7 @@ declare const tools: {
|
|
|
127
149
|
name: string;
|
|
128
150
|
result: string;
|
|
129
151
|
}[]>;
|
|
152
|
+
morse: (input: string, mode?: "encode" | "decode") => Promise<string>;
|
|
130
153
|
};
|
|
131
154
|
declare const _default: {
|
|
132
155
|
downloader: {
|
|
@@ -134,6 +157,8 @@ declare const _default: {
|
|
|
134
157
|
tiktokSlide: (url: string) => Promise<TikTokResult>;
|
|
135
158
|
igdl: (url: string) => Promise<SocialResult[]>;
|
|
136
159
|
fbdl: (url: string) => Promise<SocialResult[]>;
|
|
160
|
+
twitter: (url: string) => Promise<TwitterResult>;
|
|
161
|
+
xdl: (url: string) => Promise<TwitterResult>;
|
|
137
162
|
ytmp3: (url: string) => Promise<YouTubeResult>;
|
|
138
163
|
ytmp4: (url: string) => Promise<YouTubeResult>;
|
|
139
164
|
play: (query: string, type?: "mp3" | "mp4") => Promise<YouTubeResult>;
|
|
@@ -151,7 +176,8 @@ declare const _default: {
|
|
|
151
176
|
name: string;
|
|
152
177
|
result: string;
|
|
153
178
|
}[]>;
|
|
179
|
+
morse: (input: string, mode?: "encode" | "decode") => Promise<string>;
|
|
154
180
|
};
|
|
155
181
|
};
|
|
156
182
|
|
|
157
|
-
export { AUTHOR, type Author, type SocialResult, type TikTokResult, type UtilsResult, type YouTubeResult, type YouTubeSearchResult, chords, _default as default, downloader, fbdl, igdl, play, remini, search, ssweb, styleText, tiktok, tiktokSlide, tools, wattpad, search$1 as ytSearch, ytmp3, ytmp4 };
|
|
183
|
+
export { AUTHOR, type Author, type SocialResult, type TikTokResult, type TwitterResult, type UtilsResult, type YouTubeResult, type YouTubeSearchResult, chords, _default as default, downloader, fbdl, igdl, morse, play, remini, search, ssweb, styleText, tiktok, tiktokSlide, tools, twitter, wattpad, twitter as xdl, search$1 as ytSearch, ytmp3, ytmp4 };
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var axios4 = require('axios');
|
|
6
|
+
var cheerio4 = require('cheerio');
|
|
7
7
|
var ytdl = require('@distube/ytdl-core');
|
|
8
8
|
var yts = require('yt-search');
|
|
9
9
|
var FormData = require('form-data');
|
|
@@ -29,8 +29,8 @@ function _interopNamespace(e) {
|
|
|
29
29
|
return Object.freeze(n);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
var
|
|
33
|
-
var
|
|
32
|
+
var axios4__default = /*#__PURE__*/_interopDefault(axios4);
|
|
33
|
+
var cheerio4__namespace = /*#__PURE__*/_interopNamespace(cheerio4);
|
|
34
34
|
var ytdl__default = /*#__PURE__*/_interopDefault(ytdl);
|
|
35
35
|
var yts__default = /*#__PURE__*/_interopDefault(yts);
|
|
36
36
|
var FormData__default = /*#__PURE__*/_interopDefault(FormData);
|
|
@@ -60,7 +60,7 @@ var cleanText = (str) => str ? str.replace(/(<br?\s?\/?>)/gi, " \n").replace(/(<
|
|
|
60
60
|
var cleanUrl = (url) => url ? url.replace("https:", "http:") : "";
|
|
61
61
|
var lovetikFallback = async (url) => {
|
|
62
62
|
try {
|
|
63
|
-
const { data } = await
|
|
63
|
+
const { data } = await axios4__default.default.post(
|
|
64
64
|
"https://lovetik.com/api/ajax/search",
|
|
65
65
|
new URLSearchParams({ query: url }),
|
|
66
66
|
{ headers: getRandomHeaders() }
|
|
@@ -90,12 +90,12 @@ var tiktok = async (input) => {
|
|
|
90
90
|
try {
|
|
91
91
|
if (isUrl) {
|
|
92
92
|
const apiUrl = `https://www.tikwm.com/api/?url=${encodeURIComponent(input)}`;
|
|
93
|
-
const response = await
|
|
93
|
+
const response = await axios4__default.default.get(apiUrl, { headers: getRandomHeaders() });
|
|
94
94
|
if (response.data.code !== 0) throw new Error("Private video or Invalid URL");
|
|
95
95
|
data = response.data.data;
|
|
96
96
|
} else {
|
|
97
97
|
const apiUrl = `https://www.tikwm.com/api/feed/search`;
|
|
98
|
-
const response = await
|
|
98
|
+
const response = await axios4__default.default.post(
|
|
99
99
|
apiUrl,
|
|
100
100
|
new URLSearchParams({
|
|
101
101
|
keywords: input,
|
|
@@ -146,7 +146,7 @@ var tiktok = async (input) => {
|
|
|
146
146
|
};
|
|
147
147
|
var tiktokSlide = async (url) => {
|
|
148
148
|
try {
|
|
149
|
-
const response = await
|
|
149
|
+
const response = await axios4__default.default.post("https://api.ttsave.app/", {
|
|
150
150
|
id: url,
|
|
151
151
|
hash: "1e3a27c51eb6370b0db6f9348a481d69",
|
|
152
152
|
mode: "slide",
|
|
@@ -156,7 +156,7 @@ var tiktokSlide = async (url) => {
|
|
|
156
156
|
}, {
|
|
157
157
|
headers: getRandomHeaders()
|
|
158
158
|
});
|
|
159
|
-
const $ =
|
|
159
|
+
const $ = cheerio4__namespace.load(response.data);
|
|
160
160
|
const $element = $("div.flex.flex-col.items-center.justify-center.mt-2.mb-5");
|
|
161
161
|
if ($element.length === 0) throw new Error("Slide not found or service unavailable");
|
|
162
162
|
const statsDiv = $element.find("div.flex.flex-row.items-center.justify-center");
|
|
@@ -199,7 +199,7 @@ var getRandomHeaders2 = () => ({
|
|
|
199
199
|
var fbdl = async (url) => {
|
|
200
200
|
return new Promise(async (resolve, reject) => {
|
|
201
201
|
try {
|
|
202
|
-
const { data } = await
|
|
202
|
+
const { data } = await axios4__default.default.post(
|
|
203
203
|
"https://getmyfb.com/process",
|
|
204
204
|
new URLSearchParams({
|
|
205
205
|
id: url,
|
|
@@ -214,7 +214,7 @@ var fbdl = async (url) => {
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
);
|
|
217
|
-
const $ =
|
|
217
|
+
const $ = cheerio4__namespace.load(data);
|
|
218
218
|
const results = [];
|
|
219
219
|
const title = $("div.results-item-text").eq(0).text().trim();
|
|
220
220
|
const thumbnail = $(".results-item-image-wrapper img").attr("src") || "";
|
|
@@ -260,16 +260,16 @@ var fbdl = async (url) => {
|
|
|
260
260
|
var igdl = async (url) => {
|
|
261
261
|
return new Promise(async (resolve, reject) => {
|
|
262
262
|
try {
|
|
263
|
-
const initialResponse = await
|
|
263
|
+
const initialResponse = await axios4__default.default.get("https://indown.io/", {
|
|
264
264
|
headers: getRandomHeaders2()
|
|
265
265
|
});
|
|
266
|
-
const _$ =
|
|
266
|
+
const _$ = cheerio4__namespace.load(initialResponse.data);
|
|
267
267
|
const referer = _$("input[name=referer]").val();
|
|
268
268
|
const locale = _$("input[name=locale]").val();
|
|
269
269
|
const _token = _$("input[name=_token]").val();
|
|
270
270
|
const cookies = initialResponse.headers["set-cookie"]?.join(" ") || "";
|
|
271
271
|
if (!_token) throw new Error("Failed to fetch Instagram token");
|
|
272
|
-
const { data } = await
|
|
272
|
+
const { data } = await axios4__default.default.post(
|
|
273
273
|
"https://indown.io/download",
|
|
274
274
|
new URLSearchParams({
|
|
275
275
|
link: url,
|
|
@@ -287,7 +287,7 @@ var igdl = async (url) => {
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
);
|
|
290
|
-
const $ =
|
|
290
|
+
const $ = cheerio4__namespace.load(data);
|
|
291
291
|
const result = [];
|
|
292
292
|
$("video").each(function() {
|
|
293
293
|
const $$ = $(this);
|
|
@@ -344,6 +344,53 @@ var igdl = async (url) => {
|
|
|
344
344
|
}
|
|
345
345
|
});
|
|
346
346
|
};
|
|
347
|
+
var USER_AGENTS3 = [
|
|
348
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
|
|
349
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
|
|
350
|
+
];
|
|
351
|
+
var getRandomHeaders3 = () => ({
|
|
352
|
+
"User-Agent": USER_AGENTS3[Math.floor(Math.random() * USER_AGENTS3.length)],
|
|
353
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
354
|
+
"Origin": "https://twdown.net",
|
|
355
|
+
"Referer": "https://twdown.net/"
|
|
356
|
+
});
|
|
357
|
+
var twitter = async (url) => {
|
|
358
|
+
return new Promise(async (resolve, reject) => {
|
|
359
|
+
try {
|
|
360
|
+
const cleanUrl2 = url.replace("x.com", "twitter.com");
|
|
361
|
+
const config = new URLSearchParams({ URL: cleanUrl2 });
|
|
362
|
+
const { data } = await axios4__default.default.post("https://twdown.net/download.php", config, {
|
|
363
|
+
headers: getRandomHeaders3()
|
|
364
|
+
});
|
|
365
|
+
const $ = cheerio4__namespace.load(data);
|
|
366
|
+
const desc = $("div:nth-child(1) > div:nth-child(2) > p").text().trim();
|
|
367
|
+
const thumb = $("div:nth-child(1) > img").attr("src");
|
|
368
|
+
const video_hd = $("tbody > tr:nth-child(1) > td:nth-child(4) > a").attr("href");
|
|
369
|
+
const video_sd = $("tr:nth-child(2) > td:nth-child(4) > a").attr("href");
|
|
370
|
+
let audio = $("body > div.jumbotron > div > center > div.row > div > div:nth-child(5) > table > tbody > tr:nth-child(3) > td:nth-child(4) > a").attr("href");
|
|
371
|
+
if (audio && !audio.startsWith("http")) audio = "https://twdown.net/" + audio;
|
|
372
|
+
if (!video_sd && !video_hd) {
|
|
373
|
+
throw new Error("No media found. Account might be private or link is invalid.");
|
|
374
|
+
}
|
|
375
|
+
const result = {
|
|
376
|
+
author: AUTHOR,
|
|
377
|
+
status: true,
|
|
378
|
+
desc: desc || "X/Twitter Video",
|
|
379
|
+
thumbnail: thumb || "",
|
|
380
|
+
video_sd,
|
|
381
|
+
video_hd,
|
|
382
|
+
audio
|
|
383
|
+
};
|
|
384
|
+
resolve(result);
|
|
385
|
+
} catch (error) {
|
|
386
|
+
reject({
|
|
387
|
+
author: AUTHOR,
|
|
388
|
+
status: false,
|
|
389
|
+
message: error.message || "X/Twitter Download Failed"
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
};
|
|
347
394
|
var search = async (query) => {
|
|
348
395
|
return new Promise(async (resolve, reject) => {
|
|
349
396
|
try {
|
|
@@ -471,12 +518,72 @@ var ignoreSSL = new https__default.default.Agent({
|
|
|
471
518
|
rejectUnauthorized: false,
|
|
472
519
|
servername: "inferenceengine.vyro.ai"
|
|
473
520
|
});
|
|
521
|
+
var MORSE_MAP = {
|
|
522
|
+
"A": ".-",
|
|
523
|
+
"B": "-...",
|
|
524
|
+
"C": "-.-.",
|
|
525
|
+
"D": "-..",
|
|
526
|
+
"E": ".",
|
|
527
|
+
"F": "..-.",
|
|
528
|
+
"G": "--.",
|
|
529
|
+
"H": "....",
|
|
530
|
+
"I": "..",
|
|
531
|
+
"J": ".---",
|
|
532
|
+
"K": "-.-",
|
|
533
|
+
"L": ".-..",
|
|
534
|
+
"M": "--",
|
|
535
|
+
"N": "-.",
|
|
536
|
+
"O": "---",
|
|
537
|
+
"P": ".--.",
|
|
538
|
+
"Q": "--.-",
|
|
539
|
+
"R": ".-.",
|
|
540
|
+
"S": "...",
|
|
541
|
+
"T": "-",
|
|
542
|
+
"U": "..-",
|
|
543
|
+
"V": "...-",
|
|
544
|
+
"W": ".--",
|
|
545
|
+
"X": "-..-",
|
|
546
|
+
"Y": "-.--",
|
|
547
|
+
"Z": "--..",
|
|
548
|
+
"0": "-----",
|
|
549
|
+
"1": ".----",
|
|
550
|
+
"2": "..---",
|
|
551
|
+
"3": "...--",
|
|
552
|
+
"4": "....-",
|
|
553
|
+
"5": ".....",
|
|
554
|
+
"6": "-....",
|
|
555
|
+
"7": "--...",
|
|
556
|
+
"8": "---..",
|
|
557
|
+
"9": "----.",
|
|
558
|
+
".": ".-.-.-",
|
|
559
|
+
",": "--..--",
|
|
560
|
+
"?": "..--..",
|
|
561
|
+
"'": ".----.",
|
|
562
|
+
"!": "-.-.--",
|
|
563
|
+
"/": "-..-.",
|
|
564
|
+
"(": "-.--.",
|
|
565
|
+
")": "-.--.-",
|
|
566
|
+
"&": ".-...",
|
|
567
|
+
":": "---...",
|
|
568
|
+
";": "-.-.-.",
|
|
569
|
+
"=": "-...-",
|
|
570
|
+
"+": ".-.-.",
|
|
571
|
+
"-": "-....-",
|
|
572
|
+
"_": "..--.-",
|
|
573
|
+
'"': ".-..-.",
|
|
574
|
+
"$": "...-..-",
|
|
575
|
+
"@": ".--.-.",
|
|
576
|
+
" ": "/"
|
|
577
|
+
};
|
|
578
|
+
var REVERSE_MORSE = Object.fromEntries(
|
|
579
|
+
Object.entries(MORSE_MAP).map(([char, code]) => [code, char])
|
|
580
|
+
);
|
|
474
581
|
var ssweb = async (url, device = "desktop") => {
|
|
475
582
|
return new Promise(async (resolve, reject) => {
|
|
476
583
|
try {
|
|
477
584
|
const baseURL = "https://www.screenshotmachine.com";
|
|
478
585
|
const param = { url, device, cacheLimit: 0 };
|
|
479
|
-
const { data, headers } = await
|
|
586
|
+
const { data, headers } = await axios4__default.default.post(
|
|
480
587
|
`${baseURL}/capture.php`,
|
|
481
588
|
new URLSearchParams(param),
|
|
482
589
|
{
|
|
@@ -485,7 +592,7 @@ var ssweb = async (url, device = "desktop") => {
|
|
|
485
592
|
);
|
|
486
593
|
if (data.status !== "success") throw new Error("Screenshot generation failed");
|
|
487
594
|
const cookies = headers["set-cookie"]?.join("") || "";
|
|
488
|
-
const imageResponse = await
|
|
595
|
+
const imageResponse = await axios4__default.default.get(`${baseURL}/${data.link}`, {
|
|
489
596
|
headers: { "cookie": cookies, "User-Agent": HEADERS["User-Agent"] },
|
|
490
597
|
responseType: "arraybuffer"
|
|
491
598
|
});
|
|
@@ -500,7 +607,7 @@ var remini = async (imageUrl, method = "enhance") => {
|
|
|
500
607
|
try {
|
|
501
608
|
const validMethods = ["enhance", "recolor", "dehaze"];
|
|
502
609
|
const selectedMethod = validMethods.includes(method) ? method : "enhance";
|
|
503
|
-
const imgBuffer = await
|
|
610
|
+
const imgBuffer = await axios4__default.default.get(imageUrl, { responseType: "arraybuffer" });
|
|
504
611
|
const form = new FormData__default.default();
|
|
505
612
|
form.append("model_version", 1, {
|
|
506
613
|
header: { "Content-Transfer-Encoding": "binary", "contentType": "multipart/form-data; charset=utf-8" }
|
|
@@ -510,7 +617,7 @@ var remini = async (imageUrl, method = "enhance") => {
|
|
|
510
617
|
contentType: "image/jpeg"
|
|
511
618
|
});
|
|
512
619
|
const url = `https://inferenceengine.vyro.ai/${selectedMethod}`;
|
|
513
|
-
const response = await
|
|
620
|
+
const response = await axios4__default.default.post(url, form, {
|
|
514
621
|
headers: {
|
|
515
622
|
...form.getHeaders(),
|
|
516
623
|
"User-Agent": "okhttp/4.9.3",
|
|
@@ -529,8 +636,8 @@ var remini = async (imageUrl, method = "enhance") => {
|
|
|
529
636
|
var styleText = async (text) => {
|
|
530
637
|
return new Promise(async (resolve, reject) => {
|
|
531
638
|
try {
|
|
532
|
-
const { data } = await
|
|
533
|
-
const $ =
|
|
639
|
+
const { data } = await axios4__default.default.get(`http://qaz.wtf/u/convert.cgi?text=${encodeURIComponent(text)}`);
|
|
640
|
+
const $ = cheerio4__namespace.load(data);
|
|
534
641
|
const result = [];
|
|
535
642
|
$("table > tbody > tr").each((i, el) => {
|
|
536
643
|
const name = $(el).find("td").first().text().trim();
|
|
@@ -547,8 +654,8 @@ var styleText = async (text) => {
|
|
|
547
654
|
};
|
|
548
655
|
var wattpad = async (query) => {
|
|
549
656
|
try {
|
|
550
|
-
const { data } = await
|
|
551
|
-
const $ =
|
|
657
|
+
const { data } = await axios4__default.default.get(`https://www.wattpad.com/search/${encodeURIComponent(query)}`, { headers: HEADERS });
|
|
658
|
+
const $ = cheerio4__namespace.load(data);
|
|
552
659
|
const results = [];
|
|
553
660
|
$(".story-card").each((i, el) => {
|
|
554
661
|
const title = $(el).find(".story-title").text().trim();
|
|
@@ -567,15 +674,26 @@ var wattpad = async (query) => {
|
|
|
567
674
|
throw new Error(`Wattpad Failed: ${error.message}`);
|
|
568
675
|
}
|
|
569
676
|
};
|
|
677
|
+
var morse = async (input, mode = "encode") => {
|
|
678
|
+
return new Promise((resolve) => {
|
|
679
|
+
if (mode === "encode") {
|
|
680
|
+
const result = input.toUpperCase().split("").map((char) => MORSE_MAP[char] || char).join(" ");
|
|
681
|
+
resolve(result);
|
|
682
|
+
} else {
|
|
683
|
+
const result = input.split(" ").map((code) => REVERSE_MORSE[code] || (code === "/" ? " " : code)).join("").replace(/\s+/g, " ").trim();
|
|
684
|
+
resolve(result);
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
};
|
|
570
688
|
var chords = async (query) => {
|
|
571
689
|
try {
|
|
572
690
|
const searchUrl = `https://www.gitagram.com/?s=${encodeURIComponent(query).replace(/%20/g, "+")}`;
|
|
573
|
-
const { data } = await
|
|
574
|
-
const $ =
|
|
691
|
+
const { data } = await axios4__default.default.get(searchUrl, { headers: HEADERS });
|
|
692
|
+
const $ = cheerio4__namespace.load(data);
|
|
575
693
|
const firstResultUrl = $("table.table > tbody > tr").eq(0).find("td").eq(0).find("a").eq(0).attr("href");
|
|
576
694
|
if (!firstResultUrl) throw new Error("No chords found");
|
|
577
|
-
const songPage = await
|
|
578
|
-
const $song =
|
|
695
|
+
const songPage = await axios4__default.default.get(firstResultUrl, { headers: HEADERS });
|
|
696
|
+
const $song = cheerio4__namespace.load(songPage.data);
|
|
579
697
|
const $hcontent = $song("div.hcontent");
|
|
580
698
|
const artist = $hcontent.find("div > a > span.subtitle").text().trim();
|
|
581
699
|
const title = $hcontent.find("h1.title").text().trim();
|
|
@@ -592,6 +710,8 @@ var downloader = {
|
|
|
592
710
|
tiktokSlide,
|
|
593
711
|
igdl,
|
|
594
712
|
fbdl,
|
|
713
|
+
twitter,
|
|
714
|
+
xdl: twitter,
|
|
595
715
|
ytmp3,
|
|
596
716
|
ytmp4,
|
|
597
717
|
play
|
|
@@ -604,7 +724,8 @@ var search2 = {
|
|
|
604
724
|
var tools = {
|
|
605
725
|
ssweb,
|
|
606
726
|
remini,
|
|
607
|
-
styleText
|
|
727
|
+
styleText,
|
|
728
|
+
morse
|
|
608
729
|
};
|
|
609
730
|
var index_default = {
|
|
610
731
|
downloader,
|
|
@@ -618,6 +739,7 @@ exports.default = index_default;
|
|
|
618
739
|
exports.downloader = downloader;
|
|
619
740
|
exports.fbdl = fbdl;
|
|
620
741
|
exports.igdl = igdl;
|
|
742
|
+
exports.morse = morse;
|
|
621
743
|
exports.play = play;
|
|
622
744
|
exports.remini = remini;
|
|
623
745
|
exports.search = search2;
|
|
@@ -626,7 +748,9 @@ exports.styleText = styleText;
|
|
|
626
748
|
exports.tiktok = tiktok;
|
|
627
749
|
exports.tiktokSlide = tiktokSlide;
|
|
628
750
|
exports.tools = tools;
|
|
751
|
+
exports.twitter = twitter;
|
|
629
752
|
exports.wattpad = wattpad;
|
|
753
|
+
exports.xdl = twitter;
|
|
630
754
|
exports.ytSearch = search;
|
|
631
755
|
exports.ytmp3 = ytmp3;
|
|
632
756
|
exports.ytmp4 = ytmp4;
|