This commit is contained in:
@@ -71,7 +71,7 @@ export function withPosting<TBase extends AbstractConstructor<TwitterClientBase>
|
||||
let body = buildBody();
|
||||
|
||||
try {
|
||||
const headers = { ...this.getHeaders(), referer: 'https://x.com/compose/post' };
|
||||
const headers = this.getJsonHeaders();
|
||||
let response = await this.fetchWithTimeout(urlWithOperation, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
@@ -88,14 +88,14 @@ export function withPosting<TBase extends AbstractConstructor<TwitterClientBase>
|
||||
|
||||
response = await this.fetchWithTimeout(urlWithOperation, {
|
||||
method: 'POST',
|
||||
headers: { ...this.getHeaders(), referer: 'https://x.com/compose/post' },
|
||||
headers,
|
||||
body,
|
||||
});
|
||||
|
||||
if (response.status === 404) {
|
||||
const retry = await this.fetchWithTimeout(TWITTER_GRAPHQL_POST_URL, {
|
||||
method: 'POST',
|
||||
headers: { ...this.getHeaders(), referer: 'https://x.com/compose/post' },
|
||||
headers,
|
||||
body,
|
||||
});
|
||||
|
||||
@@ -224,12 +224,8 @@ export function withPosting<TBase extends AbstractConstructor<TwitterClientBase>
|
||||
try {
|
||||
const response = await this.fetchWithTimeout(TWITTER_STATUS_UPDATE_URL, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
...this.getBaseHeaders(),
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
referer: 'https://x.com/compose/post',
|
||||
},
|
||||
body: params.toString(),
|
||||
headers: this.getHeaders(),
|
||||
body: params,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user