emusks 2.1.0 → 2.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emusks",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Reverse-engineered Twitter API client. Log in and interact with the unofficial X API using any client identity - web, Android, iOS, or TweetDeck",
5
5
  "keywords": [
6
6
  "client",
package/src/graphql.js CHANGED
@@ -141,7 +141,11 @@ export default async function graphql(queryName, { variables, fieldToggles, body
141
141
  ).json();
142
142
 
143
143
  if (res?.errors?.[0]) {
144
- throw new Error(res.errors.map((err) => err.message).join(", "));
144
+ const hasData =
145
+ res.data != null && typeof res.data === "object" && Object.keys(res.data).length > 0;
146
+ if (!hasData) {
147
+ throw new Error(res.errors.map((err) => err.message).join(", "));
148
+ }
145
149
  }
146
150
 
147
151
  return res;
@@ -1,3 +1,5 @@
1
+ import parseTimeline from "../parsers/timeline.js";
2
+
1
3
  export async function create(name, opts = {}) {
2
4
  return await this.graphql("CreateList", {
3
5
  body: {
@@ -54,7 +56,7 @@ export async function removeMember(listId, userId) {
54
56
  }
55
57
 
56
58
  export async function members(listId, opts = {}) {
57
- return await this.graphql("ListMembers", {
59
+ const raw = await this.graphql("ListMembers", {
58
60
  variables: {
59
61
  listId,
60
62
  count: opts.count || 20,
@@ -62,10 +64,11 @@ export async function members(listId, opts = {}) {
62
64
  ...opts.variables,
63
65
  },
64
66
  });
67
+ return parseTimeline(raw);
65
68
  }
66
69
 
67
70
  export async function subscribers(listId, opts = {}) {
68
- return await this.graphql("ListSubscribers", {
71
+ const raw = await this.graphql("ListSubscribers", {
69
72
  variables: {
70
73
  listId,
71
74
  count: opts.count || 20,
@@ -73,6 +76,7 @@ export async function subscribers(listId, opts = {}) {
73
76
  ...opts.variables,
74
77
  },
75
78
  });
79
+ return parseTimeline(raw);
76
80
  }
77
81
 
78
82
  export async function subscribe(listId) {
@@ -1,4 +1,5 @@
1
1
  import getCycleTLS from "../cycletls.js";
2
+ import parseTimeline from "../parsers/timeline.js";
2
3
  import parseTweet from "../parsers/tweet.js";
3
4
 
4
5
  async function createPollCard(instance, poll) {
@@ -262,7 +263,7 @@ export async function getMany(tweetIds) {
262
263
  }
263
264
 
264
265
  export async function detail(tweetId, opts = {}) {
265
- return await this.graphql("TweetDetail", {
266
+ const raw = await this.graphql("TweetDetail", {
266
267
  variables: {
267
268
  focalTweetId: tweetId,
268
269
  with_rux_injections: false,
@@ -280,6 +281,7 @@ export async function detail(tweetId, opts = {}) {
280
281
  withAuxiliaryUserLabels: false,
281
282
  },
282
283
  });
284
+ return parseTimeline(raw);
283
285
  }
284
286
 
285
287
  export async function editHistory(tweetId) {