@danhachuel/thunderbolt 0.4.66 → 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 -12
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -2087,22 +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
|
|
2094
|
+
if platform == "youtube":
|
|
2095
|
+
return True
|
|
2096
|
+
if platform:
|
|
2095
2097
|
return False
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
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
|
|
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"))
|
|
2106
2102
|
|
|
2107
2103
|
|
|
2108
2104
|
def render_channels():
|
|
@@ -2216,6 +2212,7 @@ def render_channels():
|
|
|
2216
2212
|
"video_count": int(video_count) or None,
|
|
2217
2213
|
"view_count": int(view_count) or None,
|
|
2218
2214
|
"metrics_source": imported.get("metrics_source", "youtube_public_page"),
|
|
2215
|
+
"platform": "youtube",
|
|
2219
2216
|
}
|
|
2220
2217
|
channel = create_channel(name, url, metadata)
|
|
2221
2218
|
st.success(f"Canal {channel['name']} guardado.")
|
|
@@ -2349,6 +2346,7 @@ def render_channels():
|
|
|
2349
2346
|
"metrics_source": "spreadsheet",
|
|
2350
2347
|
"import_source": "spreadsheet",
|
|
2351
2348
|
"description_source": description_status,
|
|
2349
|
+
"platform": "youtube",
|
|
2352
2350
|
}
|
|
2353
2351
|
created = create_channel(str(row.get("name") or "").strip(), str(row.get("url") or "").strip(), metadata)
|
|
2354
2352
|
current_channels.append(created)
|
|
@@ -2496,6 +2494,7 @@ def render_channels():
|
|
|
2496
2494
|
"language": batch_language,
|
|
2497
2495
|
"style_wide": style_value,
|
|
2498
2496
|
"last_youtube_sync": now(),
|
|
2497
|
+
"platform": "youtube",
|
|
2499
2498
|
})
|
|
2500
2499
|
created_names.append(data.get("name", channel_id))
|
|
2501
2500
|
except Exception as exc:
|
|
@@ -2559,6 +2558,7 @@ def render_channels():
|
|
|
2559
2558
|
"video_count": int(video_count) or None,
|
|
2560
2559
|
"view_count": int(view_count) or None,
|
|
2561
2560
|
"metrics_source": "manual",
|
|
2561
|
+
"platform": "youtube",
|
|
2562
2562
|
})
|
|
2563
2563
|
st.success(f"Canal {channel['name']} guardado manualmente.")
|
|
2564
2564
|
st.rerun()
|
package/package.json
CHANGED