examples/ytfeed.browse-feeds: don't panic

This commit is contained in:
dtb
2026-02-01 10:05:36 -07:00
parent b87adb2748
commit f1d2359391

View File

@@ -9,8 +9,11 @@ directory = sys.argv[1]
for f in os.listdir(directory): for f in os.listdir(directory):
file_name = os.path.join(directory, f) file_name = os.path.join(directory, f)
if os.path.isfile(file_name) and f[-4:] == ".xml": if os.path.isfile(file_name) and f[-4:] == ".xml":
tree = ET.parse(file_name) try: tree = ET.parse(file_name)
root = tree.getroot() except ET.ParseError as e:
print("%s: %s: %s" % (sys.argv[0], file_name, e), file = sys.stderr)
continue
else: root = tree.getroot()
try: try:
channels += [ channels += [
"%s\n\n" % root.find('{http://www.w3.org/2005/Atom}title').text "%s\n\n" % root.find('{http://www.w3.org/2005/Atom}title').text