upload-post 2.1.1__tar.gz → 2.2.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: upload-post
3
- Version: 2.1.1
3
+ Version: 2.2.0
4
4
  Summary: Cross-platform social media upload for TikTok, Instagram, YouTube, LinkedIn, Facebook, Pinterest, Threads, Reddit, Bluesky, and X (Twitter)
5
5
  Home-page: https://www.upload-post.com/
6
6
  Author: Upload-Post
@@ -223,6 +223,23 @@ analytics = client.get_analytics(
223
223
  print(analytics)
224
224
  ```
225
225
 
226
+ ### Get Media
227
+
228
+ Retrieve recent posts from a connected social account. Supported platforms:
229
+ `instagram`, `tiktok`, `youtube`, `linkedin`, `facebook`, `x`, `threads`,
230
+ `pinterest`, `bluesky`, `reddit`.
231
+
232
+ ```python
233
+ # Personal LinkedIn profile (default for non-org accounts):
234
+ media = client.get_media("linkedin", "my-profile")
235
+
236
+ # Force the personal profile of an account connected as an org admin:
237
+ media = client.get_media("linkedin", "my-profile", page_urn="me")
238
+
239
+ # Target a specific LinkedIn organization page:
240
+ media = client.get_media("linkedin", "my-profile", page_urn="12345")
241
+ ```
242
+
226
243
  ### Helper Methods
227
244
 
228
245
  ```python
@@ -185,6 +185,23 @@ analytics = client.get_analytics(
185
185
  print(analytics)
186
186
  ```
187
187
 
188
+ ### Get Media
189
+
190
+ Retrieve recent posts from a connected social account. Supported platforms:
191
+ `instagram`, `tiktok`, `youtube`, `linkedin`, `facebook`, `x`, `threads`,
192
+ `pinterest`, `bluesky`, `reddit`.
193
+
194
+ ```python
195
+ # Personal LinkedIn profile (default for non-org accounts):
196
+ media = client.get_media("linkedin", "my-profile")
197
+
198
+ # Force the personal profile of an account connected as an org admin:
199
+ media = client.get_media("linkedin", "my-profile", page_urn="me")
200
+
201
+ # Target a specific LinkedIn organization page:
202
+ media = client.get_media("linkedin", "my-profile", page_urn="12345")
203
+ ```
204
+
188
205
  ### Helper Methods
189
206
 
190
207
  ```python
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
5
5
 
6
6
  setup(
7
7
  name="upload-post",
8
- version="2.1.1",
8
+ version="2.2.0",
9
9
  author="Upload-Post",
10
10
  author_email="hi@img2html.com",
11
11
  description="Cross-platform social media upload for TikTok, Instagram, YouTube, LinkedIn, Facebook, Pinterest, Threads, Reddit, Bluesky, and X (Twitter)",
@@ -15,7 +15,7 @@ Example:
15
15
  ... )
16
16
  """
17
17
 
18
- __version__ = "2.1.1"
18
+ __version__ = "2.2.0"
19
19
 
20
20
  from .api_client import UploadPostClient, UploadPostError
21
21
 
@@ -212,7 +212,7 @@ class UploadPostClient:
212
212
  if kwargs.get("thumb_offset"):
213
213
  data.append(("thumb_offset", kwargs["thumb_offset"]))
214
214
 
215
- def _add_youtube_params(self, data: List[tuple], **kwargs):
215
+ def _add_youtube_params(self, data: List[tuple], files: List[tuple] = None, **kwargs):
216
216
  """Add YouTube-specific parameters."""
217
217
  if kwargs.get("tags"):
218
218
  tags = kwargs["tags"]
@@ -248,6 +248,21 @@ class UploadPostClient:
248
248
  data.append(("hasPaidProductPlacement", str(kwargs["hasPaidProductPlacement"]).lower()))
249
249
  if kwargs.get("recordingDate"):
250
250
  data.append(("recordingDate", kwargs["recordingDate"]))
251
+ if kwargs.get("subtitles"):
252
+ for idx, sub in enumerate(kwargs["subtitles"]):
253
+ if sub.get("language"):
254
+ data.append((f"youtube_subtitle_language_{idx}", sub["language"]))
255
+ if sub.get("name"):
256
+ data.append((f"youtube_subtitle_name_{idx}", sub["name"]))
257
+ if sub.get("file"):
258
+ sub_path = Path(sub["file"])
259
+ if sub_path.exists() and files is not None:
260
+ files.append((f"youtube_subtitle_file_{idx}", (sub_path.name, sub_path.open("rb"))))
261
+ else:
262
+ # Treat as URL string
263
+ data.append((f"youtube_subtitle_file_{idx}", str(sub["file"])))
264
+ elif sub.get("url"):
265
+ data.append((f"youtube_subtitle_file_{idx}", sub["url"]))
251
266
 
252
267
  def _add_linkedin_params(self, data: List[tuple], is_text: bool = False, **kwargs):
253
268
  """Add LinkedIn-specific parameters."""
@@ -429,7 +444,9 @@ class UploadPostClient:
429
444
  blockedCountries: Comma-separated country codes
430
445
  hasPaidProductPlacement: Paid placement flag
431
446
  recordingDate: Recording date (ISO 8601)
432
-
447
+ subtitles: List of subtitle dicts with keys: language (BCP-47),
448
+ name (display name), file (path to SRT/VTT file), url (subtitle URL)
449
+
433
450
  LinkedIn:
434
451
  visibility: PUBLIC, CONNECTIONS, LOGGED_IN, CONTAINER
435
452
  target_linkedin_page_id: Page ID for organization posts
@@ -489,7 +506,7 @@ class UploadPostClient:
489
506
  if "instagram" in platforms:
490
507
  self._add_instagram_params(data, is_video=True, files=files, **kwargs)
491
508
  if "youtube" in platforms:
492
- self._add_youtube_params(data, **kwargs)
509
+ self._add_youtube_params(data, files=files, **kwargs)
493
510
  if "linkedin" in platforms:
494
511
  self._add_linkedin_params(data, **kwargs)
495
512
  if "facebook" in platforms:
@@ -973,6 +990,30 @@ class UploadPostClient:
973
990
  """
974
991
  return self._request("/uploadposts/platform-metrics", "GET")
975
992
 
993
+ def get_media(
994
+ self,
995
+ platform: str,
996
+ user: str,
997
+ page_urn: Optional[str] = None,
998
+ ) -> Dict:
999
+ """
1000
+ Retrieve recent media from a connected social account.
1001
+
1002
+ Args:
1003
+ platform: instagram, tiktok, youtube, linkedin, facebook, x,
1004
+ threads, pinterest, bluesky, or reddit.
1005
+ user: Profile username.
1006
+ page_urn: LinkedIn only. Numeric org ID, full URN, or ``"me"`` to
1007
+ force the personal profile of an org-admin account.
1008
+
1009
+ Returns:
1010
+ ``{"success": True, "media": [...]}``.
1011
+ """
1012
+ params: Dict[str, str] = {"platform": platform, "user": user}
1013
+ if page_urn:
1014
+ params["page_urn"] = page_urn
1015
+ return self._request("/uploadposts/media", "GET", params=params)
1016
+
976
1017
  # ==================== Scheduled Posts ====================
977
1018
 
978
1019
  def list_scheduled(self) -> Dict:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: upload-post
3
- Version: 2.1.1
3
+ Version: 2.2.0
4
4
  Summary: Cross-platform social media upload for TikTok, Instagram, YouTube, LinkedIn, Facebook, Pinterest, Threads, Reddit, Bluesky, and X (Twitter)
5
5
  Home-page: https://www.upload-post.com/
6
6
  Author: Upload-Post
@@ -223,6 +223,23 @@ analytics = client.get_analytics(
223
223
  print(analytics)
224
224
  ```
225
225
 
226
+ ### Get Media
227
+
228
+ Retrieve recent posts from a connected social account. Supported platforms:
229
+ `instagram`, `tiktok`, `youtube`, `linkedin`, `facebook`, `x`, `threads`,
230
+ `pinterest`, `bluesky`, `reddit`.
231
+
232
+ ```python
233
+ # Personal LinkedIn profile (default for non-org accounts):
234
+ media = client.get_media("linkedin", "my-profile")
235
+
236
+ # Force the personal profile of an account connected as an org admin:
237
+ media = client.get_media("linkedin", "my-profile", page_urn="me")
238
+
239
+ # Target a specific LinkedIn organization page:
240
+ media = client.get_media("linkedin", "my-profile", page_urn="12345")
241
+ ```
242
+
226
243
  ### Helper Methods
227
244
 
228
245
  ```python
File without changes