@danhachuel/thunderbolt 0.4.64 → 0.4.66
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 +20 -4
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -2086,6 +2086,25 @@ 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 "tiktok" in platform or platform in {"tik-tok", "tt"}:
|
|
2095
|
+
return False
|
|
2096
|
+
def contains_tiktok_marker(value: Any) -> bool:
|
|
2097
|
+
if isinstance(value, dict):
|
|
2098
|
+
return any(contains_tiktok_marker(key) or contains_tiktok_marker(item) for key, item in value.items())
|
|
2099
|
+
if isinstance(value, (list, tuple, set)):
|
|
2100
|
+
return any(contains_tiktok_marker(item) for item in value)
|
|
2101
|
+
return "tiktok" in str(value or "").strip().casefold().replace(" ", "") or str(value or "").strip().casefold() == "tik-tok"
|
|
2102
|
+
|
|
2103
|
+
if contains_tiktok_marker(channel):
|
|
2104
|
+
return False
|
|
2105
|
+
return True
|
|
2106
|
+
|
|
2107
|
+
|
|
2089
2108
|
def render_channels():
|
|
2090
2109
|
st.title("Canais Youtube")
|
|
2091
2110
|
st.caption("Escolha entre importar dados públicos do YouTube ou preencher o canal manualmente.")
|
|
@@ -2342,10 +2361,7 @@ def render_channels():
|
|
|
2342
2361
|
|
|
2343
2362
|
st.divider()
|
|
2344
2363
|
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
|
-
]
|
|
2364
|
+
registered_channels = [channel for channel in read_json("channels.json", []) if is_youtube_channel_record(channel)]
|
|
2349
2365
|
if not registered_channels:
|
|
2350
2366
|
st.info("Nenhum canal cadastrado.")
|
|
2351
2367
|
else:
|
package/package.json
CHANGED