0
Get crawl statistics urls
One script reply has been approved by the moderators Verified

Return a list of 1000 latest URLs crawled (all crawled URLs or only URLS with HTTP errors)

Created by hugo697 52 days ago Viewed 621 times
0
Submitted by hugo697 Bun
Verified 52 days ago
1
//native
2
type Botify = {
3
	token: string
4
}
5
/**
6
 * Get crawl statistics urls
7
 * Return a list of 1000 latest URLs crawled (all crawled URLs or only URLS with HTTP errors)
8
 */
9
export async function main(
10
	auth: Botify,
11
	username: string,
12
	project_slug: string,
13
	analysis_slug: string,
14
	list_type: string
15
) {
16
	const url = new URL(
17
		`https://api.botify.com/analyses/${username}/${project_slug}/${analysis_slug}/crawl_statistics/urls/${list_type}`
18
	)
19

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