Update index.js
Browse files
index.js
CHANGED
|
@@ -67,19 +67,19 @@ return Array(4)
|
|
| 67 |
.join('.');
|
| 68 |
}
|
| 69 |
//BIMG
|
| 70 |
-
async function bimg(query) {
|
| 71 |
-
const { BingApi } = await import("bing-nodejs");
|
| 72 |
-
const bing = new BingApi({
|
| 73 |
-
cookie: process.env.BING_IMAGE_COOKIE
|
| 74 |
-
});
|
| 75 |
-
let data = await bing.createImage(query).then((res) => {
|
| 76 |
-
return res.urls; // string[]
|
| 77 |
-
});
|
| 78 |
-
|
| 79 |
-
// Filter out links that end with '.svg'
|
| 80 |
-
let filteredData = data.filter(i => !i.includes('.svg'));
|
| 81 |
-
return filteredData
|
| 82 |
-
}
|
| 83 |
async function bingChat(text) {
|
| 84 |
const api = new BingChat({
|
| 85 |
cookie: process.env.BING_IMAGE_COOKIE
|
|
@@ -615,17 +615,17 @@ console.log(e);
|
|
| 615 |
return res.json({ message: e.message });
|
| 616 |
}
|
| 617 |
})
|
| 618 |
-
.get('/bimg', async (req, res) => {
|
| 619 |
-
try {
|
| 620 |
-
let q = req.query.q || req.query.query;
|
| 621 |
-
if (!q) return res.json({ message: 'Input parameter q' });
|
| 622 |
-
let data = await bimg(q)
|
| 623 |
-
return res.json({query: q, data: data})
|
| 624 |
-
} catch (e) {
|
| 625 |
-
console.log(e);
|
| 626 |
-
return res.json({ message: e.message });
|
| 627 |
-
}
|
| 628 |
-
})
|
| 629 |
.get('/bing', async (req, res) => {
|
| 630 |
try {
|
| 631 |
let q = req.query.q || req.query.query;
|
|
|
|
| 67 |
.join('.');
|
| 68 |
}
|
| 69 |
//BIMG
|
| 70 |
+
// async function bimg(query) {
|
| 71 |
+
// const { BingApi } = await import("bing-nodejs");
|
| 72 |
+
// const bing = new BingApi({
|
| 73 |
+
// cookie: process.env.BING_IMAGE_COOKIE
|
| 74 |
+
// });
|
| 75 |
+
// let data = await bing.createImage(query).then((res) => {
|
| 76 |
+
// return res.urls; // string[]
|
| 77 |
+
// });
|
| 78 |
+
|
| 79 |
+
// // Filter out links that end with '.svg'
|
| 80 |
+
// let filteredData = data.filter(i => !i.includes('.svg'));
|
| 81 |
+
// return filteredData
|
| 82 |
+
// }
|
| 83 |
async function bingChat(text) {
|
| 84 |
const api = new BingChat({
|
| 85 |
cookie: process.env.BING_IMAGE_COOKIE
|
|
|
|
| 615 |
return res.json({ message: e.message });
|
| 616 |
}
|
| 617 |
})
|
| 618 |
+
// .get('/bimg', async (req, res) => {
|
| 619 |
+
// try {
|
| 620 |
+
// let q = req.query.q || req.query.query;
|
| 621 |
+
// if (!q) return res.json({ message: 'Input parameter q' });
|
| 622 |
+
// let data = await bimg(q)
|
| 623 |
+
// return res.json({query: q, data: data})
|
| 624 |
+
// } catch (e) {
|
| 625 |
+
// console.log(e);
|
| 626 |
+
// return res.json({ message: e.message });
|
| 627 |
+
// }
|
| 628 |
+
// })
|
| 629 |
.get('/bing', async (req, res) => {
|
| 630 |
try {
|
| 631 |
let q = req.query.q || req.query.query;
|