Fix group download, now limited to first 100 videos
This commit is contained in:
parent
ac0fdf5468
commit
ad483f3eb7
2 changed files with 5 additions and 2 deletions
|
@ -34,7 +34,9 @@ export class ApiClient {
|
|||
return true;
|
||||
}
|
||||
logger.warn(`Got HTTP code ${err?.response?.status ?? undefined}. Retrying request...`);
|
||||
logger.verbose(`Here is the error message: \n '${err.response?.data}`);
|
||||
logger.verbose('Here is the error message: ');
|
||||
console.dir(err.response?.data);
|
||||
logger.verbose('We called this URL: ' + err.response?.config.baseURL + err.response?.config.url);
|
||||
|
||||
const shouldRetry: boolean = retryCodes.includes(err?.response?.status ?? 0);
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ async function extractGuids(url: string, client: ApiClient): Promise<Array<strin
|
|||
const videoNumber: number = await client.callApi(`groups/${groupMatch[1]}`, 'get')
|
||||
.then((response: AxiosResponse<any> | undefined) => response?.data.metrics.videos);
|
||||
|
||||
let result: Array<string> = await client.callApi(`groups/${groupMatch[1]}/videos?$top=${videoNumber}&$orderby=publishedDate asc`, 'get')
|
||||
// Anything over $top=100 will return a 400 Bad Request
|
||||
let result: Array<string> = await client.callApi(`groups/${groupMatch[1]}/videos?$top=100&$orderby=publishedDate asc`, 'get')
|
||||
.then((response: AxiosResponse<any> | undefined) => response?.data.value.map((item: any) => item.id));
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue