@danhachuel/thunderbolt 0.6.67 → 0.6.68

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.
@@ -585,6 +585,39 @@ def _post_from_node(node: dict[str, Any]) -> dict[str, Any] | None:
585
585
  }
586
586
 
587
587
 
588
+ def _fetch_posts_with_instaloader(username: str, limit: int = 10) -> list[dict[str, Any]]:
589
+ """Obtém os posts mais recentes de um perfil público usando Instaloader."""
590
+ print(f'Instaloader: tentando obter posts de @{username}')
591
+ try:
592
+ import instaloader
593
+
594
+ loader = instaloader.Instaloader()
595
+ profile = instaloader.Profile.from_username(loader.context, username)
596
+ posts: list[dict[str, Any]] = []
597
+ for post in profile.get_posts():
598
+ if len(posts) >= max(1, int(limit)):
599
+ break
600
+ timestamp = post.date_utc.timestamp() if post.date_utc else ''
601
+ post_url = str(post.url or '').strip()
602
+ shortcode = str(post.shortcode or '').strip()
603
+ posts.append({
604
+ 'id': post.mediaid,
605
+ 'shortcode': shortcode,
606
+ 'url': f'https://www.instagram.com/p/{shortcode}/' if shortcode else post_url,
607
+ 'image_url': post_url,
608
+ 'display_url': post_url,
609
+ 'caption': str(post.caption or '').strip(),
610
+ 'published_at': timestamp,
611
+ 'timestamp': timestamp,
612
+ 'is_video': bool(getattr(post, 'is_video', False)),
613
+ })
614
+ print(f'Instaloader: {len(posts)} posts encontrados para @{username}')
615
+ return posts
616
+ except Exception as exc:
617
+ print(f'Instaloader falhou para @{username}: {exc}')
618
+ return []
619
+
620
+
588
621
  def _fetch_posts_with_ytdlp(username: str, limit: int = 10) -> list[dict[str, Any]]:
589
622
  """Fetch public Instagram post metadata with the installed yt-dlp CLI."""
590
623
  import subprocess
@@ -639,6 +672,9 @@ def fetch_public_instagram_posts(source: str, limit: int = 10) -> IntegrationRes
639
672
  except ValueError as exc:
640
673
  return IntegrationResult(False, str(exc), {})
641
674
  if platform.system() == 'Windows':
675
+ instaloader_posts = _fetch_posts_with_instaloader(reference['username'], limit)
676
+ if instaloader_posts:
677
+ return IntegrationResult(True, f'{len(instaloader_posts)} posts obtidos via Instaloader', reference | {'posts': instaloader_posts})
642
678
  ytdlp_posts = _fetch_posts_with_ytdlp(reference['username'], limit)
643
679
  print(f'yt-dlp posts retornados para @{reference["username"]}: {len(ytdlp_posts)}')
644
680
  if ytdlp_posts:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.6.67",
3
+ "version": "0.6.68",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",
package/requirements.txt CHANGED
@@ -17,6 +17,7 @@ mlxtend>=0.23,<1
17
17
  plotly>=5.18,<7
18
18
  seaborn>=0.13,<1
19
19
  yt-dlp[default]>=2025.1.15,<2027
20
+ instaloader>=4.14,<5
20
21
  deno>=2.3,<3
21
22
  youtube-transcript-api>=1.2.0,<2
22
23
  ytmusicapi>=1.12,<2
@@ -481,7 +481,7 @@ function writeSettings(moneyprinterPath) {
481
481
 
482
482
  function installThunderboltDependencies(python) {
483
483
  if (!existsSync(pythonBin)) run(python.command, [...python.args, "-m", "venv", venvPath]);
484
- installRequirementIfNeeded(join(root, "requirements.txt"), "thunderbolt_requirements_sha256", ["streamlit", "requests", "pandas", "toml", "imageio_ffmpeg", "edge_tts", "google.auth", "google_auth_oauthlib", "googleapiclient", "yt_dlp", "deno", "youtube_transcript_api", "huggingface_hub", "playwright"], "Thunderbolt");
484
+ installRequirementIfNeeded(join(root, "requirements.txt"), "thunderbolt_requirements_sha256", ["streamlit", "requests", "pandas", "toml", "imageio_ffmpeg", "edge_tts", "google.auth", "google_auth_oauthlib", "googleapiclient", "yt_dlp", "instaloader", "deno", "youtube_transcript_api", "huggingface_hub", "playwright"], "Thunderbolt");
485
485
  installPlaywrightBrowsers();
486
486
  }
487
487