This commit is contained in:
@@ -22,7 +22,6 @@ export function withBookmarks<TBase extends AbstractConstructor<TwitterClientBas
|
||||
let urlWithOperation = `${TWITTER_API_BASE}/${queryId}/DeleteBookmark`;
|
||||
|
||||
const buildBody = () => JSON.stringify({ variables, queryId });
|
||||
const buildHeaders = () => ({ ...this.getHeaders(), referer: `https://x.com/i/status/${tweetId}` });
|
||||
let body = buildBody();
|
||||
|
||||
const parseResponse = async (response: Response): Promise<BookmarkMutationResult> => {
|
||||
@@ -42,7 +41,7 @@ export function withBookmarks<TBase extends AbstractConstructor<TwitterClientBas
|
||||
try {
|
||||
let response = await this.fetchWithTimeout(urlWithOperation, {
|
||||
method: 'POST',
|
||||
headers: buildHeaders(),
|
||||
headers: this.getJsonHeaders(),
|
||||
body,
|
||||
});
|
||||
|
||||
@@ -54,14 +53,14 @@ export function withBookmarks<TBase extends AbstractConstructor<TwitterClientBas
|
||||
|
||||
response = await this.fetchWithTimeout(urlWithOperation, {
|
||||
method: 'POST',
|
||||
headers: buildHeaders(),
|
||||
headers: this.getJsonHeaders(),
|
||||
body,
|
||||
});
|
||||
|
||||
if (response.status === 404) {
|
||||
const retry = await this.fetchWithTimeout(TWITTER_GRAPHQL_POST_URL, {
|
||||
method: 'POST',
|
||||
headers: buildHeaders(),
|
||||
headers: this.getJsonHeaders(),
|
||||
body,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user