@postfetch/core 0.4.2 → 0.5.0

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/dist/index.js CHANGED
@@ -1012,9 +1012,6 @@ async function resolveReddit(input) {
1012
1012
  const token = await appToken(input.net);
1013
1013
  const post = await fetchPost(input.net, token, id);
1014
1014
  const items = await mediaItems3(input, post, id);
1015
- if (items.length === 0) {
1016
- throw new Error("Reddit media not found");
1017
- }
1018
1015
  return { archiveFilename: filename(`reddit_${id}.zip`), id, items, metadata: redditMetadata(post), platform: "reddit" };
1019
1016
  }
1020
1017
  function redditMetadata(post) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postfetch/core",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Zero-dependency typed core that turns Facebook, Instagram, Pinterest, Reddit, SoundCloud, TikTok, X and YouTube post URLs into media files.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/reddit.ts CHANGED
@@ -27,10 +27,10 @@ export async function resolveReddit(input: ResolveContext): Promise<PostfetchRes
27
27
  const id = await postId(input.net, input.url);
28
28
  const token = await appToken(input.net);
29
29
  const post = await fetchPost(input.net, token, id);
30
+ // A text post is a valid result with metadata and no media — fetchPost has
31
+ // already thrown if the post itself is missing, so empty items here mean a
32
+ // self/text post, not a failure.
30
33
  const items = await mediaItems(input, post, id);
31
- if (items.length === 0) {
32
- throw new Error("Reddit media not found");
33
- }
34
34
  return { archiveFilename: filename(`reddit_${id}.zip`), id, items, metadata: redditMetadata(post), platform: "reddit" };
35
35
  }
36
36