//native
type Botify = {
token: string
}
/**
* Get sitemaps samples out of config
* Sample list of URLs which were found in your sitemaps but outside of the crawl perimeter defined for the project, for instance domain/subdomain or protocol (HTTP/HTTPS) not allowed in the crawl settings.
*/
export async function main(
auth: Botify,
username: string,
project_slug: string,
analysis_slug: string,
page: string | undefined,
size: string | undefined
) {
const url = new URL(
`https://api.botify.com/analyses/${username}/${project_slug}/${analysis_slug}/features/sitemaps/samples/out_of_config`
)
for (const [k, v] of [
['page', page],
['size', size]
]) {
if (v !== undefined && v !== '' && k !== undefined) {
url.searchParams.append(k, v)
}
}
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Token ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 2 days ago