@postfetch/core 0.13.7 → 0.13.8
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 +3 -0
- package/package.json +1 -1
- package/src/tiktok.ts +6 -0
package/dist/index.js
CHANGED
|
@@ -2811,6 +2811,9 @@ async function resolveTiktok(input) {
|
|
|
2811
2811
|
}
|
|
2812
2812
|
const items = mediaItems4(page.item, user, id, headers);
|
|
2813
2813
|
if (items.length === 0) {
|
|
2814
|
+
if (page.item.isContentClassified === true) {
|
|
2815
|
+
throw new PostfetchError(401, "TikTok post requires login to open classified content", "loginRequired");
|
|
2816
|
+
}
|
|
2814
2817
|
throw new Error("TikTok media not found");
|
|
2815
2818
|
}
|
|
2816
2819
|
return { archiveFilename: filename(`tiktok_${user}_${id}.zip`), comments: [], id, items, metadata: tiktokMetadata(page.item), platform: "tiktok" };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postfetch/core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.8",
|
|
4
4
|
"description": "Zero-dependency typed core that turns Facebook, Instagram, LinkedIn, Pinterest, Reddit, SoundCloud, Spotify, TikTok, X and YouTube post URLs into media files.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/tiktok.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
filename,
|
|
6
6
|
isoFromEpochSeconds,
|
|
7
7
|
object,
|
|
8
|
+
PostfetchError,
|
|
8
9
|
string,
|
|
9
10
|
type PostMetadata,
|
|
10
11
|
type TiktokExtra,
|
|
@@ -40,6 +41,11 @@ export async function resolveTiktok(input: ResolveContext): Promise<PostfetchRes
|
|
|
40
41
|
}
|
|
41
42
|
const items = mediaItems(page.item, user, id, headers);
|
|
42
43
|
if (items.length === 0) {
|
|
44
|
+
// TikTok returns a successful hydration response with an empty video for
|
|
45
|
+
// sensitive-content posts that anonymous viewers must log in to open.
|
|
46
|
+
if (page.item.isContentClassified === true) {
|
|
47
|
+
throw new PostfetchError(401, "TikTok post requires login to open classified content", "loginRequired");
|
|
48
|
+
}
|
|
43
49
|
throw new Error("TikTok media not found");
|
|
44
50
|
}
|
|
45
51
|
return { archiveFilename: filename(`tiktok_${user}_${id}.zip`), comments: [], id, items, metadata: tiktokMetadata(page.item), platform: "tiktok" };
|