@sockethub/platform-metadata 1.0.1-beta.4 → 1.0.1-beta.5

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.
@@ -42,6 +42,24 @@ export declare function isFacebookUrl(url: string): boolean;
42
42
  * Open Graph title and image to WhatsApp's link-preview crawler.
43
43
  */
44
44
  export declare function isAmazonUrl(url: string): boolean;
45
+ /**
46
+ * Amazon's mobile-app share links (`/gp/aw/d/<ASIN>`) get a generic "Amazon"
47
+ * card even for WhatsApp's crawler, while `/dp/<ASIN>` on the same host gets
48
+ * the product. Returns the `/dp/` URL, or null for any other URL.
49
+ */
50
+ export declare function resolveAmazonAppLink(url: string): string | null;
51
+ /**
52
+ * Product image from an Amazon desktop product page. Amazon randomly serves
53
+ * the crawler that page (no product Open Graph tags, only its logo) instead
54
+ * of the share-card one; the main image is still in `#landingImage`.
55
+ */
56
+ export declare function extractAmazonImage(html: string | undefined): string | undefined;
57
+ /**
58
+ * Summary from schema.org JSON-LD for pages without a meta description: a
59
+ * `description`, else a `headline` that isn't just the page title (Wikipedia
60
+ * puts its short description there, e.g. "1979 studio album by Brian Eno").
61
+ */
62
+ export declare function schemaOrgSummary(jsonLD: unknown, title?: string): string | undefined;
45
63
  /**
46
64
  * Remove the engagement-stats segment Facebook prepends to video titles:
47
65
  * "2.2M views · 21K reactions | <video title> | <author>". The stats are
@@ -158,6 +176,21 @@ export declare function redditPostImages(images: PageObject["image"]): PageObjec
158
176
  * excessive vertical whitespace at one blank line.
159
177
  */
160
178
  export declare function normalizeDescription(value: string): string;
179
+ /** Media attached to an FxTwitter status (or to the status it quotes). */
180
+ interface FxTwitterMedia {
181
+ photos?: Array<{
182
+ url?: string;
183
+ width?: number;
184
+ height?: number;
185
+ }>;
186
+ videos?: Array<{
187
+ url?: string;
188
+ thumbnail_url?: string;
189
+ width?: number;
190
+ height?: number;
191
+ duration?: number;
192
+ }>;
193
+ }
161
194
  /** Subset of the FxTwitter status API response the platform consumes. */
162
195
  export interface FxTwitterStatus {
163
196
  code: number;
@@ -168,21 +201,19 @@ export interface FxTwitterStatus {
168
201
  author?: {
169
202
  name?: string;
170
203
  screen_name?: string;
204
+ avatar_url?: string;
171
205
  };
172
- media?: {
173
- photos?: Array<{
206
+ card?: {
207
+ image?: {
174
208
  url?: string;
175
209
  width?: number;
176
210
  height?: number;
177
- }>;
178
- videos?: Array<{
179
- url?: string;
180
- thumbnail_url?: string;
181
- width?: number;
182
- height?: number;
183
- duration?: number;
184
- }>;
211
+ };
212
+ };
213
+ quote?: {
214
+ media?: FxTwitterMedia;
185
215
  };
216
+ media?: FxTwitterMedia;
186
217
  article?: {
187
218
  title?: string;
188
219
  preview_text?: string;
@@ -234,3 +265,4 @@ export interface PageObject {
234
265
  * reports anything but success (the caller falls back to the OG scrape).
235
266
  */
236
267
  export declare function tweetToPageObject(status: FxTwitterStatus): PageObject | null;
268
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sockethub/platform-metadata",
3
- "version": "1.0.1-beta.4",
3
+ "version": "1.0.1-beta.5",
4
4
  "description": "Fetch metadata from a given URL",
5
5
  "author": "Nick Jennings <nick@silverbucket.net>",
6
6
  "license": "LGPL-3.0+",
@@ -42,16 +42,16 @@
42
42
  "clean:deps": "rm -rf node_modules"
43
43
  },
44
44
  "dependencies": {
45
- "@sockethub/util": "^1.0.0-beta.4",
45
+ "@sockethub/util": "^1.0.0-beta.5",
46
46
  "open-graph-scraper": "^6.11.0",
47
47
  "undici": "^7.30.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@sockethub/schemas": "^3.0.0-beta.4"
50
+ "@sockethub/schemas": "^3.0.0-beta.5"
51
51
  },
52
52
  "peerDependencies": {
53
- "@sockethub/server": "^5.0.0-beta.4"
53
+ "@sockethub/server": "^5.0.0-beta.5"
54
54
  },
55
- "gitHead": "2839403a8add67c25f39e164d4ba24ddb8a7ed3e",
55
+ "gitHead": "2dffe4cc1bea5375e38531b1012b56bcbab93569",
56
56
  "types": "./dist/index.d.ts"
57
57
  }