ultra-igdl 1.0.2 → 1.0.3
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 +1 -1
- package/dist/cli/index.cjs +39 -4
- package/dist/cli/index.cjs.map +1 -1
- package/dist/index.cjs +39 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +39 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cli/index.cjs
CHANGED
|
@@ -929,7 +929,7 @@ init_cjs_shims();
|
|
|
929
929
|
|
|
930
930
|
// src/version.ts
|
|
931
931
|
init_cjs_shims();
|
|
932
|
-
var PACKAGE_VERSION = "1.0.
|
|
932
|
+
var PACKAGE_VERSION = "1.0.3";
|
|
933
933
|
|
|
934
934
|
// src/types/index.ts
|
|
935
935
|
var EXTRACTOR_NAME = "ultra-igdl";
|
|
@@ -2993,7 +2993,7 @@ var DownloaderCore = class {
|
|
|
2993
2993
|
}
|
|
2994
2994
|
}
|
|
2995
2995
|
prefetchApiData = fromApi;
|
|
2996
|
-
} else if (sessionCookie && parsed.type === "post" && parsed.shortcode) {
|
|
2996
|
+
} else if (sessionCookie && (parsed.type === "post" || parsed.type === "reel" || parsed.type === "tv") && parsed.shortcode) {
|
|
2997
2997
|
sessionCookie = await ensureSession(sessionCookie);
|
|
2998
2998
|
const mediaPk = shortcodeToMediaPk(parsed.shortcode);
|
|
2999
2999
|
const ownerId = userIdFromCookie(sessionCookie) ?? void 0;
|
|
@@ -3006,6 +3006,26 @@ var DownloaderCore = class {
|
|
|
3006
3006
|
prefetchApiData = fromApi;
|
|
3007
3007
|
body = pageRes.body;
|
|
3008
3008
|
statusCode = pageRes.statusCode;
|
|
3009
|
+
if (parsed.type === "reel" || parsed.type === "tv") {
|
|
3010
|
+
const apiMedia = filterValidMedia(fromApi?.media ?? []);
|
|
3011
|
+
if (hasReelVideo(apiMedia)) {
|
|
3012
|
+
const pageMeta2 = extractPageMeta(body);
|
|
3013
|
+
const extracted2 = normalizeExtraction(
|
|
3014
|
+
{
|
|
3015
|
+
...fromApi,
|
|
3016
|
+
media: apiMedia,
|
|
3017
|
+
caption: fromApi.caption ?? "",
|
|
3018
|
+
username: fromApi.username || ""
|
|
3019
|
+
},
|
|
3020
|
+
parsed,
|
|
3021
|
+
{ ...pageMeta2, html: body },
|
|
3022
|
+
body
|
|
3023
|
+
);
|
|
3024
|
+
if (extracted2?.media.length) {
|
|
3025
|
+
return this.success(extracted2);
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3009
3029
|
} else {
|
|
3010
3030
|
const pageRes = await pagePromise;
|
|
3011
3031
|
body = pageRes.body;
|
|
@@ -3060,6 +3080,19 @@ var DownloaderCore = class {
|
|
|
3060
3080
|
};
|
|
3061
3081
|
}
|
|
3062
3082
|
}
|
|
3083
|
+
if ((parsed.type === "reel" || parsed.type === "tv") && prefetchApiData && !hasReelVideo(filterValidMedia(extracted?.media ?? []))) {
|
|
3084
|
+
const apiMedia = filterValidMedia(prefetchApiData.media);
|
|
3085
|
+
if (hasReelVideo(apiMedia)) {
|
|
3086
|
+
extracted = {
|
|
3087
|
+
...extracted ?? { media: [], caption: "", username: "" },
|
|
3088
|
+
...prefetchApiData,
|
|
3089
|
+
media: apiMedia,
|
|
3090
|
+
caption: prefetchApiData.caption || extracted?.caption || "",
|
|
3091
|
+
username: prefetchApiData.username || extracted?.username || "",
|
|
3092
|
+
engagement: prefetchApiData.engagement ?? extracted?.engagement
|
|
3093
|
+
};
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3063
3096
|
const validExtracted = filterValidMedia(extracted?.media ?? []);
|
|
3064
3097
|
if (parsed.type === "story" && sessionCookie && !hasStoryVideo(validExtracted)) {
|
|
3065
3098
|
logger.debug("Trying story API with session cookie");
|
|
@@ -3122,13 +3155,15 @@ var DownloaderCore = class {
|
|
|
3122
3155
|
${embedBody}
|
|
3123
3156
|
${captionEmbedHtml}` : body;
|
|
3124
3157
|
if ((parsed.type === "reel" || parsed.type === "tv") && sessionCookie && !hasReelVideo(extracted?.media ?? [])) {
|
|
3125
|
-
|
|
3158
|
+
sessionCookie = await ensureSession(sessionCookie);
|
|
3159
|
+
const mediaPk = (parsed.shortcode ? shortcodeToMediaPk(parsed.shortcode) : null) ?? extractMediaPkFromHtml(dimensionHtmlPre);
|
|
3126
3160
|
if (mediaPk) {
|
|
3127
3161
|
logger.debug(`Reel API fallback for media pk=${mediaPk}`);
|
|
3128
3162
|
const fromApi = await fetchMediaInfoByPk(
|
|
3129
3163
|
mediaPk,
|
|
3130
3164
|
sessionCookie,
|
|
3131
|
-
parsed.normalized
|
|
3165
|
+
parsed.normalized,
|
|
3166
|
+
userIdFromCookie(sessionCookie) ?? void 0
|
|
3132
3167
|
);
|
|
3133
3168
|
extracted = mergeExtracted(extracted, fromApi);
|
|
3134
3169
|
}
|