@danhachuel/thunderbolt 0.4.65 → 0.4.67
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 +12 -10
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -2087,20 +2087,18 @@ def render_tiktok_channels():
|
|
|
2087
2087
|
st.success("Canal TikTok cadastrado.")
|
|
2088
2088
|
st.rerun()
|
|
2089
2089
|
def is_youtube_channel_record(channel: Any) -> bool:
|
|
2090
|
-
"""Return whether a persisted channel
|
|
2090
|
+
"""Return whether a persisted channel is positively identified as YouTube."""
|
|
2091
2091
|
if not isinstance(channel, dict):
|
|
2092
2092
|
return False
|
|
2093
2093
|
platform = str(channel.get("platform") or "").strip().casefold().replace(" ", "")
|
|
2094
|
-
if platform
|
|
2094
|
+
if platform == "youtube":
|
|
2095
|
+
return True
|
|
2096
|
+
if platform:
|
|
2095
2097
|
return False
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
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
|
|
2098
|
+
youtube_id = str(channel.get("youtube_id") or channel.get("youtube_channel_id") or "").strip()
|
|
2099
|
+
youtube_url = str(channel.get("url") or channel.get("profile_url") or channel.get("source_url") or "").strip().casefold()
|
|
2100
|
+
source = str(channel.get("metrics_source") or channel.get("import_source") or "").strip().casefold()
|
|
2101
|
+
return bool(youtube_id or "youtube.com" in youtube_url or source.startswith("youtube"))
|
|
2104
2102
|
|
|
2105
2103
|
|
|
2106
2104
|
def render_channels():
|
|
@@ -2214,6 +2212,7 @@ def render_channels():
|
|
|
2214
2212
|
"video_count": int(video_count) or None,
|
|
2215
2213
|
"view_count": int(view_count) or None,
|
|
2216
2214
|
"metrics_source": imported.get("metrics_source", "youtube_public_page"),
|
|
2215
|
+
"platform": "youtube",
|
|
2217
2216
|
}
|
|
2218
2217
|
channel = create_channel(name, url, metadata)
|
|
2219
2218
|
st.success(f"Canal {channel['name']} guardado.")
|
|
@@ -2347,6 +2346,7 @@ def render_channels():
|
|
|
2347
2346
|
"metrics_source": "spreadsheet",
|
|
2348
2347
|
"import_source": "spreadsheet",
|
|
2349
2348
|
"description_source": description_status,
|
|
2349
|
+
"platform": "youtube",
|
|
2350
2350
|
}
|
|
2351
2351
|
created = create_channel(str(row.get("name") or "").strip(), str(row.get("url") or "").strip(), metadata)
|
|
2352
2352
|
current_channels.append(created)
|
|
@@ -2494,6 +2494,7 @@ def render_channels():
|
|
|
2494
2494
|
"language": batch_language,
|
|
2495
2495
|
"style_wide": style_value,
|
|
2496
2496
|
"last_youtube_sync": now(),
|
|
2497
|
+
"platform": "youtube",
|
|
2497
2498
|
})
|
|
2498
2499
|
created_names.append(data.get("name", channel_id))
|
|
2499
2500
|
except Exception as exc:
|
|
@@ -2557,6 +2558,7 @@ def render_channels():
|
|
|
2557
2558
|
"video_count": int(video_count) or None,
|
|
2558
2559
|
"view_count": int(view_count) or None,
|
|
2559
2560
|
"metrics_source": "manual",
|
|
2561
|
+
"platform": "youtube",
|
|
2560
2562
|
})
|
|
2561
2563
|
st.success(f"Canal {channel['name']} guardado manualmente.")
|
|
2562
2564
|
st.rerun()
|
package/package.json
CHANGED