𝗗𝗔π—₯π—₯π—˜π—Ÿπ—Ÿ π— π—¨π—–π—›π—˜π—₯π—œ ⚑ commited on
Commit
76c56a5
Β·
unverified Β·
1 Parent(s): 7c9bdde

Update and rename mrfrank- to mrfrank-img

Browse files
Files changed (2) hide show
  1. plugins/mrfrank- +0 -12
  2. plugins/mrfrank-img +34 -0
plugins/mrfrank- DELETED
@@ -1,12 +0,0 @@
1
- const config = require('../config');
2
-
3
-
4
- const {cmd , commands} = require('../command')
5
- cmd({
6
- pattern: "about",
7
- alias: ["subzero-md"],
8
- react: "πŸ‘‘",
9
- desc: "get owner dec",
10
- category: "main",
11
- filename: __filename
12
- },
 
 
 
 
 
 
 
 
 
 
 
 
 
plugins/mrfrank-img ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const config = require('../config');
2
+
3
+
4
+ const {cmd , commands} = require('../command')
5
+ cmd({
6
+ pattern: "img2",
7
+ alias: ["subzero-md2"],
8
+ react: "🀱",
9
+ desc: "get owner dec",
10
+ category: "main",
11
+ filename: __filename
12
+ },
13
+ async (query) => {
14
+ try {
15
+ const response = await axios.get(`https://www.google.com/search?q=${encodeURIComponent(query)}&tbm=isch`, {
16
+ headers: {
17
+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
18
+ 'Accept-Encoding': 'gzip, deflate, br',
19
+ 'Accept-Language': 'en-US,en;q=0.9,id;q=0.8',
20
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36',
21
+ },
22
+ });
23
+ const htmlContent = response.data;
24
+ const $ = cheerio.load(htmlContent);
25
+ const imageUrls = [...htmlContent.matchAll(/\[1,\[0,"(?<id>[\d\w\-_]+)",\["https?:\/\/(?:[^"]+)",\d+,\d+\]\s?,\["(?<url>https?:\/\/(?:[^"]+))",\d+,\d+\]/gm)]
26
+ .map(({ groups }) => decodeURIComponent(JSON.parse('"' + groups?.url + '"')))
27
+ .filter(url => /.*\.jpe?g|png$/gi.test(url));
28
+
29
+ return imageUrls;
30
+ } catch (error) {
31
+ console.error('An error occurred:', error.message);
32
+ return [];
33
+ }
34
+ }