-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsubmitToBing.js
More file actions
34 lines (29 loc) · 914 Bytes
/
Copy pathsubmitToBing.js
File metadata and controls
34 lines (29 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const axios = require('axios');
async function postIndexNow(key, url) {
const requestData = {
host: "www.example.org",
key: key,
keyLocation: `https://tggsearch.github.io/${key}.txt`,
urlList: urls
};
try {
const response = await axios.post('https://api.indexnow.org/IndexNow', requestData, {
headers: {
'Content-Type': 'application/json; charset=utf-8',
'Host': 'api.indexnow.org'
}
});
console.log('Response:', response.data);
return response.data;
} catch (error) {
console.error('Error posting to IndexNow:', error);
throw error;
}
}
// Example usage:
const key = "93322823db424d08b5e9a49dfa428112";
const url = [
"https://tggsearch.github.io/docs/telegram-no-sms-code.html",
"https://tggsearch.github.io/"
];
postIndexNow(key, url).then();