@danhachuel/thunderbolt 0.6.61 → 0.6.62
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.
|
@@ -15,7 +15,7 @@ from hermes_ui.influencers import InfluencerBackendError, STANDALONE_CONTENT_INF
|
|
|
15
15
|
from hermes_ui.storage import read_json, write_json
|
|
16
16
|
from hermes_ui.countries import COUNTRY_OPTIONS
|
|
17
17
|
from hermes_ui.languages import LANGUAGE_CODES, language_code, language_label
|
|
18
|
-
from integrations.instagram_public import fetch_public_instagram_posts, fetch_public_instagram_profile,
|
|
18
|
+
from integrations.instagram_public import fetch_public_instagram_posts, fetch_public_instagram_profile, normalize_instagram_metric
|
|
19
19
|
from integrations.meta_social import test_facebook_pages_api_card, test_instagram_api_card
|
|
20
20
|
|
|
21
21
|
|
|
@@ -46,17 +46,13 @@ def _metric_input(value: Any) -> int | None:
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
def _render_instagram_bio(value: Any) -> None:
|
|
49
|
-
bio =
|
|
49
|
+
bio = str(value or "")
|
|
50
50
|
if bio:
|
|
51
51
|
st.text(bio)
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
def _profile_bio(profile: Mapping[str, Any]) -> str:
|
|
55
|
-
|
|
56
|
-
bio = normalize_instagram_bio(profile.get(key))
|
|
57
|
-
if bio:
|
|
58
|
-
return bio
|
|
59
|
-
return ""
|
|
55
|
+
return str(profile.get("bio") or profile.get("biography", ""))
|
|
60
56
|
|
|
61
57
|
|
|
62
58
|
def _country_key(value: Any) -> str:
|
|
@@ -539,7 +535,7 @@ def _render_instagram_card(profile: dict[str, Any], characters: list[dict[str, A
|
|
|
539
535
|
following = st.number_input("seguindo", min_value=0, value=_metric_input(_profile_metric(profile, "following_count", "following", "follows", "followingCount", "edge_follow")), placeholder="Não encontrado", key=f"instagram_edit_following_{profile_id}")
|
|
540
536
|
save_edit = st.form_submit_button("Guardar alterações", type="primary", use_container_width=True)
|
|
541
537
|
if save_edit:
|
|
542
|
-
update_channel(profile_id, {"name": name.strip(), "handle": handle.strip(), "bio":
|
|
538
|
+
update_channel(profile_id, {"name": name.strip(), "handle": handle.strip(), "bio": bio, "bio_raw": bio, "country": _normalise_country(country), "language": language, "post_count": _metric_input(posts), "subscriber_count": _metric_input(followers), "following_count": _metric_input(following)})
|
|
543
539
|
st.session_state.pop(edit_key, None)
|
|
544
540
|
st.success("Conta Instagram actualizada.")
|
|
545
541
|
st.rerun()
|
|
@@ -625,7 +621,7 @@ def render_social_networks(settings: dict[str, Any]) -> None:
|
|
|
625
621
|
save_profile = st.form_submit_button("Cadastrar conta Instagram", type="primary", use_container_width=True)
|
|
626
622
|
if save_profile:
|
|
627
623
|
profile_data = dict(data)
|
|
628
|
-
profile_data.update({"name": name, "bio":
|
|
624
|
+
profile_data.update({"name": name, "bio": bio, "bio_raw": bio, "post_count": _metric_input(posts), "subscriber_count": _metric_input(followers), "following_count": _metric_input(following)})
|
|
629
625
|
profile_data["country"] = _normalise_country(country)
|
|
630
626
|
_save_public_profile(profile_data, country=profile_data["country"], language=language, character_id=selected_character)
|
|
631
627
|
st.success("Conta Instagram cadastrada em Redes Sociais.")
|
|
@@ -78,8 +78,8 @@ class IntegrationResult:
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
def normalize_instagram_bio(value: Any) -> str:
|
|
81
|
-
"""
|
|
82
|
-
return str(value or '')
|
|
81
|
+
"""Deprecated compatibility helper; Bio values are now passed through unchanged."""
|
|
82
|
+
return str(value or '')
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
def normalize_instagram_reference(source: str) -> dict[str, str]:
|
|
@@ -404,7 +404,7 @@ def _profile_data_from_api(user: Mapping[str, Any], reference: Mapping[str, str]
|
|
|
404
404
|
'id': f"instagram_{reference['username']}",
|
|
405
405
|
**reference,
|
|
406
406
|
'name': str(user.get('full_name') or user.get('username') or reference['username']).strip(),
|
|
407
|
-
'bio':
|
|
407
|
+
'bio': biography,
|
|
408
408
|
'bio_raw': biography,
|
|
409
409
|
'country': country,
|
|
410
410
|
'avatar_url': str(user.get('profile_pic_url_hd') or user.get('profile_pic_url') or '').strip(),
|
|
@@ -514,7 +514,7 @@ def fetch_public_instagram_profile(source: str) -> IntegrationResult:
|
|
|
514
514
|
embedded_country = extract_public_instagram_country(document)
|
|
515
515
|
if embedded_country:
|
|
516
516
|
break
|
|
517
|
-
data = {'id': f"instagram_{reference['username']}", **reference, 'name': title.split('(')[0].strip() or reference['username'], 'bio':
|
|
517
|
+
data = {'id': f"instagram_{reference['username']}", **reference, 'name': title.split('(')[0].strip() or reference['username'], 'bio': description, 'bio_raw': description, 'country': embedded_country, 'avatar_url': avatar_url, 'subscriber_count': followers, 'following_count': following, 'post_count': posts, 'public_lookup': True, 'metrics_source': 'instagram_public_page', 'last_public_lookup_at': datetime.now(timezone.utc).isoformat()}
|
|
518
518
|
return IntegrationResult(True, 'Perfil Instagram encontrado publicamente.', data)
|
|
519
519
|
|
|
520
520
|
|
package/package.json
CHANGED