instasave-sdk 1.2.6 → 1.2.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/CHANGELOG.md +145 -0
- package/README.md +202 -2
- package/dist/core/media-scraper.d.ts +6 -0
- package/dist/core/media-scraper.d.ts.map +1 -1
- package/dist/core/media-scraper.js +8 -0
- package/dist/core/media-scraper.js.map +1 -1
- package/dist/download/download-engine.d.ts +32 -0
- package/dist/download/download-engine.d.ts.map +1 -0
- package/dist/download/download-engine.js +177 -0
- package/dist/download/download-engine.js.map +1 -0
- package/dist/download/download-manager.d.ts +18 -0
- package/dist/download/download-manager.d.ts.map +1 -0
- package/dist/download/download-manager.js +232 -0
- package/dist/download/download-manager.js.map +1 -0
- package/dist/download/download-scrape.d.ts +32 -0
- package/dist/download/download-scrape.d.ts.map +1 -0
- package/dist/download/download-scrape.js +159 -0
- package/dist/download/download-scrape.js.map +1 -0
- package/dist/download/index.d.ts +4 -0
- package/dist/download/index.d.ts.map +1 -0
- package/dist/download/index.js +25 -0
- package/dist/download/index.js.map +1 -0
- package/dist/download/types.d.ts +48 -0
- package/dist/download/types.d.ts.map +1 -0
- package/dist/download/types.js +6 -0
- package/dist/download/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/platforms/instagram/extractors/metadata.d.ts +1 -10
- package/dist/platforms/instagram/extractors/metadata.d.ts.map +1 -1
- package/dist/platforms/instagram/extractors/metadata.js +14 -116
- package/dist/platforms/instagram/extractors/metadata.js.map +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.DownloadScrapeEngine = exports.downloadScrape = exports.downloadImages = exports.DownloadManager = void 0;
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
var download_manager_1 = require("./download-manager");
|
|
20
|
+
Object.defineProperty(exports, "DownloadManager", { enumerable: true, get: function () { return download_manager_1.DownloadManager; } });
|
|
21
|
+
Object.defineProperty(exports, "downloadImages", { enumerable: true, get: function () { return download_manager_1.downloadImages; } });
|
|
22
|
+
var download_scrape_1 = require("./download-scrape");
|
|
23
|
+
Object.defineProperty(exports, "downloadScrape", { enumerable: true, get: function () { return download_scrape_1.downloadScrape; } });
|
|
24
|
+
Object.defineProperty(exports, "DownloadScrapeEngine", { enumerable: true, get: function () { return download_scrape_1.DownloadScrapeEngine; } });
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/download/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,uDAAqE;AAA5D,mHAAA,eAAe,OAAA;AAAE,kHAAA,cAAc,OAAA;AACxC,qDAAsH;AAA7G,iHAAA,cAAc,OAAA;AAAE,uHAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Download module types
|
|
3
|
+
*/
|
|
4
|
+
export interface DownloadOptions {
|
|
5
|
+
savePath: string;
|
|
6
|
+
getFile: 'download' | 'save' | boolean;
|
|
7
|
+
filename?: string;
|
|
8
|
+
format?: 'original';
|
|
9
|
+
quality?: number;
|
|
10
|
+
overwrite?: boolean;
|
|
11
|
+
skipDuplicates?: boolean;
|
|
12
|
+
createSubfolders?: boolean;
|
|
13
|
+
onProgress?: (percent: number, current: number, total: number) => void;
|
|
14
|
+
timeout?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface DownloadResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
total: number;
|
|
19
|
+
downloaded: number;
|
|
20
|
+
failed: number;
|
|
21
|
+
skipped: number;
|
|
22
|
+
files: DownloadedFile[];
|
|
23
|
+
errors: DownloadError[];
|
|
24
|
+
totalBytes: number;
|
|
25
|
+
duration: number;
|
|
26
|
+
}
|
|
27
|
+
export interface DownloadedFile {
|
|
28
|
+
index: number;
|
|
29
|
+
url: string;
|
|
30
|
+
path: string;
|
|
31
|
+
filename: string;
|
|
32
|
+
bytes: number;
|
|
33
|
+
format: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DownloadError {
|
|
36
|
+
index: number;
|
|
37
|
+
url: string;
|
|
38
|
+
code: string;
|
|
39
|
+
message: string;
|
|
40
|
+
}
|
|
41
|
+
export interface DownloadFileParams {
|
|
42
|
+
url: string;
|
|
43
|
+
destPath: string;
|
|
44
|
+
filename: string;
|
|
45
|
+
onProgress?: (percent: number) => void;
|
|
46
|
+
timeout?: number;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/download/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,O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I,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/download/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export { URLNormalizer } from './utils/url-normalizer';
|
|
|
11
11
|
export { CrawlerManager } from './browser/crawler-manager';
|
|
12
12
|
export { BrowserPool } from './browser/browser-pool';
|
|
13
13
|
export { ConsoleMode, log } from './utils/logger';
|
|
14
|
+
export { DownloadManager, downloadImages } from './download';
|
|
15
|
+
export { downloadScrape, DownloadScrapeEngine, DownloadScrapeOptions, DownloadScrapeResult } from './download';
|
|
16
|
+
export type { DownloadOptions, DownloadResult, DownloadedFile, DownloadError } from './download';
|
|
14
17
|
export * from './types';
|
|
15
18
|
export * from './platforms';
|
|
16
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAChH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,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AAC;AAC7D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAC/G,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGjG,cAAc,SAAS,CAAC;AAGxB,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.log = exports.BrowserPool = exports.CrawlerManager = exports.URLNormalizer = exports.ConfigParser = exports.FileManager = exports.ProgressTracker = exports.BUILTIN_PLATFORMS = exports.HealthChecker = exports.MetricsCollector = exports.PluginManager = exports.FastAuthManager = exports.WorkflowExecutor = exports.MediaScraper = void 0;
|
|
17
|
+
exports.DownloadScrapeEngine = exports.downloadScrape = exports.downloadImages = exports.DownloadManager = exports.log = exports.BrowserPool = exports.CrawlerManager = exports.URLNormalizer = exports.ConfigParser = exports.FileManager = exports.ProgressTracker = exports.BUILTIN_PLATFORMS = exports.HealthChecker = exports.MetricsCollector = exports.PluginManager = exports.FastAuthManager = exports.WorkflowExecutor = exports.MediaScraper = void 0;
|
|
18
18
|
// Main SDK exports - backward compatibility maintained
|
|
19
19
|
var core_1 = require("./core");
|
|
20
20
|
Object.defineProperty(exports, "MediaScraper", { enumerable: true, get: function () { return core_1.MediaScraper; } });
|
|
@@ -43,6 +43,12 @@ var browser_pool_1 = require("./browser/browser-pool");
|
|
|
43
43
|
Object.defineProperty(exports, "BrowserPool", { enumerable: true, get: function () { return browser_pool_1.BrowserPool; } });
|
|
44
44
|
var logger_1 = require("./utils/logger");
|
|
45
45
|
Object.defineProperty(exports, "log", { enumerable: true, get: function () { return logger_1.log; } });
|
|
46
|
+
var download_1 = require("./download");
|
|
47
|
+
Object.defineProperty(exports, "DownloadManager", { enumerable: true, get: function () { return download_1.DownloadManager; } });
|
|
48
|
+
Object.defineProperty(exports, "downloadImages", { enumerable: true, get: function () { return download_1.downloadImages; } });
|
|
49
|
+
var download_2 = require("./download");
|
|
50
|
+
Object.defineProperty(exports, "downloadScrape", { enumerable: true, get: function () { return download_2.downloadScrape; } });
|
|
51
|
+
Object.defineProperty(exports, "DownloadScrapeEngine", { enumerable: true, get: function () { return download_2.DownloadScrapeEngine; } });
|
|
46
52
|
// Re-export all types for backward compatibility
|
|
47
53
|
__exportStar(require("./types"), exports);
|
|
48
54
|
// Re-export platforms
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,+BAAwD;AAA/C,oGAAA,YAAY,OAAA;AAAE,wGAAA,gBAAgB,OAAA;AACvC,+BAAwE;AAA/D,uGAAA,eAAe,OAAA;AACxB,qCAAgH;AAAvG,wGAAA,aAAa,OAAA;AACtB,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AACzB,yCAA+C;AAAtC,uGAAA,aAAa,OAAA;AACtB,yCAAgD;AAAvC,8GAAA,iBAAiB,OAAA;AAC1B,6DAA4F;AAAnF,mHAAA,eAAe,OAAA;AACxB,qDAAmD;AAA1C,2GAAA,WAAW,OAAA;AACpB,yCAA+D;AAAtD,sGAAA,YAAY,OAAA;AACrB,yDAAuD;AAA9C,+GAAA,aAAa,OAAA;AACtB,6DAA2D;AAAlD,iHAAA,cAAc,OAAA;AACvB,uDAAqD;AAA5C,2GAAA,WAAW,OAAA;AACpB,yCAAkD;AAA5B,6FAAA,GAAG,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,+BAAwD;AAA/C,oGAAA,YAAY,OAAA;AAAE,wGAAA,gBAAgB,OAAA;AACvC,+BAAwE;AAA/D,uGAAA,eAAe,OAAA;AACxB,qCAAgH;AAAvG,wGAAA,aAAa,OAAA;AACtB,2CAAmD;AAA1C,2GAAA,gBAAgB,OAAA;AACzB,yCAA+C;AAAtC,uGAAA,aAAa,OAAA;AACtB,yCAAgD;AAAvC,8GAAA,iBAAiB,OAAA;AAC1B,6DAA4F;AAAnF,mHAAA,eAAe,OAAA;AACxB,qDAAmD;AAA1C,2GAAA,WAAW,OAAA;AACpB,yCAA+D;AAAtD,sGAAA,YAAY,OAAA;AACrB,yDAAuD;AAA9C,+GAAA,aAAa,OAAA;AACtB,6DAA2D;AAAlD,iHAAA,cAAc,OAAA;AACvB,uDAAqD;AAA5C,2GAAA,WAAW,OAAA;AACpB,yCAAkD;AAA5B,6FAAA,GAAG,OAAA;AACzB,uCAA6D;AAApD,2GAAA,eAAe,OAAA;AAAE,0GAAA,cAAc,OAAA;AACxC,uCAA+G;AAAtG,0GAAA,cAAc,OAAA;AAAE,gHAAA,oBAAoB,OAAA;AAG7C,iDAAiD;AACjD,0CAAwB;AAExB,sBAAsB;AACtB,8CAA4B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Metadata extractor
|
|
2
|
+
* Metadata extractor using og:description
|
|
3
3
|
*/
|
|
4
4
|
import { Page } from 'puppeteer';
|
|
5
5
|
export interface PostMetadata {
|
|
@@ -9,16 +9,7 @@ export interface PostMetadata {
|
|
|
9
9
|
timestamp: string | null;
|
|
10
10
|
location: string | null;
|
|
11
11
|
}
|
|
12
|
-
/**
|
|
13
|
-
* MetadataExtractor s oddělenými metodami pro každý typ metadat
|
|
14
|
-
*/
|
|
15
12
|
export declare class MetadataExtractor {
|
|
16
13
|
extract(page: Page): Promise<PostMetadata>;
|
|
17
|
-
private extractCaption;
|
|
18
|
-
private extractLikesCount;
|
|
19
|
-
private extractCommentsCount;
|
|
20
|
-
private extractTimestamp;
|
|
21
|
-
private extractLocation;
|
|
22
|
-
private formatTimestamp;
|
|
23
14
|
}
|
|
24
15
|
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../../src/platforms/instagram/extractors/metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../../src/platforms/instagram/extractors/metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,qBAAa,iBAAiB;IACtB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC;CAoBjD"}
|
|
@@ -1,129 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Metadata extractor
|
|
3
|
+
* Metadata extractor using og:description
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MetadataExtractor = void 0;
|
|
7
|
-
const common_1 = require("./common");
|
|
8
|
-
const constants_1 = require("../constants");
|
|
9
|
-
/**
|
|
10
|
-
* MetadataExtractor s oddělenými metodami pro každý typ metadat
|
|
11
|
-
*/
|
|
12
7
|
class MetadataExtractor {
|
|
13
8
|
async extract(page) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]);
|
|
9
|
+
const description = await page.$eval('meta[property="og:description"]', el => el.getAttribute('content') || '').catch(() => null);
|
|
10
|
+
if (!description) {
|
|
11
|
+
return { likesCount: null, commentsCount: null, caption: null, timestamp: null, location: null };
|
|
12
|
+
}
|
|
13
|
+
const likesMatch = description.match(/^([\d,]+)\s+likes/);
|
|
14
|
+
const commentsMatch = description.match(/(\d+[\d,]*)\s+comments/);
|
|
15
|
+
const captionMatch = description.match(/"([^&]+)"/) || description.match(/"([^"]+)"/);
|
|
16
|
+
const timestampMatch = description.match(/on\s+([^:]+):/);
|
|
21
17
|
return {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
timestamp,
|
|
26
|
-
location
|
|
18
|
+
likesCount: likesMatch ? parseInt(likesMatch[1].replace(/,/g, ''), 10) : null,
|
|
19
|
+
commentsCount: commentsMatch ? parseInt(commentsMatch[1].replace(/,/g, ''), 10) : null,
|
|
20
|
+
caption: captionMatch ? captionMatch[1].trim() : null,
|
|
21
|
+
timestamp: timestampMatch ? timestampMatch[1].trim() : null,
|
|
22
|
+
location: null
|
|
27
23
|
};
|
|
28
24
|
}
|
|
29
|
-
async extractCaption(page) {
|
|
30
|
-
return await (0, common_1.findInJsonScripts)(page, (obj) => {
|
|
31
|
-
if (obj.edge_media_to_caption?.edges?.[0]?.node?.text) {
|
|
32
|
-
return obj.edge_media_to_caption.edges[0].node.text;
|
|
33
|
-
}
|
|
34
|
-
if (obj.caption?.text) {
|
|
35
|
-
return obj.caption.text;
|
|
36
|
-
}
|
|
37
|
-
if (obj.accessibility_caption) {
|
|
38
|
-
return obj.accessibility_caption;
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
async extractLikesCount(page) {
|
|
44
|
-
return await (0, common_1.findInJsonScripts)(page, (obj) => {
|
|
45
|
-
if (obj.edge_media_preview_like?.count !== undefined) {
|
|
46
|
-
return obj.edge_media_preview_like.count;
|
|
47
|
-
}
|
|
48
|
-
if (obj.like_count !== undefined) {
|
|
49
|
-
return obj.like_count;
|
|
50
|
-
}
|
|
51
|
-
if (obj.edge_liked_by?.count !== undefined) {
|
|
52
|
-
return obj.edge_liked_by.count;
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
async extractCommentsCount(page) {
|
|
58
|
-
return await (0, common_1.findInJsonScripts)(page, (obj) => {
|
|
59
|
-
if (obj.edge_media_to_comment?.count !== undefined) {
|
|
60
|
-
return obj.edge_media_to_comment.count;
|
|
61
|
-
}
|
|
62
|
-
if (obj.comment_count !== undefined) {
|
|
63
|
-
return obj.comment_count;
|
|
64
|
-
}
|
|
65
|
-
if (obj.edge_media_to_parent_comment?.count !== undefined) {
|
|
66
|
-
return obj.edge_media_to_parent_comment.count;
|
|
67
|
-
}
|
|
68
|
-
return null;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
async extractTimestamp(page) {
|
|
72
|
-
// Nejdřív zkusit najít relativní čas v DOM
|
|
73
|
-
const relativeTime = await page.evaluate((timeRegex) => {
|
|
74
|
-
const allElements = document.querySelectorAll('*');
|
|
75
|
-
for (const element of allElements) {
|
|
76
|
-
const text = element.textContent?.trim();
|
|
77
|
-
if (text?.match(timeRegex)) {
|
|
78
|
-
return text.match(timeRegex)?.[0] || null;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
}, constants_1.REGEX_PATTERNS.TIME_AGO);
|
|
83
|
-
if (relativeTime)
|
|
84
|
-
return relativeTime;
|
|
85
|
-
// Fallback na absolutní čas z JSON
|
|
86
|
-
return await (0, common_1.findInJsonScripts)(page, (obj) => {
|
|
87
|
-
if (obj.taken_at_timestamp) {
|
|
88
|
-
return this.formatTimestamp(obj.taken_at_timestamp);
|
|
89
|
-
}
|
|
90
|
-
if (obj.created_time) {
|
|
91
|
-
return this.formatTimestamp(obj.created_time);
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
async extractLocation(page) {
|
|
97
|
-
return await (0, common_1.findInJsonScripts)(page, (obj) => {
|
|
98
|
-
if (obj.location?.name) {
|
|
99
|
-
return obj.location.name;
|
|
100
|
-
}
|
|
101
|
-
if (obj.venue?.name) {
|
|
102
|
-
return obj.venue.name;
|
|
103
|
-
}
|
|
104
|
-
if (obj.place?.name) {
|
|
105
|
-
return obj.place.name;
|
|
106
|
-
}
|
|
107
|
-
return null;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
formatTimestamp(timestamp) {
|
|
111
|
-
const date = new Date(timestamp * 1000);
|
|
112
|
-
const now = new Date();
|
|
113
|
-
const diffMs = now.getTime() - date.getTime();
|
|
114
|
-
const diffHours = Math.floor(diffMs / (1000 * 60 * 60));
|
|
115
|
-
const diffDays = Math.floor(diffHours / 24);
|
|
116
|
-
if (diffDays > 0) {
|
|
117
|
-
return `${diffDays} day${diffDays > 1 ? 's' : ''} ago`;
|
|
118
|
-
}
|
|
119
|
-
else if (diffHours > 0) {
|
|
120
|
-
return `${diffHours} hour${diffHours > 1 ? 's' : ''} ago`;
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
const diffMins = Math.floor(diffMs / (1000 * 60));
|
|
124
|
-
return `${diffMins} minute${diffMins > 1 ? 's' : ''} ago`;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
25
|
}
|
|
128
26
|
exports.MetadataExtractor = MetadataExtractor;
|
|
129
27
|
//# sourceMappingURL=metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../../src/platforms/instagram/extractors/metadata.ts"],"names":[],"mappings":";AAAA;;GAEG;;;
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../../src/platforms/instagram/extractors/metadata.ts"],"names":[],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IAAI;YACrD,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI;YAC3D,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;CACF;AArBD,8CAqBC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instasave-sdk",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "Instagram image scraper SDK with authentication support",
|
|
3
|
+
"version": "1.2.8",
|
|
4
|
+
"description": "Instagram image scraper SDK with authentication support and direct download functionality",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"repository": {
|
|
@@ -34,7 +34,10 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"crawlee": "^3.5.0",
|
|
36
36
|
"puppeteer": "^21.0.0",
|
|
37
|
-
"dotenv": "^16.0.0"
|
|
37
|
+
"dotenv": "^16.0.0",
|
|
38
|
+
"axios": "^1.6.0",
|
|
39
|
+
"sharp": "^0.33.0",
|
|
40
|
+
"file-type": "^18.0.0"
|
|
38
41
|
},
|
|
39
42
|
"devDependencies": {
|
|
40
43
|
"typescript": "^5.0.0",
|