devstok commited on
Commit
1fef695
·
verified ·
1 Parent(s): 6f55a1e

Upload 2 files

Browse files
Files changed (2) hide show
  1. plugins/animeupdate.js +122 -0
  2. plugins/samehadaku.js +250 -0
plugins/animeupdate.js ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const fetch = require('node-fetch');
2
+ const { generateWAMessageFromContent, prepareWAMessageMedia } = require('@adiwajshing/baileys');
3
+ const { proto } = require('@adiwajshing/baileys');
4
+
5
+ let handler = async (m, { conn, text, usedPrefix, command }) => {
6
+ let response = await fetch("https://api.jikan.moe/v4/seasons/now?filter=tv");
7
+ let data = await response.json();
8
+
9
+ // Ambil data anime dengan detail
10
+ let animeList = await Promise.all(data.data.map(async anime => {
11
+ return {
12
+ imageUrl: anime.images.jpg.large_image_url,
13
+ title: anime.title,
14
+ genres: anime.genres,
15
+ type: anime.type,
16
+ season: anime.season,
17
+ year: anime.year,
18
+ source: anime.source,
19
+ episodes: anime.episodes,
20
+ status: anime.status,
21
+ duration: anime.duration,
22
+ studios: anime.studios,
23
+ rating: anime.rating,
24
+ score: anime.score,
25
+ popularity: anime.popularity
26
+ };
27
+ }));
28
+
29
+ const createImageMessage = async (url) => {
30
+ const { imageMessage } = await prepareWAMessageMedia({ image: { url } }, { upload: conn.waUploadToServer });
31
+ return imageMessage;
32
+ }
33
+
34
+ const cards = await Promise.all(animeList.map(async (a) => {
35
+ const imageMessage = await createImageMessage(a.imageUrl);
36
+
37
+ // Deskripsi anime yang lebih lengkap
38
+ const description = `*• Title:* ${a.title}
39
+ *• Genre:* *[ ${a.genres.map(g => g.name).join(", ")} ]*
40
+ *• Type:* ${a.type}
41
+ *• Season:* ${a.season} *[ ${a.year} ]*
42
+ *• Source:* ${a.source}
43
+ *• Total episodes:* ${a.episodes}
44
+ *• Status:* ${a.status}
45
+ *• Duration:* ${a.duration}
46
+ *• Studio:* *[ ${a.studios.map(s => s.name).join(", ")} ]*
47
+ *• Rating:* ${a.rating}
48
+ *• Score:* ${a.score}/10.0
49
+ *• Popularity:* ${a.popularity}`;
50
+
51
+ return {
52
+ body: proto.Message.InteractiveMessage.Body.fromObject({
53
+ text: description,
54
+ }),
55
+ footer: proto.Message.InteractiveMessage.Footer.fromObject({
56
+ text: "Powered by Jikan API",
57
+ }),
58
+ header: proto.Message.InteractiveMessage.Header.fromObject({
59
+ title: '',
60
+ hasMediaAttachment: true,
61
+ imageMessage: imageMessage,
62
+ }),
63
+ nativeFlowMessage: proto.Message.InteractiveMessage.NativeFlowMessage.fromObject({
64
+ buttons: [
65
+ {
66
+ name: "cta_url",
67
+ buttonParamsJson: JSON.stringify({
68
+ display_text: "Lihat Gambar",
69
+ cta_type: "1",
70
+ url: a.imageUrl
71
+ })
72
+ }
73
+ // Tombol "SEARCH AGAIN" dihapus
74
+ ]
75
+ })
76
+ };
77
+ }));
78
+
79
+ // Kirim pesan interaktif
80
+ const interactiveMessage = proto.Message.InteractiveMessage.create({
81
+ body: proto.Message.InteractiveMessage.Body.fromObject({
82
+ text: "List of Anime Images",
83
+ }),
84
+ footer: proto.Message.InteractiveMessage.Footer.fromObject({
85
+ text: "Powered by Jikan API",
86
+ }),
87
+ header: proto.Message.InteractiveMessage.Header.fromObject({
88
+ title: "Anime Carousel",
89
+ hasMediaAttachment: false,
90
+ }),
91
+ carouselMessage: proto.Message.InteractiveMessage.CarouselMessage.fromObject({
92
+ cards: cards,
93
+ }),
94
+ });
95
+
96
+ const messageContent = proto.Message.fromObject({
97
+ viewOnceMessage: {
98
+ message: {
99
+ messageContextInfo: {
100
+ deviceListMetadata: {},
101
+ deviceListMetadataVersion: 2,
102
+ },
103
+ interactiveMessage,
104
+ },
105
+ },
106
+ });
107
+
108
+ const msgs = await generateWAMessageFromContent(m.chat, messageContent, {
109
+ userJid: conn.user.jid,
110
+ quoted: m,
111
+ upload: conn.waUploadToServer,
112
+ });
113
+
114
+ await conn.relayMessage(m.chat, msgs.message, {
115
+ messageId: msgs.key.id,
116
+ });
117
+ };
118
+
119
+ handler.help = ["animeupdate"];
120
+ handler.tags = ["anime"];
121
+ handler.command = ["animeupdate"];
122
+ module.exports = handler;
plugins/samehadaku.js ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //© AkiraaBot 2023-2024
2
+ // • Credits : wa.me/6287869975929 [ Bang syaii ]
3
+ // • Owner: 6287869975929,6283831945469
4
+
5
+ /*
6
+ • untuk siapa pun yang ketahuan menjual script ini tanpa sepengetahuan developer mohon untuk dilaporkan !
7
+ */
8
+
9
+ const axios = require("axios");
10
+ const cheerio = require("cheerio");
11
+
12
+ class Samehada {
13
+ latest = async () => {
14
+ try {
15
+ let { data } = await axios.get("https://samehadaku.email/anime-terbaru/");
16
+ let $ = cheerio.load(data);
17
+ const posts = [];
18
+ $(".post-show li").each((index, element) => {
19
+ const title = $(element).find(".entry-title a").attr("title");
20
+ const link = $(element).find(".entry-title a").attr("href");
21
+ const author = $(element).find('[itemprop="author"] author').text();
22
+ const date = $(element)
23
+ .find(".dashicons-calendar")
24
+ .parent()
25
+ .text()
26
+ .replace("Released on:", "")
27
+ .trim();
28
+ posts.push({
29
+ title,
30
+ author,
31
+ date,
32
+ link,
33
+ });
34
+ });
35
+ return posts;
36
+ } catch (error) {
37
+ console.error(error);
38
+ return [];
39
+ }
40
+ };
41
+ search = async (text) => {
42
+ const { data } = await axios.get("https://samehadaku.email");
43
+ const $ = cheerio.load(data);
44
+ const scriptContent = $("#live_search-js-extra").html();
45
+ const nonceMatch = scriptContent.match(/"nonce":"([^"]+)"/);
46
+ const nonce = nonceMatch ? nonceMatch[1] : null;
47
+
48
+ try {
49
+ let { data: result } = await axios.get(
50
+ `https://samehadaku.email/wp-json/eastheme/search/?keyword=${text}&nonce=${nonce}`,
51
+ );
52
+ let objek = Object.values(result).map((v) => v);
53
+ return objek;
54
+ } catch (e) {
55
+ return {
56
+ msg: e,
57
+ };
58
+ }
59
+ };
60
+ detail = async (url) => {
61
+ try {
62
+ const response = await axios.get(url);
63
+ const $ = cheerio.load(response.data);
64
+
65
+ const title = $("h1.entry-title").text().trim();
66
+ const author = "shannz";
67
+ const image = $(".thumb img").attr("src");
68
+ const rating = $('.rtg span[itemprop="ratingValue"]').text().trim();
69
+ const description = $(".entry-content-single").text().trim();
70
+
71
+ const genres = [];
72
+ $(".genre-info a").each((i, el) => {
73
+ genres.push($(el).text().trim());
74
+ });
75
+
76
+ const episodes = [];
77
+ $(".lstepsiode.listeps li").each((i, el) => {
78
+ const episodeNumber = $(el).find(".epsright .eps a").text().trim();
79
+ const episodeTitle = $(el).find(".epsleft .lchx a").text().trim();
80
+ const episodeUrl = $(el).find(".epsleft .lchx a").attr("href");
81
+ const episodeDate = $(el).find(".epsleft .date").text().trim();
82
+
83
+ episodes.push({
84
+ number: episodeNumber,
85
+ title: episodeTitle,
86
+ url: episodeUrl,
87
+ date: episodeDate,
88
+ });
89
+ });
90
+
91
+ return {
92
+ author,
93
+ title,
94
+ image,
95
+ rating,
96
+ description,
97
+ genres,
98
+ episodes,
99
+ };
100
+ } catch (error) {
101
+ console.error("Error scraping anime:", error);
102
+ return null;
103
+ }
104
+ };
105
+ download = async (url) => {
106
+ if (!url.includes("samehadaku.email")) {
107
+ throw new Error("URL tidak valid");
108
+ }
109
+
110
+ try {
111
+ const response = await axios.get(url);
112
+ const $ = cheerio.load(response.data);
113
+ const result = {
114
+ judul: $("h1.entry-title").text().trim(),
115
+ url: url,
116
+ unduhan: [],
117
+ };
118
+
119
+ const serverList = $("div#server > ul > li");
120
+
121
+ for (let i = 0; i < serverList.length; i++) {
122
+ const server = $(serverList[i]);
123
+ const serverInfo = {
124
+ nama: server.find("span").text().trim(),
125
+ tipeServer: server.find("div").attr("data-type"),
126
+ nomorServer: server.find("div").attr("data-nume"),
127
+ postId: server.find("div").attr("data-post"),
128
+ };
129
+
130
+ const formData = new URLSearchParams();
131
+ formData.append("action", "player_ajax");
132
+ formData.append("post", serverInfo.postId);
133
+ formData.append("nume", serverInfo.nomorServer);
134
+ formData.append("type", serverInfo.tipeServer);
135
+
136
+ const linkResponse = await axios.post(
137
+ "https://samehadaku.email/wp-admin/admin-ajax.php",
138
+ formData,
139
+ {
140
+ headers: {
141
+ "User-Agent":
142
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
143
+ Origin: "https://samehadaku.email",
144
+ "Content-Type": "application/x-www-form-urlencoded",
145
+ },
146
+ },
147
+ );
148
+
149
+ const $link = cheerio.load(linkResponse.data);
150
+ serverInfo.tautan = $link("iframe").attr("src");
151
+
152
+ result.unduhan.push(serverInfo);
153
+ }
154
+
155
+ return result;
156
+ } catch (error) {
157
+ console.error("Terjadi kesalahan:", error.message);
158
+ throw error;
159
+ }
160
+ };
161
+ }
162
+
163
+ const handler = async (m, { conn, args, usedPrefix, text, command }) => {
164
+ let lister = ["search", "detail", "pdf"];
165
+ if (!text)
166
+ throw `*[ SHINIGAMI EXAMPLE ]*
167
+ > *• Example :* ${usedPrefix + command} search *[query]*
168
+ > *• Example :* ${usedPrefix + command} detail *[url]*
169
+ > *• Example :* ${usedPrefix + command} episode *[url]*`;
170
+ let feature = text.split(" ")[0];
171
+ let inputs = text.slice(feature.length + 1);
172
+ let same = new Samehada();
173
+ if ("search" === feature) {
174
+ if (!inputs) throw `*• Example :* ${usedPrefix + command} search *[query]*`;
175
+ m.reply(wait);
176
+ try {
177
+ let res = await same.search(inputs);
178
+ let cap =
179
+ `Type a command
180
+ ${usedPrefix + command} detail *[url]* for Get detail!\n\n` +
181
+ res
182
+ .map(
183
+ (a, i) => `*${i + 1}.* ${a.title}
184
+ *• Type :* ${a.data.type}
185
+ *• Score :* ${a.data.score}
186
+ *• Genre :* ${a.data.genre}
187
+ *• Url :* ${a.url}`,
188
+ )
189
+ .join("\n\n");
190
+ m.reply(cap, res[0].img);
191
+ } catch (e) {
192
+ throw e;
193
+ }
194
+ }
195
+ if ("detail" === feature) {
196
+ if (!inputs) throw `*• Example :* ${usedPrefix + command} detail *[url]*`;
197
+ try {
198
+ let resl = await same.detail(inputs);
199
+ let cap = `*${resl.title}*
200
+ *• Score :* ${resl.rating}
201
+ *• Genre :* ${resl.genres.join(", ")}
202
+ ${resl.description || ""}
203
+
204
+ Type a command
205
+ ${usedPrefix + command} episode *[url]* for Get video!
206
+
207
+ ${resl.episodes
208
+ .map(
209
+ (a) => `*• Title :* ${a.title}
210
+ *• Date :* ${a.date}
211
+ *• Url :* ${a.url}`,
212
+ )
213
+ .join("\n\n")}`;
214
+ await conn.sendFile(m.chat, resl.image, "", cap, m);
215
+ } catch (e) {
216
+ throw e;
217
+ }
218
+ }
219
+ if ("episode" === feature) {
220
+ if (!inputs) throw `*• Example :* ${usedPrefix + command} episode *[url]*`;
221
+ try {
222
+ let buff = await same.download(inputs);
223
+ let hasil = buff.unduhan.find((a) => a.tautan.endsWith(".mp4"));
224
+ let q = await conn.sendMessage(m.chat, {
225
+ text: `*• Title :* ${buff.judul}\n*• Url :* ${buff.url}\n*• Resolution :* ${hasil.nama}\n*• Download :* ${hasil.tautan}`,
226
+ });
227
+ await conn.sendMessage(
228
+ m.chat,
229
+ {
230
+ document: {
231
+ url: hasil.tautan,
232
+ },
233
+ caption: buff.utl,
234
+ fileName: buff.judul + ".mp4",
235
+ mimetype: "video/mp4",
236
+ },
237
+ {
238
+ quoted: q,
239
+ },
240
+ );
241
+ } catch (e) {
242
+ throw e;
243
+ }
244
+ }
245
+ };
246
+ handler.help = ["samehadaku", "samehada"].map((a) => a + " *[options]*");
247
+ handler.tags = ["anime"];
248
+ handler.command = ["samehadaku", "samehada"];
249
+
250
+ module.exports = handler;