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')
42 from robots import robot
45 for url in sys.argv[1:]:
46 bookmark = Bookmark(href=url, add_date=None)
47 bookmark.parent = None
49 rcode = robot.check_url(bookmark)
50 print("check_url: %s" % rcode)
52 if hasattr(bookmark, 'error'):
67 getattr(bookmark, 'real_title', None)
68 or getattr(bookmark, 'title', None),
70 strftime(bookmark.last_modified),
71 getattr(bookmark, 'moved', None),
72 getattr(bookmark, 'size', None),
73 getattr(bookmark, 'md5', None),
74 bookmark.icon_href, bookmark.icon, bookmark.charset,
82 if __name__ == '__main__':