@finch_ren/x-scraper 0.1.1 → 0.1.3

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.
@@ -33,9 +33,16 @@ function ItemResultFromJSONTyped(json, ignoreDiscriminator) {
33
33
  if (json == null) {
34
34
  return json;
35
35
  }
36
+ let result;
37
+ try {
38
+ result = json['result'] == null ? undefined : (0, TweetUnion_1.TweetUnionFromJSON)(json['result']);
39
+ }
40
+ catch {
41
+ result = json['result'];
42
+ }
36
43
  return {
37
44
  'typename': json['__typename'] == null ? undefined : (0, TypeName_1.TypeNameFromJSON)(json['__typename']),
38
- 'result': json['result'] == null ? undefined : (0, TweetUnion_1.TweetUnionFromJSON)(json['result']),
45
+ 'result': result,
39
46
  };
40
47
  }
41
48
  function ItemResultToJSON(json) {
@@ -38,8 +38,15 @@ function TimelineAddEntryFromJSONTyped(json, ignoreDiscriminator) {
38
38
  if (json == null) {
39
39
  return json;
40
40
  }
41
+ let content;
42
+ try {
43
+ content = (0, ContentUnion_1.ContentUnionFromJSON)(json['content']);
44
+ }
45
+ catch {
46
+ content = json['content'];
47
+ }
41
48
  return {
42
- 'content': (0, ContentUnion_1.ContentUnionFromJSON)(json['content']),
49
+ 'content': content,
43
50
  'entryId': json['entryId'],
44
51
  'sortIndex': json['sortIndex'],
45
52
  };
@@ -41,12 +41,19 @@ function TimelineTimelineItemFromJSONTyped(json, ignoreDiscriminator) {
41
41
  if (json == null) {
42
42
  return json;
43
43
  }
44
+ let itemContent;
45
+ try {
46
+ itemContent = (0, ItemContentUnion_1.ItemContentUnionFromJSON)(json['itemContent']);
47
+ }
48
+ catch {
49
+ itemContent = json['itemContent'];
50
+ }
44
51
  return {
45
52
  'typename': (0, TypeName_1.TypeNameFromJSON)(json['__typename']),
46
53
  'clientEventInfo': json['clientEventInfo'] == null ? undefined : (0, ClientEventInfo_1.ClientEventInfoFromJSON)(json['clientEventInfo']),
47
54
  'entryType': (0, ContentEntryType_1.ContentEntryTypeFromJSON)(json['entryType']),
48
55
  'feedbackInfo': json['feedbackInfo'] == null ? undefined : json['feedbackInfo'],
49
- 'itemContent': (0, ItemContentUnion_1.ItemContentUnionFromJSON)(json['itemContent']),
56
+ 'itemContent': itemContent,
50
57
  };
51
58
  }
52
59
  function TimelineTimelineItemToJSON(json) {
@@ -43,6 +43,13 @@ function TimelineTimelineModuleFromJSONTyped(json, ignoreDiscriminator) {
43
43
  if (json == null) {
44
44
  return json;
45
45
  }
46
+ let items;
47
+ try {
48
+ items = json['items'] == null ? undefined : (json['items'].map(ModuleItem_1.ModuleItemFromJSON));
49
+ }
50
+ catch {
51
+ items = json['items'];
52
+ }
46
53
  return {
47
54
  'typename': (0, TypeName_1.TypeNameFromJSON)(json['__typename']),
48
55
  'clientEventInfo': json['clientEventInfo'] == null ? undefined : (0, ClientEventInfo_1.ClientEventInfoFromJSON)(json['clientEventInfo']),
@@ -51,7 +58,7 @@ function TimelineTimelineModuleFromJSONTyped(json, ignoreDiscriminator) {
51
58
  'feedbackInfo': json['feedbackInfo'] == null ? undefined : (0, FeedbackInfo_1.FeedbackInfoFromJSON)(json['feedbackInfo']),
52
59
  'footer': json['footer'] == null ? undefined : json['footer'],
53
60
  'header': json['header'] == null ? undefined : json['header'],
54
- 'items': json['items'] == null ? undefined : (json['items'].map(ModuleItem_1.ModuleItemFromJSON)),
61
+ 'items': items,
55
62
  'metadata': json['metadata'] == null ? undefined : json['metadata'],
56
63
  };
57
64
  }
@@ -54,15 +54,29 @@ function TimelineTweetFromJSONTyped(json, ignoreDiscriminator) {
54
54
  if (json == null) {
55
55
  return json;
56
56
  }
57
+ let tweetResults;
58
+ try {
59
+ tweetResults = (0, ItemResult_1.ItemResultFromJSON)(json['tweet_results']);
60
+ }
61
+ catch {
62
+ tweetResults = json['tweet_results'];
63
+ }
64
+ let socialContext;
65
+ try {
66
+ socialContext = json['socialContext'] == null ? undefined : (0, SocialContextUnion_1.SocialContextUnionFromJSON)(json['socialContext']);
67
+ }
68
+ catch {
69
+ socialContext = json['socialContext'];
70
+ }
57
71
  return {
58
72
  'typename': (0, TypeName_1.TypeNameFromJSON)(json['__typename']),
59
73
  'hasModeratedReplies': json['hasModeratedReplies'] == null ? undefined : json['hasModeratedReplies'],
60
74
  'highlights': json['highlights'] == null ? undefined : (0, Highlight_1.HighlightFromJSON)(json['highlights']),
61
75
  'itemType': (0, ContentItemType_1.ContentItemTypeFromJSON)(json['itemType']),
62
76
  'promotedMetadata': json['promotedMetadata'] == null ? undefined : json['promotedMetadata'],
63
- 'socialContext': json['socialContext'] == null ? undefined : (0, SocialContextUnion_1.SocialContextUnionFromJSON)(json['socialContext']),
77
+ 'socialContext': socialContext,
64
78
  'tweetDisplayType': json['tweetDisplayType'],
65
- 'tweetResults': (0, ItemResult_1.ItemResultFromJSON)(json['tweet_results']),
79
+ 'tweetResults': tweetResults,
66
80
  };
67
81
  }
68
82
  function TimelineTweetToJSON(json) {
@@ -53,6 +53,20 @@ function TweetFromJSONTyped(json, ignoreDiscriminator) {
53
53
  if (json == null) {
54
54
  return json;
55
55
  }
56
+ let core;
57
+ try {
58
+ core = json['core'] == null ? undefined : (0, UserResultCore_1.UserResultCoreFromJSON)(json['core']);
59
+ }
60
+ catch {
61
+ core = json['core'];
62
+ }
63
+ let quotedStatusResult;
64
+ try {
65
+ quotedStatusResult = json['quoted_status_result'] == null ? undefined : (0, ItemResult_1.ItemResultFromJSON)(json['quoted_status_result']);
66
+ }
67
+ catch {
68
+ quotedStatusResult = json['quoted_status_result'];
69
+ }
56
70
  return {
57
71
  'typename': json['__typename'] == null ? undefined : (0, TypeName_1.TypeNameFromJSON)(json['__typename']),
58
72
  'article': json['article'] == null ? undefined : (0, Article_1.ArticleFromJSON)(json['article']),
@@ -61,7 +75,7 @@ function TweetFromJSONTyped(json, ignoreDiscriminator) {
61
75
  'card': json['card'] == null ? undefined : (0, TweetCard_1.TweetCardFromJSON)(json['card']),
62
76
  'communityRelationship': json['community_relationship'] == null ? undefined : (0, CommunityRelationship_1.CommunityRelationshipFromJSON)(json['community_relationship']),
63
77
  'communityResults': json['community_results'] == null ? undefined : (0, Community_1.CommunityFromJSON)(json['community_results']),
64
- 'core': json['core'] == null ? undefined : (0, UserResultCore_1.UserResultCoreFromJSON)(json['core']),
78
+ 'core': core,
65
79
  'editControl': json['edit_control'] == null ? undefined : (0, TweetEditControl_1.TweetEditControlFromJSON)(json['edit_control']),
66
80
  'editPrespective': json['edit_prespective'] == null ? undefined : (0, TweetEditPrespective_1.TweetEditPrespectiveFromJSON)(json['edit_prespective']),
67
81
  'grokAnalysisButton': json['grok_analysis_button'] == null ? undefined : json['grok_analysis_button'],
@@ -74,7 +88,7 @@ function TweetFromJSONTyped(json, ignoreDiscriminator) {
74
88
  'previousCounts': json['previous_counts'] == null ? undefined : (0, TweetPreviousCounts_1.TweetPreviousCountsFromJSON)(json['previous_counts']),
75
89
  'quickPromoteEligibility': json['quick_promote_eligibility'] == null ? undefined : json['quick_promote_eligibility'],
76
90
  'quotedRefResult': json['quotedRefResult'] == null ? undefined : (0, QuotedRefResult_1.QuotedRefResultFromJSON)(json['quotedRefResult']),
77
- 'quotedStatusResult': json['quoted_status_result'] == null ? undefined : (0, ItemResult_1.ItemResultFromJSON)(json['quoted_status_result']),
91
+ 'quotedStatusResult': quotedStatusResult,
78
92
  'restId': json['rest_id'],
79
93
  'source': json['source'] == null ? undefined : json['source'],
80
94
  'superFollowsReplyUserResult': json['superFollowsReplyUserResult'] == null ? undefined : (0, SuperFollowsReplyUserResult_1.SuperFollowsReplyUserResultFromJSON)(json['superFollowsReplyUserResult']),
@@ -75,14 +75,14 @@ const instructionConverter = (item) => {
75
75
  return item
76
76
  .flatMap((e) => {
77
77
  if (e.type == i.InstructionType.TimelineAddEntries) {
78
- return [];
78
+ return (0, exports.tweetEntriesConverter)(e.entries);
79
79
  }
80
80
  else if (e.type == i.InstructionType.TimelineAddToModule) {
81
81
  const item = e.moduleItems ?? [];
82
82
  return (0, exports.moduleConverter)(item);
83
83
  }
84
84
  else if (e.type == i.InstructionType.TimelineReplaceEntry) {
85
- return [];
85
+ return (0, exports.tweetEntriesConverter)([e.entry]);
86
86
  }
87
87
  return [];
88
88
  })
@@ -109,6 +109,7 @@ const tweetEntriesConverter = (item) => {
109
109
  const item = e.content.items ?? [];
110
110
  return (0, exports.moduleConverter)(item);
111
111
  }
112
+ return undefined;
112
113
  })
113
114
  .filter((e) => e != undefined)
114
115
  .map((e) => e.filter((e) => e != undefined))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finch_ren/x-scraper",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A TypeScript SDK for X (Twitter) internal GraphQL endpoints with cookie-based authentication.",
5
5
  "keywords": [
6
6
  "twitter",