@sns-parse/core 0.4.0-alpha.3 → 0.4.0-alpha.4

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.
@@ -274,7 +274,8 @@ function mapGraphql(rawResult) {
274
274
  const legacy = result.legacy || {};
275
275
  const user = result.core?.user_results?.result;
276
276
  const ulegacy = user?.legacy || {};
277
- const text = String(pick(legacy.full_text, result.note_tweet?.note_results?.note?.text, ''));
277
+ // 长推(note tweet):legacy.full_text 是截断版,全文在 note_tweet.note_results.note.text
278
+ const text = String(pick(result.note_tweet?.note_results?.note?.text, legacy.full_text, ''));
278
279
  const p = baseParsed();
279
280
  const media = Array.isArray(legacy.entities?.media) ? legacy.entities.media : [];
280
281
  const photos = [];
@@ -387,7 +388,19 @@ async function parseTwitter(url, http, creds, getGraphql) {
387
388
  });
388
389
  const tw = res.data;
389
390
  if (tw && tw.__typename === 'Tweet' && tw.user) {
390
- return mapSyndication(tw);
391
+ const p = mapSyndication(tw);
392
+ // 长推:syndication 现仅返回 note_tweet 的 id 引用(无 text),tw.text 被
393
+ // display_text_range 截断。有登录态时改走 GraphQL 取全文;失败回退截断结果。
394
+ const noteTruncated = tw.note_tweet && !tw.note_tweet.text;
395
+ if (noteTruncated && creds && creds.authToken && creds.ct0) {
396
+ try {
397
+ return await fetchGraphqlTweet(id, creds, getGraphql || tls_client_1.tlsGet);
398
+ }
399
+ catch {
400
+ return p;
401
+ }
402
+ }
403
+ return p;
391
404
  }
392
405
  // 2) tombstone(需登录):回退到鉴权 GraphQL(TLS 指纹模拟)
393
406
  if (creds && creds.authToken && creds.ct0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sns-parse/core",
3
- "version": "0.4.0-alpha.3+upstream.1.6.7",
3
+ "version": "0.4.0-alpha.4+upstream.1.6.7",
4
4
  "description": "sns-parse 核心:契约、宿主抽象、配置 DSL 与解析引擎(fetcher/parser/翻译/X 原生解析/合并/GIF/TLS 指纹客户端)",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",