upload-post 2.1.2 → 2.2.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/README.md +16 -0
- package/index.d.ts +33 -0
- package/index.js +33 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -181,6 +181,22 @@ const analytics = await client.getAnalytics('my-profile', {
|
|
|
181
181
|
console.log(analytics);
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
+
### Get Media
|
|
185
|
+
|
|
186
|
+
Retrieve recent posts from a connected social account. Supported platforms:
|
|
187
|
+
`instagram`, `tiktok`, `youtube`, `linkedin`, `facebook`, `x`, `threads`,
|
|
188
|
+
`pinterest`, `bluesky`, `reddit`.
|
|
189
|
+
|
|
190
|
+
```javascript
|
|
191
|
+
const { media } = await client.getMedia('linkedin', 'my-profile');
|
|
192
|
+
|
|
193
|
+
// Force the personal LinkedIn profile of an account connected as an org admin:
|
|
194
|
+
await client.getMedia('linkedin', 'my-profile', { pageUrn: 'me' });
|
|
195
|
+
|
|
196
|
+
// Target a specific LinkedIn organization page:
|
|
197
|
+
await client.getMedia('linkedin', 'my-profile', { pageUrn: '12345' });
|
|
198
|
+
```
|
|
199
|
+
|
|
184
200
|
### Helper Methods
|
|
185
201
|
|
|
186
202
|
```javascript
|
package/index.d.ts
CHANGED
|
@@ -192,6 +192,17 @@ declare module 'upload-post' {
|
|
|
192
192
|
youtubeHasPaidProductPlacement?: boolean;
|
|
193
193
|
/** Recording date (ISO 8601) */
|
|
194
194
|
youtubeRecordingDate?: string;
|
|
195
|
+
/** Subtitle/caption files to upload. Each entry needs a language code and either a file path or URL. */
|
|
196
|
+
youtubeSubtitles?: Array<{
|
|
197
|
+
/** BCP-47 language code (e.g. "en", "es") */
|
|
198
|
+
language: string;
|
|
199
|
+
/** Display name for the subtitle track (e.g. "English", "Español") */
|
|
200
|
+
name?: string;
|
|
201
|
+
/** Path to the subtitle file (SRT, VTT, SBV, SUB, ASS, SSA, TTML) */
|
|
202
|
+
file?: string;
|
|
203
|
+
/** URL to the subtitle file */
|
|
204
|
+
url?: string;
|
|
205
|
+
}>;
|
|
195
206
|
}
|
|
196
207
|
|
|
197
208
|
// ==================== LinkedIn Options ====================
|
|
@@ -589,6 +600,28 @@ declare module 'upload-post' {
|
|
|
589
600
|
metric_labels: Record<string, string>;
|
|
590
601
|
}>>;
|
|
591
602
|
|
|
603
|
+
/**
|
|
604
|
+
* Get recent media from a connected social account.
|
|
605
|
+
*
|
|
606
|
+
* @param options.pageUrn - LinkedIn only. Numeric org ID, full org URN, or "me" to force the personal profile.
|
|
607
|
+
*/
|
|
608
|
+
getMedia(
|
|
609
|
+
platform: 'instagram' | 'tiktok' | 'youtube' | 'linkedin' | 'facebook' | 'x' | 'threads' | 'pinterest' | 'bluesky' | 'reddit' | string,
|
|
610
|
+
user: string,
|
|
611
|
+
options?: { pageUrn?: string }
|
|
612
|
+
): Promise<{
|
|
613
|
+
success: boolean;
|
|
614
|
+
media: Array<{
|
|
615
|
+
id: string;
|
|
616
|
+
caption: string | null;
|
|
617
|
+
media_type: 'IMAGE' | 'VIDEO' | 'CAROUSEL_ALBUM' | 'TEXT' | string;
|
|
618
|
+
media_url: string | null;
|
|
619
|
+
permalink: string | null;
|
|
620
|
+
timestamp: string | null;
|
|
621
|
+
thumbnail_url: string | null;
|
|
622
|
+
}>;
|
|
623
|
+
}>;
|
|
624
|
+
|
|
592
625
|
// Scheduled Posts
|
|
593
626
|
/**
|
|
594
627
|
* List scheduled posts
|
package/index.js
CHANGED
|
@@ -198,6 +198,24 @@ export class UploadPost {
|
|
|
198
198
|
if (options.youtubeBlockedCountries) form.append('blockedCountries', options.youtubeBlockedCountries);
|
|
199
199
|
if (options.youtubeHasPaidProductPlacement !== undefined) form.append('hasPaidProductPlacement', String(options.youtubeHasPaidProductPlacement));
|
|
200
200
|
if (options.youtubeRecordingDate) form.append('recordingDate', options.youtubeRecordingDate);
|
|
201
|
+
if (options.youtubeSubtitles && Array.isArray(options.youtubeSubtitles)) {
|
|
202
|
+
options.youtubeSubtitles.forEach((sub, idx) => {
|
|
203
|
+
if (sub.language) {
|
|
204
|
+
form.append(`youtube_subtitle_language_${idx}`, sub.language);
|
|
205
|
+
if (sub.name) form.append(`youtube_subtitle_name_${idx}`, sub.name);
|
|
206
|
+
if (sub.file) {
|
|
207
|
+
// file can be a string path or a ReadableStream
|
|
208
|
+
if (typeof sub.file === 'string') {
|
|
209
|
+
form.append(`youtube_subtitle_file_${idx}`, createReadStream(sub.file));
|
|
210
|
+
} else {
|
|
211
|
+
form.append(`youtube_subtitle_file_${idx}`, sub.file);
|
|
212
|
+
}
|
|
213
|
+
} else if (sub.url) {
|
|
214
|
+
form.append(`youtube_subtitle_file_${idx}`, sub.url);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
201
219
|
}
|
|
202
220
|
|
|
203
221
|
/**
|
|
@@ -744,6 +762,21 @@ export class UploadPost {
|
|
|
744
762
|
return this._request('/uploadposts/platform-metrics', 'GET');
|
|
745
763
|
}
|
|
746
764
|
|
|
765
|
+
/**
|
|
766
|
+
* Get recent media from a connected social account.
|
|
767
|
+
*
|
|
768
|
+
* @param {string} platform - instagram, tiktok, youtube, linkedin, facebook, x, threads, pinterest, bluesky, reddit
|
|
769
|
+
* @param {string} user - Profile username
|
|
770
|
+
* @param {Object} [options]
|
|
771
|
+
* @param {string} [options.pageUrn] - LinkedIn only. Numeric org ID, full URN, or "me" to force the personal profile.
|
|
772
|
+
* @returns {Promise<Object>}
|
|
773
|
+
*/
|
|
774
|
+
async getMedia(platform, user, options = {}) {
|
|
775
|
+
const params = { platform, user };
|
|
776
|
+
if (options.pageUrn) params.page_urn = options.pageUrn;
|
|
777
|
+
return this._request('/uploadposts/media', 'GET', params);
|
|
778
|
+
}
|
|
779
|
+
|
|
747
780
|
// ==================== Scheduled Posts ====================
|
|
748
781
|
|
|
749
782
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "upload-post",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Official client library for Upload-Post API - Cross-platform social media upload for TikTok, Instagram, YouTube, LinkedIn, Facebook, Pinterest, Threads, Reddit, Bluesky, and X (Twitter)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|