@danhachuel/thunderbolt 0.6.55 → 0.6.56
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.
|
@@ -277,7 +277,7 @@ def _render_instagram_posts(profile: Mapping[str, Any]) -> None:
|
|
|
277
277
|
_persist_instagram_posts(profile, posts)
|
|
278
278
|
st.success(f"{len(posts)} posts carregados.")
|
|
279
279
|
else:
|
|
280
|
-
st.
|
|
280
|
+
st.error(posts_message)
|
|
281
281
|
posts = st.session_state.get(state_key, posts)
|
|
282
282
|
if not posts:
|
|
283
283
|
st.info("Clique em Carregar últimos 10 para consultar os posts públicos desta conta.")
|
|
@@ -299,7 +299,7 @@ def _render_instagram_posts(profile: Mapping[str, Any]) -> None:
|
|
|
299
299
|
posts = _normalise_instagram_posts(loaded_posts)
|
|
300
300
|
_persist_instagram_posts(profile, posts)
|
|
301
301
|
else:
|
|
302
|
-
st.
|
|
302
|
+
st.error(posts_message)
|
|
303
303
|
|
|
304
304
|
|
|
305
305
|
def _api_card_defaults(kind: str) -> tuple[str, list[str], Callable[[Mapping[str, Any]], dict[str, Any]]]:
|
|
@@ -684,7 +684,10 @@ def render_social_networks(settings: dict[str, Any]) -> None:
|
|
|
684
684
|
st.session_state["social_instagram_ok"] = result.ok
|
|
685
685
|
st.session_state["social_instagram_message"] = result.message
|
|
686
686
|
if st.session_state.get("social_instagram_message"):
|
|
687
|
-
|
|
687
|
+
if st.session_state.get("social_instagram_ok"):
|
|
688
|
+
st.success(st.session_state["social_instagram_message"])
|
|
689
|
+
else:
|
|
690
|
+
st.error(st.session_state["social_instagram_message"])
|
|
688
691
|
data = st.session_state.get("social_instagram_result", {}) if st.session_state.get("social_instagram_ok") else {}
|
|
689
692
|
if data:
|
|
690
693
|
characters, _ = _characters(settings)
|
|
@@ -804,7 +804,7 @@ def fetch_public_instagram_profile(source: str) -> IntegrationResult:
|
|
|
804
804
|
return IntegrationResult(True, 'Perfil encontrado via fallback instaloader. O país pode não estar disponível.', data)
|
|
805
805
|
return IntegrationResult(True, 'Perfil Instagram encontrado publicamente.', data)
|
|
806
806
|
if platform.system() == 'Windows':
|
|
807
|
-
return IntegrationResult(False, 'Não foi possível
|
|
807
|
+
return IntegrationResult(False, 'Não foi possível obter os dados do Instagram. Verifique sua conexão ou tente novamente mais tarde.', reference)
|
|
808
808
|
try:
|
|
809
809
|
response = requests.get(reference['url'], headers={'User-Agent': 'Mozilla/5.0', 'Accept-Language': 'pt-BR,pt;q=0.9,en;q=0.8'}, timeout=12)
|
|
810
810
|
except requests.RequestException as exc:
|
|
@@ -977,7 +977,7 @@ def fetch_public_instagram_posts(source: str, limit: int = 10) -> IntegrationRes
|
|
|
977
977
|
_streamlit_message('info', 'Dados obtidos via fallback (instaloader). O país pode não estar disponível.', 'posts_instaloader_fallback')
|
|
978
978
|
else:
|
|
979
979
|
_streamlit_message('error', 'Não foi possível obter os dados do Instagram. Verifique sua conexão ou tente novamente mais tarde.', 'posts_instagram_failed')
|
|
980
|
-
return IntegrationResult(bool(posts), 'Posts públicos encontrados.' if posts else 'Não foi possível
|
|
980
|
+
return IntegrationResult(bool(posts), 'Posts públicos encontrados.' if posts else 'Não foi possível obter os dados do Instagram. Verifique sua conexão ou tente novamente mais tarde.', reference | {'posts': posts[:max(1, int(limit))]})
|
|
981
981
|
api_user = _fetch_web_profile_user(reference['username'])
|
|
982
982
|
if api_user:
|
|
983
983
|
api_posts: list[dict[str, Any]] = []
|
|
@@ -1014,7 +1014,7 @@ def fetch_public_instagram_posts(source: str, limit: int = 10) -> IntegrationRes
|
|
|
1014
1014
|
if not posts:
|
|
1015
1015
|
posts = _fetch_posts_with_playwright(reference, limit, _instagram_cookies())
|
|
1016
1016
|
LOGGER.debug('Instagram posts extracted=%s limit=%s', len(posts), limit)
|
|
1017
|
-
return IntegrationResult(bool(posts), 'Posts públicos encontrados.' if posts else 'Não foi possível
|
|
1017
|
+
return IntegrationResult(bool(posts), 'Posts públicos encontrados.' if posts else 'Não foi possível obter os dados do Instagram. Verifique sua conexão ou tente novamente mais tarde.', reference | {'posts': posts[:max(1, int(limit))]})
|
|
1018
1018
|
|
|
1019
1019
|
|
|
1020
1020
|
__all__ = ['IntegrationResult', 'extract_public_instagram_country', 'fetch_posts_instaloader', 'fetch_profile_instaloader', 'fetch_public_instagram_posts', 'fetch_public_instagram_profile', 'normalize_instagram_bio', 'normalize_instagram_metric', 'normalize_instagram_reference']
|
package/package.json
CHANGED