feat: maximum 500
This commit is contained in:
parent
98d9ddc83e
commit
ff4ee6c5fe
2 changed files with 12 additions and 4 deletions
|
|
@ -121,9 +121,11 @@ export abstract class SocialAbstract {
|
|||
json = '{}';
|
||||
}
|
||||
|
||||
const handleError = this.handleErrors(json || '{}');
|
||||
|
||||
if (
|
||||
request.status === 429 ||
|
||||
request.status === 500 ||
|
||||
(request.status === 500 && !handleError) ||
|
||||
json.includes('rate_limit_exceeded') ||
|
||||
json.includes('Rate limit')
|
||||
) {
|
||||
|
|
@ -137,8 +139,6 @@ export abstract class SocialAbstract {
|
|||
);
|
||||
}
|
||||
|
||||
const handleError = this.handleErrors(json || '{}');
|
||||
|
||||
if (handleError?.type === 'retry') {
|
||||
await timer(5000);
|
||||
return this.fetch(
|
||||
|
|
|
|||
|
|
@ -39,10 +39,18 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
|
|||
value: string;
|
||||
}
|
||||
| undefined {
|
||||
console.log(body);
|
||||
if (body.includes('Error validating access token')) {
|
||||
return { type: 'refresh-token', value: 'Threads access token expired' };
|
||||
}
|
||||
|
||||
if (body.includes('text must be at most 500 characters')) {
|
||||
return {
|
||||
type: 'bad-body',
|
||||
value: 'Post text exceeds 500 characters limit',
|
||||
};
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
@ -270,7 +278,7 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
|
|||
form.append('quote_post_id', quoteId);
|
||||
}
|
||||
|
||||
const { id: contentId } = await (
|
||||
const { id: contentId, ...all } = await (
|
||||
await this.fetch(`https://graph.threads.net/v1.0/${userId}/threads`, {
|
||||
method: 'POST',
|
||||
body: form,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue