@heavstaltech/api 1.0.4 → 1.2.6

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 CHANGED
@@ -240,6 +240,50 @@ const bufferJP = await tools.tts("Konnichiwa", "ja");
240
240
  fs.writeFileSync("voice.mp3", buffer);
241
241
  ```
242
242
 
243
+
244
+ ### 5. Image Makers (Ephoto360 - Temporarily Unavailable)
245
+
246
+ Generate high-quality text effects like Glitch, Neon, and Gold.
247
+
248
+ **Supported Styles:** `glitchtext`, `writetext`, `advancedglow`, `typographytext`, `pixelglitch`, `neonglitch`, `flagtext`, `flag3dtext`, `deletingtext`, `blackpinkstyle`, `glowingtext`, `underwatertext`, `logomaker`, `cartoonstyle`, `papercutstyle`, `watercolortext`, `effectclouds`, `blackpinklogo`, `gradienttext`, `summerbeach`, `luxurygold`, `multicoloredneon`, `sandsummer`, `galaxywallpaper`, `1917style`, `makingneon`, `royaltext`, `freecreate`, `galaxystyle`, `lighteffects`
249
+
250
+ ```javascript
251
+ import { tools } from '@heavstaltech/api';
252
+
253
+ const imageUrl = await tools.ephoto("glitchtext", "Heavstal Tech");
254
+ console.log(imageUrl);
255
+ // Output: https://en.ephoto360.com/....jpg
256
+ ```
257
+
258
+
259
+ #### Lyrics Search
260
+ Fetch song lyrics and metadata. Uses a robust multi-source engine (LRCLIB + Genius).
261
+
262
+ ```javascript
263
+ import { search } from '@heavstaltech/api';
264
+
265
+ const song = await search.lyrics("Kendrick Lamar DNA");
266
+
267
+ console.log(`Title: ${song.title}`);
268
+ console.log(`Artist: ${song.artist}`);
269
+ console.log(`Lyrics:\n${song.lyrics}`);
270
+ ```
271
+
272
+ #### Zip to Text Extractor (LLM Context)
273
+ Download a remote ZIP file (like a GitHub repo), extract all files recursively, and compile them into a single text buffer. Perfect for feeding codebases to AI & others.
274
+
275
+ ```javascript
276
+ import { tools } from '@heavstaltech/api';
277
+ import fs from 'fs';
278
+
279
+ // 1. Extract from URL
280
+ const { buffer, filename } = await tools.unzip("https://github.com/octocat/Hello-World/archive/master.zip");
281
+
282
+ // 2. Save to file
283
+ fs.writeFileSync(filename, buffer);
284
+ console.log("Extraction complete!");
285
+ ```
286
+
243
287
  ---
244
288
 
245
289
  ## 📝 License
package/dist/index.d.mts CHANGED
@@ -73,6 +73,15 @@ interface TwitterResult {
73
73
  video_hd?: string;
74
74
  audio?: string;
75
75
  }
76
+ interface LyricsResult {
77
+ author: Author;
78
+ status: boolean;
79
+ title: string;
80
+ artist: string;
81
+ image: string;
82
+ url: string;
83
+ lyrics: string;
84
+ }
76
85
 
77
86
  /**
78
87
  * Main TikTok Function
@@ -126,6 +135,14 @@ declare const morse: (input: string, mode?: "encode" | "decode") => Promise<stri
126
135
  declare const tts: (text: string, lang?: string) => Promise<Buffer>;
127
136
  declare const chords: (query: string) => Promise<any>;
128
137
 
138
+ declare const lyrics: (query: string) => Promise<LyricsResult>;
139
+
140
+ declare const unzipToText: (url: string) => Promise<{
141
+ author: typeof AUTHOR;
142
+ buffer: Buffer;
143
+ filename: string;
144
+ }>;
145
+
129
146
  declare const downloader: {
130
147
  tiktok: (input: string) => Promise<TikTokResult>;
131
148
  tiktokSlide: (url: string) => Promise<TikTokResult>;
@@ -141,10 +158,21 @@ declare const search: {
141
158
  youtube: (query: string) => Promise<YouTubeSearchResult[]>;
142
159
  wattpad: (query: string) => Promise<any[]>;
143
160
  chords: (query: string) => Promise<any>;
161
+ lyrics: (query: string) => Promise<LyricsResult>;
144
162
  };
145
163
  declare const tools: {
146
164
  ssweb: (url: string, device?: "desktop" | "tablet" | "phone") => Promise<Buffer>;
147
165
  remini: (imageUrl: string, method?: "enhance" | "recolor" | "dehaze") => Promise<Buffer>;
166
+ unzipToText: (url: string) => Promise<{
167
+ author: typeof AUTHOR;
168
+ buffer: Buffer;
169
+ filename: string;
170
+ }>;
171
+ unzip: (url: string) => Promise<{
172
+ author: typeof AUTHOR;
173
+ buffer: Buffer;
174
+ filename: string;
175
+ }>;
148
176
  styleText: (text: string) => Promise<{
149
177
  author: Author;
150
178
  name: string;
@@ -169,10 +197,21 @@ declare const _default: {
169
197
  youtube: (query: string) => Promise<YouTubeSearchResult[]>;
170
198
  wattpad: (query: string) => Promise<any[]>;
171
199
  chords: (query: string) => Promise<any>;
200
+ lyrics: (query: string) => Promise<LyricsResult>;
172
201
  };
173
202
  tools: {
174
203
  ssweb: (url: string, device?: "desktop" | "tablet" | "phone") => Promise<Buffer>;
175
204
  remini: (imageUrl: string, method?: "enhance" | "recolor" | "dehaze") => Promise<Buffer>;
205
+ unzipToText: (url: string) => Promise<{
206
+ author: typeof AUTHOR;
207
+ buffer: Buffer;
208
+ filename: string;
209
+ }>;
210
+ unzip: (url: string) => Promise<{
211
+ author: typeof AUTHOR;
212
+ buffer: Buffer;
213
+ filename: string;
214
+ }>;
176
215
  styleText: (text: string) => Promise<{
177
216
  author: Author;
178
217
  name: string;
@@ -183,4 +222,4 @@ declare const _default: {
183
222
  };
184
223
  };
185
224
 
186
- 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, tts, twitter, wattpad, twitter as xdl, search$1 as ytSearch, ytmp3, ytmp4 };
225
+ export { AUTHOR, type Author, type LyricsResult, type SocialResult, type TikTokResult, type TwitterResult, type UtilsResult, type YouTubeResult, type YouTubeSearchResult, chords, _default as default, downloader, fbdl, igdl, lyrics, morse, play, remini, search, ssweb, styleText, tiktok, tiktokSlide, tools, tts, twitter, unzipToText, wattpad, twitter as xdl, search$1 as ytSearch, ytmp3, ytmp4 };
package/dist/index.d.ts CHANGED
@@ -73,6 +73,15 @@ interface TwitterResult {
73
73
  video_hd?: string;
74
74
  audio?: string;
75
75
  }
76
+ interface LyricsResult {
77
+ author: Author;
78
+ status: boolean;
79
+ title: string;
80
+ artist: string;
81
+ image: string;
82
+ url: string;
83
+ lyrics: string;
84
+ }
76
85
 
77
86
  /**
78
87
  * Main TikTok Function
@@ -126,6 +135,14 @@ declare const morse: (input: string, mode?: "encode" | "decode") => Promise<stri
126
135
  declare const tts: (text: string, lang?: string) => Promise<Buffer>;
127
136
  declare const chords: (query: string) => Promise<any>;
128
137
 
138
+ declare const lyrics: (query: string) => Promise<LyricsResult>;
139
+
140
+ declare const unzipToText: (url: string) => Promise<{
141
+ author: typeof AUTHOR;
142
+ buffer: Buffer;
143
+ filename: string;
144
+ }>;
145
+
129
146
  declare const downloader: {
130
147
  tiktok: (input: string) => Promise<TikTokResult>;
131
148
  tiktokSlide: (url: string) => Promise<TikTokResult>;
@@ -141,10 +158,21 @@ declare const search: {
141
158
  youtube: (query: string) => Promise<YouTubeSearchResult[]>;
142
159
  wattpad: (query: string) => Promise<any[]>;
143
160
  chords: (query: string) => Promise<any>;
161
+ lyrics: (query: string) => Promise<LyricsResult>;
144
162
  };
145
163
  declare const tools: {
146
164
  ssweb: (url: string, device?: "desktop" | "tablet" | "phone") => Promise<Buffer>;
147
165
  remini: (imageUrl: string, method?: "enhance" | "recolor" | "dehaze") => Promise<Buffer>;
166
+ unzipToText: (url: string) => Promise<{
167
+ author: typeof AUTHOR;
168
+ buffer: Buffer;
169
+ filename: string;
170
+ }>;
171
+ unzip: (url: string) => Promise<{
172
+ author: typeof AUTHOR;
173
+ buffer: Buffer;
174
+ filename: string;
175
+ }>;
148
176
  styleText: (text: string) => Promise<{
149
177
  author: Author;
150
178
  name: string;
@@ -169,10 +197,21 @@ declare const _default: {
169
197
  youtube: (query: string) => Promise<YouTubeSearchResult[]>;
170
198
  wattpad: (query: string) => Promise<any[]>;
171
199
  chords: (query: string) => Promise<any>;
200
+ lyrics: (query: string) => Promise<LyricsResult>;
172
201
  };
173
202
  tools: {
174
203
  ssweb: (url: string, device?: "desktop" | "tablet" | "phone") => Promise<Buffer>;
175
204
  remini: (imageUrl: string, method?: "enhance" | "recolor" | "dehaze") => Promise<Buffer>;
205
+ unzipToText: (url: string) => Promise<{
206
+ author: typeof AUTHOR;
207
+ buffer: Buffer;
208
+ filename: string;
209
+ }>;
210
+ unzip: (url: string) => Promise<{
211
+ author: typeof AUTHOR;
212
+ buffer: Buffer;
213
+ filename: string;
214
+ }>;
176
215
  styleText: (text: string) => Promise<{
177
216
  author: Author;
178
217
  name: string;
@@ -183,4 +222,4 @@ declare const _default: {
183
222
  };
184
223
  };
185
224
 
186
- 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, tts, twitter, wattpad, twitter as xdl, search$1 as ytSearch, ytmp3, ytmp4 };
225
+ export { AUTHOR, type Author, type LyricsResult, type SocialResult, type TikTokResult, type TwitterResult, type UtilsResult, type YouTubeResult, type YouTubeSearchResult, chords, _default as default, downloader, fbdl, igdl, lyrics, morse, play, remini, search, ssweb, styleText, tiktok, tiktokSlide, tools, tts, twitter, unzipToText, wattpad, twitter as xdl, search$1 as ytSearch, ytmp3, ytmp4 };
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ var ytdl = require('@distube/ytdl-core');
8
8
  var yts = require('yt-search');
9
9
  var FormData = require('form-data');
10
10
  var https = require('https');
11
+ var AdmZip = require('adm-zip');
11
12
 
12
13
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
14
 
@@ -35,6 +36,7 @@ var ytdl__default = /*#__PURE__*/_interopDefault(ytdl);
35
36
  var yts__default = /*#__PURE__*/_interopDefault(yts);
36
37
  var FormData__default = /*#__PURE__*/_interopDefault(FormData);
37
38
  var https__default = /*#__PURE__*/_interopDefault(https);
39
+ var AdmZip__default = /*#__PURE__*/_interopDefault(AdmZip);
38
40
 
39
41
  // src/dl/tiktok.ts
40
42
 
@@ -728,6 +730,195 @@ var chords = async (query) => {
728
730
  throw new Error(`Chords Failed: ${error.message}`);
729
731
  }
730
732
  };
733
+ var USER_AGENTS4 = [
734
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
735
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
736
+ ];
737
+ var getRandomHeaders4 = () => ({
738
+ "User-Agent": USER_AGENTS4[Math.floor(Math.random() * USER_AGENTS4.length)]
739
+ });
740
+ var fetchLrcLib = async (query) => {
741
+ const searchUrl = `https://lrclib.net/api/search?q=${encodeURIComponent(query)}`;
742
+ const { data } = await axios4__default.default.get(searchUrl, { headers: getRandomHeaders4() });
743
+ if (!Array.isArray(data) || data.length === 0) {
744
+ throw new Error("No lyrics found on LRCLIB.");
745
+ }
746
+ const track = data.find((t) => t.plainLyrics) || data[0];
747
+ if (!track.plainLyrics && !track.syncedLyrics) {
748
+ throw new Error("Track found but no lyrics content.");
749
+ }
750
+ return {
751
+ author: AUTHOR,
752
+ status: true,
753
+ title: track.trackName,
754
+ artist: track.artistName,
755
+ image: track.albumArt || "https://ibb.co/fVyg0TN6",
756
+ url: `https://lrclib.net/api/get/${track.id}`,
757
+ lyrics: track.plainLyrics || track.syncedLyrics
758
+ };
759
+ };
760
+ var fetchGenius = async (query) => {
761
+ const searchUrl = `https://genius.com/api/search/multi?per_page=1&q=${encodeURIComponent(query)}`;
762
+ const { data } = await axios4__default.default.get(searchUrl, {
763
+ headers: { ...getRandomHeaders4(), "Referer": "https://genius.com/" }
764
+ });
765
+ const hit = data.response?.sections?.find((s) => s.type === "song")?.hits?.[0]?.result;
766
+ if (!hit) throw new Error("No songs found on Genius.");
767
+ return {
768
+ author: AUTHOR,
769
+ status: true,
770
+ title: hit.title,
771
+ artist: hit.artist_names,
772
+ image: hit.song_art_image_thumbnail_url,
773
+ url: hit.url,
774
+ lyrics: `[Lyrics available at source]
775
+ ${hit.url}`
776
+ };
777
+ };
778
+ var lyrics = async (query) => {
779
+ try {
780
+ return await fetchLrcLib(query);
781
+ } catch (lrcError) {
782
+ try {
783
+ return await fetchGenius(query);
784
+ } catch (geniusError) {
785
+ throw new Error(`Lyrics lookup failed. LRCLIB: ${lrcError}. Genius: ${geniusError.message}`);
786
+ }
787
+ }
788
+ };
789
+ var USER_AGENTS5 = [
790
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
791
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
792
+ ];
793
+ var TEXT_EXTENSIONS = [
794
+ "js",
795
+ "ts",
796
+ "jsx",
797
+ "tsx",
798
+ "json",
799
+ "html",
800
+ "css",
801
+ "scss",
802
+ "less",
803
+ "md",
804
+ "txt",
805
+ "yml",
806
+ "yaml",
807
+ "sql",
808
+ "py",
809
+ "java",
810
+ "c",
811
+ "cpp",
812
+ "h",
813
+ "cs",
814
+ "php",
815
+ "rb",
816
+ "go",
817
+ "rs",
818
+ "swift",
819
+ "kt",
820
+ "xml",
821
+ "svg",
822
+ "env",
823
+ "gitignore",
824
+ "dockerfile",
825
+ "sh",
826
+ "bat",
827
+ "conf",
828
+ "ini",
829
+ "properties"
830
+ ];
831
+ var BINARY_EXTENSIONS = [
832
+ "png",
833
+ "jpg",
834
+ "jpeg",
835
+ "gif",
836
+ "webp",
837
+ "ico",
838
+ "bmp",
839
+ "tiff",
840
+ "mp3",
841
+ "wav",
842
+ "ogg",
843
+ "mp4",
844
+ "webm",
845
+ "mov",
846
+ "mkv",
847
+ "zip",
848
+ "tar",
849
+ "gz",
850
+ "7z",
851
+ "rar"
852
+ ];
853
+ var unzipToText = async (url) => {
854
+ try {
855
+ const response = await axios4__default.default.get(url, {
856
+ responseType: "arraybuffer",
857
+ headers: {
858
+ "User-Agent": USER_AGENTS5[Math.floor(Math.random() * USER_AGENTS5.length)]
859
+ }
860
+ });
861
+ const zipBuffer = Buffer.from(response.data);
862
+ const zip = new AdmZip__default.default(zipBuffer);
863
+ const zipEntries = zip.getEntries();
864
+ let output = `EXTRACTED BY HEAVSTAL TECH
865
+ SOURCE: ${url}
866
+ DATE: ${(/* @__PURE__ */ new Date()).toISOString()}
867
+
868
+ `;
869
+ for (const entry of zipEntries) {
870
+ if (entry.isDirectory) continue;
871
+ const path = entry.entryName;
872
+ const ext = path.split(".").pop()?.toLowerCase() || "";
873
+ output += `================================================================================
874
+ `;
875
+ output += `FILE: ${path}
876
+ `;
877
+ output += `================================================================================
878
+ `;
879
+ try {
880
+ if (ext === "pdf") {
881
+ output += `[File contents not extracted - PDF Document]
882
+
883
+ `;
884
+ } else if (BINARY_EXTENSIONS.includes(ext)) {
885
+ const b64 = entry.getData().toString("base64");
886
+ const mime = ext === "mp3" ? "audio/mpeg" : `image/${ext}`;
887
+ output += `data:${mime};base64,${b64}
888
+
889
+ `;
890
+ } else if (TEXT_EXTENSIONS.includes(ext) || !ext) {
891
+ const content = entry.getData().toString("utf8");
892
+ output += `${content}
893
+
894
+ `;
895
+ } else {
896
+ const buffer = entry.getData();
897
+ if (buffer.includes(0)) {
898
+ output += `data:application/octet-stream;base64,${buffer.toString("base64")}
899
+
900
+ `;
901
+ } else {
902
+ output += `${buffer.toString("utf8")}
903
+
904
+ `;
905
+ }
906
+ }
907
+ } catch (err) {
908
+ output += `[Error reading file: ${err.message}]
909
+
910
+ `;
911
+ }
912
+ }
913
+ return {
914
+ author: AUTHOR,
915
+ buffer: Buffer.from(output, "utf-8"),
916
+ filename: "extracted_codebase.txt"
917
+ };
918
+ } catch (error) {
919
+ throw new Error(`Unzip Failed: ${error.message}`);
920
+ }
921
+ };
731
922
 
732
923
  // src/index.ts
733
924
  var downloader = {
@@ -744,14 +935,18 @@ var downloader = {
744
935
  var search2 = {
745
936
  youtube: search,
746
937
  wattpad,
747
- chords
938
+ chords,
939
+ lyrics
748
940
  };
749
941
  var tools = {
750
942
  ssweb,
751
943
  remini,
944
+ unzipToText,
945
+ unzip: unzipToText,
752
946
  styleText,
753
947
  morse,
754
948
  tts
949
+ // ephoto
755
950
  };
756
951
  var index_default = {
757
952
  downloader,
@@ -765,6 +960,7 @@ exports.default = index_default;
765
960
  exports.downloader = downloader;
766
961
  exports.fbdl = fbdl;
767
962
  exports.igdl = igdl;
963
+ exports.lyrics = lyrics;
768
964
  exports.morse = morse;
769
965
  exports.play = play;
770
966
  exports.remini = remini;
@@ -776,6 +972,7 @@ exports.tiktokSlide = tiktokSlide;
776
972
  exports.tools = tools;
777
973
  exports.tts = tts;
778
974
  exports.twitter = twitter;
975
+ exports.unzipToText = unzipToText;
779
976
  exports.wattpad = wattpad;
780
977
  exports.xdl = twitter;
781
978
  exports.ytSearch = search;