bb-fca 2.0.7 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/models/buildAPI.js +3 -3
- package/dist/core/models/buildAPI.js.map +1 -1
- package/dist/core/models/loginHelper.js +29 -28
- package/dist/core/models/loginHelper.js.map +1 -1
- package/dist/deltas/apis/create.js +9 -0
- package/dist/deltas/apis/create.js.map +1 -1
- package/dist/deltas/apis/posting/group.js +30 -159
- package/dist/deltas/apis/posting/group.js.map +1 -1
- package/dist/deltas/apis/posting/post.js +971 -29
- package/dist/deltas/apis/posting/post.js.map +1 -1
- package/dist/index.d.ts +32 -32
- package/dist/types/deltas/apis/create.d.ts +9 -0
- package/dist/types/deltas/apis/posting/group.d.ts +1 -23
- package/dist/types/deltas/apis/posting/post.d.ts +24 -1
- package/dist/types/utils/constants.d.ts +26 -16
- package/dist/utils/constants.js +42 -29
- package/dist/utils/constants.js.map +1 -1
- package/package.json +1 -1
- package/src/core/models/buildAPI.ts +3 -3
- package/src/core/models/loginHelper.ts +32 -30
- package/src/deltas/apis/create.ts +10 -0
- package/src/deltas/apis/posting/group.ts +64 -205
- package/src/deltas/apis/posting/post.ts +1106 -49
- package/src/types/index.d.ts +32 -32
- package/src/utils/constants.ts +84 -57
- package/src/utils/formatters.old.ts +0 -1049
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import utils = require('../../utils');
|
|
2
1
|
import axios from 'axios';
|
|
3
2
|
import * as fs from 'fs';
|
|
4
3
|
import * as path from 'path';
|
|
5
4
|
import * as qs from 'querystring';
|
|
5
|
+
import { getJar, getAppState, get, saveCookies, log, error } from '../../utils';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The main login helper function, orchestrating the login process.
|
|
@@ -31,14 +31,27 @@ async function loginHelper(
|
|
|
31
31
|
let defaultFuncs: any = null;
|
|
32
32
|
let api: any = initialApi;
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Sets an array of "name=value" cookie strings into the CookieJar
|
|
36
|
+
* for the facebook.com domain.
|
|
37
|
+
*/
|
|
38
|
+
function setCookiesIntoJar(jar: any, cookieStrings: string[]): void {
|
|
39
|
+
const domain = '.facebook.com';
|
|
40
|
+
const expires = new Date().getTime() + 1000 * 60 * 60 * 24 * 365;
|
|
41
|
+
cookieStrings.forEach((cookieString) => {
|
|
42
|
+
const str = `${cookieString}; expires=${expires}; domain=${domain}; path=/;`;
|
|
43
|
+
jar.setCookie(str, `https://${domain}`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
34
47
|
try {
|
|
35
|
-
const jar =
|
|
36
|
-
|
|
48
|
+
const jar = getJar();
|
|
49
|
+
log('Logging in...');
|
|
37
50
|
|
|
38
51
|
const appState = credentials.appState;
|
|
39
52
|
|
|
40
53
|
if (appState) {
|
|
41
|
-
let cookieStrings = [];
|
|
54
|
+
let cookieStrings: string[] = [];
|
|
42
55
|
if (Array.isArray(appState)) {
|
|
43
56
|
cookieStrings = appState.map((c) =>
|
|
44
57
|
[c.name || c.key, c.value].join('='),
|
|
@@ -54,12 +67,7 @@ async function loginHelper(
|
|
|
54
67
|
);
|
|
55
68
|
}
|
|
56
69
|
|
|
57
|
-
cookieStrings
|
|
58
|
-
const domain = '.facebook.com';
|
|
59
|
-
const expires = new Date().getTime() + 1000 * 60 * 60 * 24 * 365;
|
|
60
|
-
const str = `${cookieString}; expires=${expires}; domain=${domain}; path=/;`;
|
|
61
|
-
jar.setCookie(str, `https://${domain}`);
|
|
62
|
-
});
|
|
70
|
+
setCookiesIntoJar(jar, cookieStrings);
|
|
63
71
|
} else if (credentials.email && credentials.password) {
|
|
64
72
|
// Rui
|
|
65
73
|
const url = 'https://api.facebook.com/method/auth.login';
|
|
@@ -80,15 +88,10 @@ async function loginHelper(
|
|
|
80
88
|
if (resp.status !== 200) {
|
|
81
89
|
throw new Error('Wrong password / email');
|
|
82
90
|
}
|
|
83
|
-
|
|
84
|
-
(c) => `${c.name}=${c.value}`,
|
|
91
|
+
const cstrs: string[] = resp.data['session_cookies'].map(
|
|
92
|
+
(c: any) => `${c.name}=${c.value}`,
|
|
85
93
|
);
|
|
86
|
-
cstrs
|
|
87
|
-
const domain = '.facebook.com';
|
|
88
|
-
const expires = new Date().getTime() + 1000 * 60 * 60 * 24 * 365;
|
|
89
|
-
const str = `${cstr}; expires=${expires}; domain=${domain}; path=/;`;
|
|
90
|
-
jar.setCookie(str, `https://${domain}`);
|
|
91
|
-
});
|
|
94
|
+
setCookiesIntoJar(jar, cstrs);
|
|
92
95
|
} catch (e) {
|
|
93
96
|
throw new Error('Wrong password / email');
|
|
94
97
|
}
|
|
@@ -102,20 +105,19 @@ async function loginHelper(
|
|
|
102
105
|
api = {
|
|
103
106
|
setOptions: setOptionsFunc.bind(null, globalOptions),
|
|
104
107
|
getAppState() {
|
|
105
|
-
const
|
|
106
|
-
if (!Array.isArray(
|
|
107
|
-
const
|
|
108
|
+
const state = getAppState(jar);
|
|
109
|
+
if (!Array.isArray(state)) return [];
|
|
110
|
+
const uniqueState = state.filter(
|
|
108
111
|
(item, index, self) =>
|
|
109
112
|
self.findIndex((t) => t.key === item.key) === index,
|
|
110
113
|
);
|
|
111
|
-
return
|
|
114
|
+
return uniqueState.length > 0 ? uniqueState : state;
|
|
112
115
|
},
|
|
113
116
|
};
|
|
114
117
|
}
|
|
115
118
|
|
|
116
|
-
const resp = await
|
|
117
|
-
.
|
|
118
|
-
.then(utils.saveCookies(jar));
|
|
119
|
+
const resp = await get(fbLinkFunc(), jar, null, globalOptions, { noRef: true })
|
|
120
|
+
.then(saveCookies(jar));
|
|
119
121
|
const extractNetData = (html) => {
|
|
120
122
|
const allScriptsData = [];
|
|
121
123
|
const scriptRegex = /<script type="application\/json"[^>]*>(.*?)<\/script>/g;
|
|
@@ -124,7 +126,7 @@ async function loginHelper(
|
|
|
124
126
|
try {
|
|
125
127
|
allScriptsData.push(JSON.parse(match[1]));
|
|
126
128
|
} catch (e) {
|
|
127
|
-
|
|
129
|
+
error(`Failed to parse a JSON blob from HTML`, (e as any).message);
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
return allScriptsData;
|
|
@@ -173,7 +175,7 @@ async function loginHelper(
|
|
|
173
175
|
? require(fullPath).default(defaultFuncs, api, ctx)
|
|
174
176
|
: require(fullPath)(defaultFuncs, api, ctx);
|
|
175
177
|
} catch (e) {
|
|
176
|
-
|
|
178
|
+
error(
|
|
177
179
|
`Failed to load module ${moduleName} from ${folder}:`,
|
|
178
180
|
e,
|
|
179
181
|
);
|
|
@@ -217,9 +219,9 @@ async function loginHelper(
|
|
|
217
219
|
api.globalOptions = globalOptions;
|
|
218
220
|
|
|
219
221
|
return callback(null, api);
|
|
220
|
-
} catch (
|
|
221
|
-
|
|
222
|
-
return callback(
|
|
222
|
+
} catch (err: any) {
|
|
223
|
+
error('loginHelper', err.error || err);
|
|
224
|
+
return callback(err);
|
|
223
225
|
}
|
|
224
226
|
}
|
|
225
227
|
|
|
@@ -49,5 +49,15 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
49
49
|
* @returns {Promise<object>} Upload result with videoID.
|
|
50
50
|
*/
|
|
51
51
|
uploadVideo: postModule.uploadVideo,
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Reacts to a Facebook post (like, love, haha, wow, sad, angry, care).
|
|
55
|
+
* @param {string} feedbackId - Numeric post ID, "feedbackback:<id>", or base64 feedback ID.
|
|
56
|
+
* @param {string} [reaction="LIKE"] - "LIKE" | "LOVE" | "HAHA" | "WOW" | "SAD" | "ANGRY" | "CARE"
|
|
57
|
+
* or emoji: "👍" | "❤️" | "😂" | "😮" | "😢" | "😡" | "🤗"
|
|
58
|
+
* @param {Function} [callback] - Optional callback function.
|
|
59
|
+
* @returns {Promise<object>} The server response.
|
|
60
|
+
*/
|
|
61
|
+
reactPost: postModule.react,
|
|
52
62
|
};
|
|
53
63
|
}
|
|
@@ -5,7 +5,7 @@ import utils = require('../../../utils');
|
|
|
5
5
|
* @description A module for joining, leaving, and listing Facebook groups.
|
|
6
6
|
* @license Ex-it
|
|
7
7
|
*/
|
|
8
|
-
export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
8
|
+
export default function (defaultFuncs: any, api: any, ctx: any) {
|
|
9
9
|
/**
|
|
10
10
|
* Deep-searches an object/array tree for the first value matching a predicate.
|
|
11
11
|
*/
|
|
@@ -163,7 +163,9 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
163
163
|
/**
|
|
164
164
|
* Builds the GraphQL POST form for groups pagination.
|
|
165
165
|
*/
|
|
166
|
-
function buildGroupsGraphQLForm(
|
|
166
|
+
function buildGroupsGraphQLForm(
|
|
167
|
+
variables: object,
|
|
168
|
+
): Record<string, string> {
|
|
167
169
|
return {
|
|
168
170
|
av: ctx.userID,
|
|
169
171
|
__user: ctx.userID,
|
|
@@ -172,7 +174,8 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
172
174
|
jazoest: ctx.jazoest,
|
|
173
175
|
lsd: ctx.lsd,
|
|
174
176
|
fb_api_caller_class: 'RelayModern',
|
|
175
|
-
fb_api_req_friendly_name:
|
|
177
|
+
fb_api_req_friendly_name:
|
|
178
|
+
'GroupsCometJoinedGroupsListPaginationQuery',
|
|
176
179
|
variables: JSON.stringify(variables),
|
|
177
180
|
server_timestamps: 'true',
|
|
178
181
|
doc_id: '8957838874246460',
|
|
@@ -273,83 +276,46 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
273
276
|
* @returns {Promise<Object>} A promise that resolves to the API response data on success.
|
|
274
277
|
* @throws {Error} If the groupID is missing or the API request fails.
|
|
275
278
|
*/
|
|
276
|
-
join: async function(groupID: string
|
|
279
|
+
join: async function (groupID: string) {
|
|
277
280
|
if (!groupID) throw new Error('groupID is required.');
|
|
278
281
|
|
|
279
|
-
const actorId = ctx.i_userID || ctx.userID;
|
|
280
|
-
|
|
281
282
|
const variables = {
|
|
282
|
-
feedType: 'DISCUSSION',
|
|
283
|
-
groupID: groupID,
|
|
284
283
|
input: {
|
|
285
|
-
|
|
284
|
+
group_id: groupID,
|
|
285
|
+
group_share_tracking_params: null,
|
|
286
|
+
join_action_source: 'GROUP_HEADER',
|
|
286
287
|
attribution_id_v2:
|
|
287
|
-
'
|
|
288
|
+
'GroupsCometGroupHeaderActionButton.react,comet.group,via_cold_start,' +
|
|
288
289
|
Date.now() +
|
|
289
|
-
'
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
app_id: '2220391788200892',
|
|
293
|
-
exp_id: 'null',
|
|
294
|
-
is_from_share: false,
|
|
295
|
-
},
|
|
296
|
-
actor_id: actorId,
|
|
297
|
-
client_mutation_id: '1',
|
|
290
|
+
',,,',
|
|
291
|
+
actor_id: ctx.userID,
|
|
292
|
+
client_mutation_id: Math.floor(Math.random() * 10 + 1).toString(),
|
|
298
293
|
},
|
|
299
|
-
inviteShortLinkKey: inviteShortLinkKey ?? null,
|
|
300
|
-
isChainingRecommendationUnit: false,
|
|
301
294
|
scale: 1,
|
|
302
|
-
source: 'GROUP_MALL',
|
|
303
|
-
renderLocation: 'group_mall',
|
|
304
|
-
__relay_internal__pv__groups_comet_use_glvrelayprovider: false,
|
|
305
|
-
__relay_internal__pv__GroupsCometGYSJUnifiedUnitCardImageHeightrelayprovider: 150,
|
|
306
|
-
__relay_internal__pv__GroupsCometGroupChatLazyLoadLastMessageSnippetrelayprovider: false,
|
|
307
295
|
};
|
|
308
296
|
|
|
309
297
|
const form = {
|
|
310
|
-
av:
|
|
311
|
-
|
|
312
|
-
__user: actorId,
|
|
298
|
+
av: ctx.userID,
|
|
299
|
+
__user: ctx.userID,
|
|
313
300
|
__a: '1',
|
|
314
|
-
__req: '18',
|
|
315
|
-
__hs: '20530.HCSV2:comet_pkg.2.1...0',
|
|
316
|
-
dpr: '1',
|
|
317
|
-
__ccg: 'GOOD',
|
|
318
|
-
__comet_req: '15',
|
|
319
301
|
fb_dtsg: ctx.fb_dtsg,
|
|
320
302
|
jazoest: ctx.jazoest,
|
|
321
303
|
lsd: ctx.lsd,
|
|
322
|
-
__spin_r: '1035418183',
|
|
323
|
-
__spin_b: 'trunk',
|
|
324
|
-
__spin_t: Math.floor(Date.now() / 1000).toString(),
|
|
325
|
-
__crn: 'comet.fbweb.CometGroupDiscussionRoute',
|
|
326
304
|
fb_api_caller_class: 'RelayModern',
|
|
327
|
-
fb_api_req_friendly_name: '
|
|
305
|
+
fb_api_req_friendly_name: 'GroupCometJoinMutation',
|
|
328
306
|
variables: JSON.stringify(variables),
|
|
329
|
-
|
|
330
|
-
doc_id: '26180016991684264',
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
const customHeader = {
|
|
334
|
-
'x-fb-friendly-name': 'GroupCometJoinForumMutation',
|
|
335
|
-
'x-fb-lsd': ctx.lsd || '',
|
|
336
|
-
'x-asbd-id': '359341',
|
|
337
|
-
origin: 'https://www.facebook.com',
|
|
338
|
-
referer: `https://www.facebook.com/groups/${groupID}`,
|
|
307
|
+
doc_id: '6192959194068498',
|
|
339
308
|
};
|
|
340
309
|
|
|
341
|
-
const res = await
|
|
310
|
+
const res = await defaultFuncs.post(
|
|
342
311
|
'https://www.facebook.com/api/graphql/',
|
|
343
312
|
ctx.jar,
|
|
344
313
|
form,
|
|
345
|
-
|
|
346
|
-
ctx,
|
|
347
|
-
customHeader,
|
|
314
|
+
{},
|
|
348
315
|
);
|
|
349
316
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return data?.data ?? data;
|
|
317
|
+
if (res.data?.errors) throw new Error(JSON.stringify(res.data.errors));
|
|
318
|
+
return res.data?.data ?? res.data;
|
|
353
319
|
},
|
|
354
320
|
|
|
355
321
|
/**
|
|
@@ -359,151 +325,45 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
359
325
|
* @returns {Promise<Object>} A promise that resolves to the API response data on success.
|
|
360
326
|
* @throws {Error} If the groupID is missing or the API request fails.
|
|
361
327
|
*/
|
|
362
|
-
leave: async function(groupID: string) {
|
|
328
|
+
leave: async function (groupID: string) {
|
|
363
329
|
if (!groupID) throw new Error('groupID is required.');
|
|
364
330
|
|
|
365
|
-
const actorId = ctx.i_userID || ctx.userID;
|
|
366
|
-
|
|
367
331
|
const variables = {
|
|
368
332
|
input: {
|
|
369
|
-
attribution_id_v2:
|
|
370
|
-
'CometGroupDiscussionRoot.react,comet.group,via_cold_start,' +
|
|
371
|
-
Date.now() +
|
|
372
|
-
',243486,2361831622,,',
|
|
373
333
|
group_id: groupID,
|
|
374
|
-
|
|
375
|
-
client_mutation_id: '1',
|
|
376
|
-
},
|
|
377
|
-
inviteShortLinkKey: null,
|
|
378
|
-
isChainingRecommendationUnit: false,
|
|
379
|
-
ordering: ['viewer_added'],
|
|
380
|
-
scale: 1,
|
|
381
|
-
groupID: groupID,
|
|
382
|
-
__relay_internal__pv__GroupsCometGYSJUnifiedUnitCardImageHeightrelayprovider: 150,
|
|
383
|
-
__relay_internal__pv__GroupsCometGroupChatLazyLoadLastMessageSnippetrelayprovider: false,
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
const form = {
|
|
387
|
-
av: actorId,
|
|
388
|
-
__aaid: '0',
|
|
389
|
-
__user: actorId,
|
|
390
|
-
__a: '1',
|
|
391
|
-
__req: '1f',
|
|
392
|
-
__hs: '20530.HCSV2:comet_pkg.2.1...0',
|
|
393
|
-
dpr: '1',
|
|
394
|
-
__ccg: 'EXCELLENT',
|
|
395
|
-
__comet_req: '15',
|
|
396
|
-
fb_dtsg: ctx.fb_dtsg,
|
|
397
|
-
jazoest: ctx.jazoest,
|
|
398
|
-
lsd: ctx.lsd,
|
|
399
|
-
__spin_r: '1035418183',
|
|
400
|
-
__spin_b: 'trunk',
|
|
401
|
-
__spin_t: Math.floor(Date.now() / 1000).toString(),
|
|
402
|
-
__crn: 'comet.fbweb.CometGroupDiscussionRoute',
|
|
403
|
-
fb_api_caller_class: 'RelayModern',
|
|
404
|
-
fb_api_req_friendly_name: 'GroupCometLeaveForumMutation',
|
|
405
|
-
variables: JSON.stringify(variables),
|
|
406
|
-
server_timestamps: 'true',
|
|
407
|
-
doc_id: '26077711195170900',
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
const customHeader = {
|
|
411
|
-
'x-fb-friendly-name': 'GroupCometLeaveForumMutation',
|
|
412
|
-
'x-fb-lsd': ctx.lsd || '',
|
|
413
|
-
'x-asbd-id': '359341',
|
|
414
|
-
origin: 'https://www.facebook.com',
|
|
415
|
-
referer: `https://www.facebook.com/groups/${groupID}`,
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
const res = await utils.post(
|
|
419
|
-
'https://www.facebook.com/api/graphql/',
|
|
420
|
-
ctx.jar,
|
|
421
|
-
form,
|
|
422
|
-
ctx.globalOptions,
|
|
423
|
-
ctx,
|
|
424
|
-
customHeader,
|
|
425
|
-
);
|
|
426
|
-
|
|
427
|
-
const data = parseResponseBody(res.body);
|
|
428
|
-
if (data?.errors) throw new Error(JSON.stringify(data.errors));
|
|
429
|
-
return data?.data ?? data;
|
|
430
|
-
},
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Invites friends to a Facebook group.
|
|
434
|
-
* @async
|
|
435
|
-
* @param {string} groupID The ID of the group to invite friends to.
|
|
436
|
-
* @param {string[]} userIDs Array of user IDs to invite.
|
|
437
|
-
* @returns {Promise<Object>} A promise that resolves to the API response data on success.
|
|
438
|
-
* @throws {Error} If the groupID or userIDs are missing or the API request fails.
|
|
439
|
-
*/
|
|
440
|
-
inviteFriends: async function(groupID: string, userIDs: string[]) {
|
|
441
|
-
if (!groupID) throw new Error('groupID is required.');
|
|
442
|
-
if (!userIDs?.length)
|
|
443
|
-
throw new Error('userIDs is required and must not be empty.');
|
|
444
|
-
|
|
445
|
-
const actorId = ctx.i_userID || ctx.userID;
|
|
446
|
-
|
|
447
|
-
const variables = {
|
|
448
|
-
input: {
|
|
334
|
+
action_source: 'GROUP_HEADER',
|
|
449
335
|
attribution_id_v2:
|
|
450
|
-
'
|
|
336
|
+
'GroupsCometGroupHeaderActionButton.react,comet.group,via_cold_start,' +
|
|
451
337
|
Date.now() +
|
|
452
|
-
'
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
source: 'comet_invite_friends',
|
|
456
|
-
user_ids: userIDs,
|
|
457
|
-
actor_id: actorId,
|
|
458
|
-
client_mutation_id: '2',
|
|
338
|
+
',,,',
|
|
339
|
+
actor_id: ctx.userID,
|
|
340
|
+
client_mutation_id: Math.floor(Math.random() * 10 + 1).toString(),
|
|
459
341
|
},
|
|
460
|
-
|
|
342
|
+
scale: 1,
|
|
461
343
|
};
|
|
462
344
|
|
|
463
345
|
const form = {
|
|
464
|
-
av:
|
|
465
|
-
|
|
466
|
-
__user: actorId,
|
|
346
|
+
av: ctx.userID,
|
|
347
|
+
__user: ctx.userID,
|
|
467
348
|
__a: '1',
|
|
468
|
-
__req: '1a',
|
|
469
|
-
__hs: '20530.HCSV2:comet_pkg.2.1...0',
|
|
470
|
-
dpr: '1',
|
|
471
|
-
__ccg: 'EXCELLENT',
|
|
472
|
-
__comet_req: '15',
|
|
473
349
|
fb_dtsg: ctx.fb_dtsg,
|
|
474
350
|
jazoest: ctx.jazoest,
|
|
475
351
|
lsd: ctx.lsd,
|
|
476
|
-
__spin_r: '1035418183',
|
|
477
|
-
__spin_b: 'trunk',
|
|
478
|
-
__spin_t: Math.floor(Date.now() / 1000).toString(),
|
|
479
|
-
__crn: 'comet.fbweb.CometGroupDiscussionRoute',
|
|
480
352
|
fb_api_caller_class: 'RelayModern',
|
|
481
|
-
fb_api_req_friendly_name: '
|
|
353
|
+
fb_api_req_friendly_name: 'GroupCometLeaveMutation',
|
|
482
354
|
variables: JSON.stringify(variables),
|
|
483
|
-
|
|
484
|
-
doc_id: '25892331960437758',
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
const customHeader = {
|
|
488
|
-
'x-fb-friendly-name': 'useGroupAddMembersMutation',
|
|
489
|
-
'x-fb-lsd': ctx.lsd || '',
|
|
490
|
-
'x-asbd-id': '359341',
|
|
491
|
-
origin: 'https://www.facebook.com',
|
|
492
|
-
referer: `https://www.facebook.com/groups/${groupID}`,
|
|
355
|
+
doc_id: '5583297681747014',
|
|
493
356
|
};
|
|
494
357
|
|
|
495
|
-
const res = await
|
|
358
|
+
const res = await defaultFuncs.post(
|
|
496
359
|
'https://www.facebook.com/api/graphql/',
|
|
497
360
|
ctx.jar,
|
|
498
361
|
form,
|
|
499
|
-
|
|
500
|
-
ctx,
|
|
501
|
-
customHeader,
|
|
362
|
+
{},
|
|
502
363
|
);
|
|
503
364
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
return data?.data ?? data;
|
|
365
|
+
if (res.data?.errors) throw new Error(JSON.stringify(res.data.errors));
|
|
366
|
+
return res.data?.data ?? res.data;
|
|
507
367
|
},
|
|
508
368
|
|
|
509
369
|
/**
|
|
@@ -523,7 +383,7 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
523
383
|
* // Page 2+
|
|
524
384
|
* const page2 = await api.group.getJoinedGroups(page1.endCursor);
|
|
525
385
|
*/
|
|
526
|
-
getJoinedGroups: async function(
|
|
386
|
+
getJoinedGroups: async function (
|
|
527
387
|
cursor: string | null = null,
|
|
528
388
|
count: number = 10,
|
|
529
389
|
): Promise<JoinedGroupsResult> {
|
|
@@ -603,7 +463,7 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
603
463
|
* @param {{ limit?: number; cursor?: string | null; locale?: string }} [options]
|
|
604
464
|
* @returns {Promise<{ groups: any[]; cursor: string | null; hasNextPage: boolean }>} Search result and pagination info.
|
|
605
465
|
*/
|
|
606
|
-
searchGroup: async function(
|
|
466
|
+
searchGroup: async function (
|
|
607
467
|
keyword: string,
|
|
608
468
|
options: { limit?: number; cursor?: string | null; locale?: string } = {},
|
|
609
469
|
): Promise<{ groups: any[]; cursor: string | null; hasNextPage: boolean }> {
|
|
@@ -664,25 +524,37 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
664
524
|
stream_initial_count: 0,
|
|
665
525
|
useDefaultActor: false,
|
|
666
526
|
__relay_internal__pv__GHLShouldChangeAdIdFieldNamerelayprovider: true,
|
|
667
|
-
__relay_internal__pv__GHLShouldChangeSponsoredDataFieldNamerelayprovider:
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
527
|
+
__relay_internal__pv__GHLShouldChangeSponsoredDataFieldNamerelayprovider:
|
|
528
|
+
true,
|
|
529
|
+
__relay_internal__pv__CometFeedStory_enable_post_permalink_white_space_clickrelayprovider:
|
|
530
|
+
false,
|
|
531
|
+
__relay_internal__pv__CometUFICommentActionLinksRewriteEnabledrelayprovider:
|
|
532
|
+
false,
|
|
533
|
+
__relay_internal__pv__CometUFICommentAvatarStickerAnimatedImagerelayprovider:
|
|
534
|
+
false,
|
|
671
535
|
__relay_internal__pv__IsWorkUserrelayprovider: false,
|
|
672
|
-
__relay_internal__pv__TestPilotShouldIncludeDemoAdUseCaserelayprovider:
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
536
|
+
__relay_internal__pv__TestPilotShouldIncludeDemoAdUseCaserelayprovider:
|
|
537
|
+
false,
|
|
538
|
+
__relay_internal__pv__FBReels_deprecate_short_form_video_context_gkrelayprovider:
|
|
539
|
+
true,
|
|
540
|
+
__relay_internal__pv__FBReels_enable_view_dubbed_audio_type_gkrelayprovider:
|
|
541
|
+
true,
|
|
542
|
+
__relay_internal__pv__CometImmersivePhotoCanUserDisable3DMotionrelayprovider:
|
|
543
|
+
false,
|
|
676
544
|
__relay_internal__pv__WorkCometIsEmployeeGKProviderrelayprovider: false,
|
|
677
545
|
__relay_internal__pv__IsMergQAPollsrelayprovider: false,
|
|
678
|
-
__relay_internal__pv__FBReelsMediaFooter_comet_enable_reels_ads_gkrelayprovider:
|
|
679
|
-
|
|
546
|
+
__relay_internal__pv__FBReelsMediaFooter_comet_enable_reels_ads_gkrelayprovider:
|
|
547
|
+
true,
|
|
548
|
+
__relay_internal__pv__CometUFIReactionsEnableShortNamerelayprovider:
|
|
549
|
+
false,
|
|
680
550
|
__relay_internal__pv__CometUFICommentAutoTranslationTyperelayprovider:
|
|
681
551
|
'ORIGINAL',
|
|
682
552
|
__relay_internal__pv__CometUFIShareActionMigrationrelayprovider: true,
|
|
683
553
|
__relay_internal__pv__CometUFISingleLineUFIrelayprovider: false,
|
|
684
|
-
__relay_internal__pv__CometUFI_dedicated_comment_routable_dialog_gkrelayprovider:
|
|
685
|
-
|
|
554
|
+
__relay_internal__pv__CometUFI_dedicated_comment_routable_dialog_gkrelayprovider:
|
|
555
|
+
true,
|
|
556
|
+
__relay_internal__pv__FBReelsIFUTileContent_reelsIFUPlayOnHoverrelayprovider:
|
|
557
|
+
true,
|
|
686
558
|
__relay_internal__pv__GroupsCometGYSJFeedItemHeightrelayprovider: 150,
|
|
687
559
|
__relay_internal__pv__ShouldEnableBakedInTextStoriesrelayprovider: false,
|
|
688
560
|
__relay_internal__pv__StoriesShouldIncludeFbNotesrelayprovider: false,
|
|
@@ -708,9 +580,7 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
708
580
|
'x-fb-lsd': ctx.lsd || '',
|
|
709
581
|
'x-asbd-id': '359341',
|
|
710
582
|
origin: 'https://www.facebook.com',
|
|
711
|
-
referer: `https://www.facebook.com/groups/search/groups_home?q=${encodeURIComponent(
|
|
712
|
-
keyword,
|
|
713
|
-
)}&locale=${encodeURIComponent(locale)}`,
|
|
583
|
+
referer: `https://www.facebook.com/groups/search/groups_home?q=${encodeURIComponent(keyword)}&locale=${encodeURIComponent(locale)}`,
|
|
714
584
|
};
|
|
715
585
|
|
|
716
586
|
const res = await utils.post(
|
|
@@ -737,17 +607,6 @@ export default function(defaultFuncs: any, api: any, ctx: any) {
|
|
|
737
607
|
hasNextPage: Boolean(pageInfo.has_next_page),
|
|
738
608
|
};
|
|
739
609
|
},
|
|
740
|
-
|
|
741
|
-
/**
|
|
742
|
-
* Alias for searchGroup.
|
|
743
|
-
* @see searchGroup
|
|
744
|
-
*/
|
|
745
|
-
searchGroups: async function(
|
|
746
|
-
keyword: string,
|
|
747
|
-
options: { limit?: number; cursor?: string | null; locale?: string } = {},
|
|
748
|
-
): Promise<{ groups: any[]; cursor: string | null; hasNextPage: boolean }> {
|
|
749
|
-
return groupModule.searchGroup(keyword, options);
|
|
750
|
-
},
|
|
751
610
|
};
|
|
752
611
|
|
|
753
612
|
return groupModule;
|