0

Get sitemaps report

by
Published Nov 5, 2024

Get global information of the sitemaps found (sitemaps indexes, invalid sitemaps urls, etc.)

Script botify Verified

The script

Submitted by hugo697 Bun
Verified 587 days ago
1
//native
2
type Botify = {
3
	token: string
4
}
5
/**
6
 * Get sitemaps report
7
 * Get global information of the sitemaps found (sitemaps indexes, invalid sitemaps urls, etc.)
8
 */
9
export async function main(
10
	auth: Botify,
11
	username: string,
12
	project_slug: string,
13
	analysis_slug: string
14
) {
15
	const url = new URL(
16
		`https://api.botify.com/analyses/${username}/${project_slug}/${analysis_slug}/features/sitemaps/report`
17
	)
18

19
	const response = await fetch(url, {
20
		method: 'GET',
21
		headers: {
22
			Authorization: 'Token ' + auth.token
23
		},
24
		body: undefined
25
	})
26
	if (!response.ok) {
27
		const text = await response.text()
28
		throw new Error(`${response.status} ${text}`)
29
	}
30
	return await response.text()
31
}
32