-#! /usr/bin/env python
+#! /usr/bin/env python3
"""Convert Netscape Navigator's or Mozilla's bookmarks.html to a database
This file is a part of Bookmarks database and Internet robot.
"""
from __future__ import print_function
-import sys, os
from getopt import getopt
+import os
+import sys
+
from bkmk_parser import BkmkParser
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 1997-2017 PhiloSoft Design"
+__copyright__ = "Copyright (C) 1997-2023 PhiloSoft Design"
__license__ = "GNU GPL"
filename = args[0]
else:
- filename = 'bookmarks.html' # good name both for DOS (bookmark.htm) and UNIX
-
+ # good name both for DOS (bookmark.htm) and UNIX
+ filename = 'bookmarks.html'
if report_stats:
from storage import storage_name
print(filename, ": no such file")
sys.exit(1)
-
if show_pbar:
pbar = ttyProgressBar(0, size)
lng = 0
# This is for DOS - it counts CRLF, which len() counts as 1 char!
- if os.name == 'dos' or os.name == 'nt' :
+ if os.name == 'dos' or os.name == 'nt':
dos_add = 1
else:
- dos_add = 0 # UNIX' and Mac's len() counts CR or LF correct
-
+ dos_add = 0 # UNIX' and Mac's len() counts CR or LF correct
- infile = open(filename, 'r')
+ infile = open(filename, 'rt')
parser = BkmkParser()
line_no = 0
lng = lng + len(line) + dos_add
pbar.display(lng)
- #line = line.strip()
+ # line = line.strip()
line_no = line_no + 1
try: