@sockethub/platform-metadata 1.0.1-alpha.14 → 1.0.1-alpha.16
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/README.md +6 -6
- package/dist/index.d.ts +12 -0
- package/dist/index.js +649 -354
- package/dist/index.js.map +7 -7
- package/dist/resolvers.d.ts +39 -0
- package/package.json +7 -6
package/dist/resolvers.d.ts
CHANGED
|
@@ -30,6 +30,45 @@ export declare function resolveTwitterStatus(url: string): string | null;
|
|
|
30
30
|
* no OG data (or an outright 403 from datacenter addresses).
|
|
31
31
|
*/
|
|
32
32
|
export declare function isRedditUrl(url: string): boolean;
|
|
33
|
+
/** Map a canonical Reddit post URL to Reddit's official media-enabled embed. */
|
|
34
|
+
export declare function resolveRedditEmbed(url: string): string | null;
|
|
35
|
+
/** Map a canonical Reddit post URL to old.reddit.com's public JSON endpoint. */
|
|
36
|
+
export declare function resolveRedditJson(url: string): string | null;
|
|
37
|
+
export interface RedditPost {
|
|
38
|
+
title: string;
|
|
39
|
+
selftext?: string;
|
|
40
|
+
url?: string;
|
|
41
|
+
url_overridden_by_dest?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Validate and extract the post object from Reddit's listing response. */
|
|
44
|
+
export declare function parseRedditPost(value: unknown): RedditPost | null;
|
|
45
|
+
/** Select only a direct Reddit-hosted image belonging to the post. */
|
|
46
|
+
export declare function redditPostImage(post: RedditPost): PageObject["image"];
|
|
47
|
+
/** Subset of Reddit's oEmbed response used for link previews. */
|
|
48
|
+
export interface RedditOEmbed {
|
|
49
|
+
title?: string;
|
|
50
|
+
author_name?: string;
|
|
51
|
+
provider_name?: string;
|
|
52
|
+
thumbnail_url?: string;
|
|
53
|
+
thumbnail_width?: number;
|
|
54
|
+
thumbnail_height?: number;
|
|
55
|
+
}
|
|
56
|
+
/** Validate the subset of Reddit's untrusted oEmbed JSON that we consume. */
|
|
57
|
+
export declare function parseRedditOEmbed(value: unknown): RedditOEmbed | null;
|
|
58
|
+
/**
|
|
59
|
+
* Convert Reddit's optional oEmbed thumbnail into the platform image shape.
|
|
60
|
+
* A missing or malformed thumbnail deliberately means "no image": Reddit's
|
|
61
|
+
* scraped Open Graph image may be a generic site hero rather than post media.
|
|
62
|
+
*/
|
|
63
|
+
export declare function redditOEmbedImage(embed: RedditOEmbed): PageObject["image"] | undefined;
|
|
64
|
+
/** Keep only Reddit-hosted post media, excluding branding/share-card images. */
|
|
65
|
+
export declare function redditPostImages(images: PageObject["image"]): PageObject["image"] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Make scraped plain text readable without flattening intentional structure.
|
|
68
|
+
* Preserve line breaks and paragraphs, but remove HTML indentation and cap
|
|
69
|
+
* excessive vertical whitespace at one blank line.
|
|
70
|
+
*/
|
|
71
|
+
export declare function normalizeDescription(value: string): string;
|
|
33
72
|
/** Subset of the FxTwitter status API response the platform consumes. */
|
|
34
73
|
export interface FxTwitterStatus {
|
|
35
74
|
code: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sockethub/platform-metadata",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.16",
|
|
4
4
|
"description": "Fetch metadata from a given URL",
|
|
5
5
|
"author": "Nick Jennings <nick@silverbucket.net>",
|
|
6
6
|
"license": "LGPL-3.0+",
|
|
@@ -42,15 +42,16 @@
|
|
|
42
42
|
"clean:deps": "rm -rf node_modules"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@sockethub/util": "^1.0.0-alpha.
|
|
46
|
-
"open-graph-scraper": "^6.11.0"
|
|
45
|
+
"@sockethub/util": "^1.0.0-alpha.9",
|
|
46
|
+
"open-graph-scraper": "^6.11.0",
|
|
47
|
+
"undici": "^7.16.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@sockethub/schemas": "^3.0.0-alpha.
|
|
50
|
+
"@sockethub/schemas": "^3.0.0-alpha.21"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
|
-
"@sockethub/server": "^5.0.0-alpha.
|
|
53
|
+
"@sockethub/server": "^5.0.0-alpha.21"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "1d87ef9d415159ef624e86e929ef2a2fb7a4b50e",
|
|
55
56
|
"types": "./dist/index.d.ts"
|
|
56
57
|
}
|