~cadence/tube-devel

NewLeaf: #42 Return an error instead of a stacktrace for terminated channels v1 PROPOSED

~lomanic: 2
 #42 Return an error instead of a stacktrace for terminated channels
 #42 Return UNKNOWN error for not explicitly handled errors for channel extraction instead of stacktrace

 2 files changed, 10 insertions(+), 3 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~cadence/tube-devel/patches/26454/mbox | git am -3
Learn more about email & git

[PATCH NewLeaf 1/2] #42 Return an error instead of a stacktrace for terminated channels Export this patch

From: Lomanic <lomanic@hotmail.fr>

Examples:
* https://www.youtube.com/channel/UCSp7G_MalQc1NSTwv0hTQ2Q
* https://www.youtube.com/channel/UCcyEqpMZ6k1zQ9Sy3QQEJUA

Complete error message is: "This account has been terminated due to
multiple or severe violations of YouTube's policy against spam,
deceptive practices, and misleading content or other Terms of Service
violations."
---
 extractors/channel.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/extractors/channel.py b/extractors/channel.py
index 454a4e5..83a139a 100644
--- a/extractors/channel.py
+++ b/extractors/channel.py
@@ -29,8 +29,12 @@ def extract_channel(ucid):
					"error": alert_text,
					"identifier": "NOT_FOUND"
				}
			else:
				print("Seen alert text '{}'".format(alert_text))
            if "terminated" in alert_text:
				return {
					"error": alert_text,
					"identifier": "TERMINATED"
				}
			print("Seen alert text '{}'".format(alert_text))

		header = yt_initial_data["header"]["c4TabbedHeaderRenderer"] if "c4TabbedHeaderRenderer" in yt_initial_data["header"] else {}
		channel_metadata = yt_initial_data["metadata"]["channelMetadataRenderer"]
-- 
2.32.0

[PATCH NewLeaf 2/2] #42 Return UNKNOWN error for not explicitly handled errors for channel extraction instead of stacktrace Export this patch

From: Lomanic <lomanic@hotmail.fr>

---
 extractors/channel.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/extractors/channel.py b/extractors/channel.py
index 83a139a..6c42e7d 100644
--- a/extractors/channel.py
+++ b/extractors/channel.py
@@ -34,7 +34,10 @@ def extract_channel(ucid):
					"error": alert_text,
					"identifier": "TERMINATED"
				}
			print("Seen alert text '{}'".format(alert_text))
			return {
				"error": alert_text,
				"identifier": "UNKNOWN"
			}

		header = yt_initial_data["header"]["c4TabbedHeaderRenderer"] if "c4TabbedHeaderRenderer" in yt_initial_data["header"] else {}
		channel_metadata = yt_initial_data["metadata"]["channelMetadataRenderer"]
-- 
2.32.0