mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-10 21:10:54 +01:00
Fetch now returns TimelineBlobPartial
This commit is contained in:
parent
1710a224df
commit
568dd0e70b
1 changed files with 2 additions and 8 deletions
10
src/fetch.ts
10
src/fetch.ts
|
@ -1,6 +1,6 @@
|
||||||
import { Constants } from './constants';
|
import { Constants } from './constants';
|
||||||
|
|
||||||
export const fetchUsingGuest = async (status: string): Promise<TweetPartial> => {
|
export const fetchUsingGuest = async (status: string): Promise<TimelineBlobPartial> => {
|
||||||
const csrfToken = crypto.randomUUID().replace(/-/g, ''); // Generate a random CSRF token, this doesn't matter, Twitter just cares that header and cookie match
|
const csrfToken = crypto.randomUUID().replace(/-/g, ''); // Generate a random CSRF token, this doesn't matter, Twitter just cares that header and cookie match
|
||||||
|
|
||||||
let headers: { [header: string]: string } = {
|
let headers: { [header: string]: string } = {
|
||||||
|
@ -47,11 +47,5 @@ export const fetchUsingGuest = async (status: string): Promise<TweetPartial> =>
|
||||||
)
|
)
|
||||||
).json()) as TimelineBlobPartial;
|
).json()) as TimelineBlobPartial;
|
||||||
|
|
||||||
const tweet = conversation?.globalObjects?.tweets?.[status] || {};
|
return conversation;
|
||||||
/* With v2 conversation API we re-add the user object ot the tweet because
|
|
||||||
Twitter stores it separately in the conversation API. This is to consolidate
|
|
||||||
it in case a user appears multiple times in a thread. */
|
|
||||||
tweet.user = conversation?.globalObjects?.users?.[tweet.user_id_str] || {};
|
|
||||||
|
|
||||||
return tweet;
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue