@danhachuel/thunderbolt 0.4.64 → 0.4.65
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/app/main.py +18 -4
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -2086,6 +2086,23 @@ def render_tiktok_channels():
|
|
|
2086
2086
|
update_channel(channel["id"], {"platform": "tiktok"})
|
|
2087
2087
|
st.success("Canal TikTok cadastrado.")
|
|
2088
2088
|
st.rerun()
|
|
2089
|
+
def is_youtube_channel_record(channel: Any) -> bool:
|
|
2090
|
+
"""Return whether a persisted channel belongs in the YouTube UI."""
|
|
2091
|
+
if not isinstance(channel, dict):
|
|
2092
|
+
return False
|
|
2093
|
+
platform = str(channel.get("platform") or "").strip().casefold().replace(" ", "")
|
|
2094
|
+
if platform in {"tiktok", "tik-tok"}:
|
|
2095
|
+
return False
|
|
2096
|
+
for field in ("url", "profile_url", "source_url", "import_source", "metrics_source", "provider", "network"):
|
|
2097
|
+
value = str(channel.get(field) or "").strip().casefold()
|
|
2098
|
+
if "tiktok.com" in value or value.startswith("tiktok") or value == "tik-tok":
|
|
2099
|
+
return False
|
|
2100
|
+
for field in ("tiktok_id", "tiktok_username", "tiktok_handle", "tiktok_user_id", "tiktok_open_id"):
|
|
2101
|
+
if str(channel.get(field) or "").strip():
|
|
2102
|
+
return False
|
|
2103
|
+
return True
|
|
2104
|
+
|
|
2105
|
+
|
|
2089
2106
|
def render_channels():
|
|
2090
2107
|
st.title("Canais Youtube")
|
|
2091
2108
|
st.caption("Escolha entre importar dados públicos do YouTube ou preencher o canal manualmente.")
|
|
@@ -2342,10 +2359,7 @@ def render_channels():
|
|
|
2342
2359
|
|
|
2343
2360
|
st.divider()
|
|
2344
2361
|
st.subheader("Canais cadastrados")
|
|
2345
|
-
registered_channels = [
|
|
2346
|
-
channel for channel in read_json("channels.json", [])
|
|
2347
|
-
if isinstance(channel, dict) and str(channel.get("platform") or "youtube").strip().lower() != "tiktok"
|
|
2348
|
-
]
|
|
2362
|
+
registered_channels = [channel for channel in read_json("channels.json", []) if is_youtube_channel_record(channel)]
|
|
2349
2363
|
if not registered_channels:
|
|
2350
2364
|
st.info("Nenhum canal cadastrado.")
|
|
2351
2365
|
else:
|
package/package.json
CHANGED