1 #! /usr/bin/env python3
2 """Robot interface - check URLs from the command line
4 This file is a part of Bookmarks database and Internet robot.
7 __author__ = "Oleg Broytman <phd@phdru.name>"
8 __copyright__ = "Copyright (C) 2010-2023 PhiloSoft Design"
9 __license__ = "GNU GPL"
13 from bkmk_objects import Bookmark
14 from Writers.bkmk_wflad import strftime
24 def _setup(self, conn):
25 HTTP._setup(self, conn)
26 self.set_debuglevel(1)
32 print("Broytman check_url, Copyright (C) 2010-2023 PhiloSoft Design")
35 sys.stderr.write("Usage: check_url.py url1 [url2...]\n")
38 from m_lib.flog import makelog
39 log = makelog("check.log")
40 log.outfile.reconfigure(encoding='utf-8')
41 sys.stdout.reconfigure(encoding='utf-8')
43 from robots import robot
46 for url in sys.argv[1:]:
47 bookmark = Bookmark(href=url, add_date=None)
48 bookmark.parent = None
50 rcode = robot.check_url(bookmark)
51 print("check_url: %s" % rcode)
53 if hasattr(bookmark, 'error'):
68 getattr(bookmark, 'real_title', None)
69 or getattr(bookmark, 'title', None),
71 strftime(bookmark.last_modified),
72 getattr(bookmark, 'moved', None),
73 getattr(bookmark, 'size', None),
74 getattr(bookmark, 'md5', None),
75 bookmark.icon_href, bookmark.icon, bookmark.charset,
83 if __name__ == '__main__':