1 #! /usr/bin/env python3
2 """Check and show URLs in the bookmarks database that have redirects
4 This file is a part of Bookmarks database and Internet robot.
7 from __future__ import print_function
9 from bkmk_objects import make_linear
12 __author__ = "Oleg Broytman <phd@phdru.name>"
13 __copyright__ = "Copyright (C) 2023 PhiloSoft Design"
14 __license__ = "GNU GPL"
18 from getopt import getopt
19 optlist, args = getopt(sys.argv[1:], "s")
23 for _opt, _arg in optlist:
32 print("Broytman check_redirects, Copyright (C) 2023 PhiloSoft Design")
35 sys.stderr.write("check_redirects: too many arguments\n")
36 sys.stderr.write("Usage: check_redirects [-s]\n")
39 from storage import storage
43 sys.stdout.write("Loading %s: " % storage.filename)
46 root_folder = storage.load()
47 make_linear(root_folder)
48 objects = len(root_folder.linear)
53 for object_no in range(objects):
54 object = root_folder.linear[object_no]
57 if hasattr(object, "error") or \
58 object.href.startswith('place:'): # Firefox SmartBookmarks
61 if hasattr(object, "moved"):
68 print(objects, "objects passed")
71 if __name__ == '__main__':