devstok commited on
Commit
ce96472
·
verified ·
1 Parent(s): df9482c

Delete plugins/samehadaku.js

Browse files
Files changed (1) hide show
  1. plugins/samehadaku.js +0 -250
plugins/samehadaku.js DELETED
@@ -1,250 +0,0 @@
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;