Rename scrapper.js to lib/scrapper.js
Browse files
scrapper.js → lib/scrapper.js
RENAMED
@@ -1,17 +1,34 @@
|
|
1 |
import axios from 'axios';
|
2 |
import * as cheerio from 'cheerio';
|
3 |
|
4 |
-
import {GptModelOld} from '
|
5 |
|
6 |
const ParametersUrl = function (parameters) {
|
7 |
const url = `https://itzpire.com/${parameters}`;
|
8 |
return url
|
9 |
};
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
const GempaBumi = async () => {
|
12 |
try {
|
13 |
const url = ParametersUrl("information/gempa-warning");
|
14 |
-
const response = await axios.get(url)
|
15 |
if (typeof response.data === "object") {
|
16 |
response.data.author = "xtdevs";
|
17 |
return response.data;
|
|
|
1 |
import axios from 'axios';
|
2 |
import * as cheerio from 'cheerio';
|
3 |
|
4 |
+
import {GptModelOld} from '../models.js';
|
5 |
|
6 |
const ParametersUrl = function (parameters) {
|
7 |
const url = `https://itzpire.com/${parameters}`;
|
8 |
return url
|
9 |
};
|
10 |
|
11 |
+
const Copilot2Trip = async (q) => {
|
12 |
+
try {
|
13 |
+
const url = ParametersUrl("ai/copilot2trip");
|
14 |
+
const response = await axios.get(url);
|
15 |
+
if (typeof response.data === "object") {
|
16 |
+
response.data.author = "xtdevs";
|
17 |
+
return response.data;
|
18 |
+
} else {
|
19 |
+
console.log("the return value was not a json object");
|
20 |
+
return null;
|
21 |
+
}
|
22 |
+
} catch (e) {
|
23 |
+
console.error("Error:", error.message);
|
24 |
+
return null;
|
25 |
+
}
|
26 |
+
};
|
27 |
+
|
28 |
const GempaBumi = async () => {
|
29 |
try {
|
30 |
const url = ParametersUrl("information/gempa-warning");
|
31 |
+
const response = await axios.get(url);
|
32 |
if (typeof response.data === "object") {
|
33 |
response.data.author = "xtdevs";
|
34 |
return response.data;
|