-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
30 lines (25 loc) · 837 Bytes
/
main.ts
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
import { getUrlsFromSitemap } from "./lib/sitemap-parser.ts";
import {
_getUrlStatus,
submitUrlsToGoogleIndex,
} from "./lib/google-indexing.ts";
import credentials from "./service-account.json" with { type: "json" };
const sitemapUrls = [
"https://example.org/sitemap.xml",
];
// Learn more at https://docs.deno.com/runtime/manual/examples/module_metadata#concepts
if (import.meta.main) {
for (const sitemapUrl of sitemapUrls) {
const urls = await getUrlsFromSitemap(sitemapUrl);
console.log({ urls });
const results = await submitUrlsToGoogleIndex(
urls,
"URL_UPDATED",
credentials,
);
console.log({ results });
// await new Promise(resolve => setTimeout(resolve, 3000))
// const statusResults = await getUrlStatus(urls, credentials)
// console.log({statusResults})
}
}