emusks 2.0.8 → 2.0.10

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.0.8",
3
+ "version": "2.0.10",
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
@@ -82,8 +82,7 @@ export default async function graphql(queryName, { variables, fieldToggles, body
82
82
  },
83
83
  method,
84
84
  )
85
- ).text();
86
- console.log(res);
85
+ ).json();
87
86
 
88
87
  if (res?.errors?.[0]) {
89
88
  throw new Error(res.errors.map((err) => err.message).join(", "));
@@ -114,6 +114,21 @@ export async function communities(query, opts = {}) {
114
114
  return parseTimeline(raw);
115
115
  }
116
116
 
117
+ export async function gifs(query, params = {}) {
118
+ const res = await this.v1_1("foundmedia/search", {
119
+ params: {
120
+ q: query,
121
+ ...(params.cursor ? { cursor: params.cursor } : {}),
122
+ ...params,
123
+ },
124
+ });
125
+ const json = await res.json();
126
+ return {
127
+ items: json.data?.items || [],
128
+ cursor: json.cursor?.next || null,
129
+ };
130
+ }
131
+
117
132
  export async function communitiesLatest(query, opts = {}) {
118
133
  const raw = await this.graphql("GlobalCommunitiesLatestPostSearchTimeline", {
119
134
  variables: {