# Buggy code
def parseBookmark(page, root_directory, db_path, locale="en", is_json=False):
    """Parse favorite artist page"""
    from PixivDBManager import PixivDBManager

    bookmarks = list()
    result2 = list()
    db = PixivDBManager(root_directory=root_directory, target=db_path)

    if is_json:
        parsed = json.loads(page)
        for member in parsed["body"]["users"]:
            result2.append(member["userId"])
    else:
        # old method
        parse_page = BeautifulSoup(page, features="html5lib")
        __re_member = re.compile(locale + r"/users/(\d*)")

        member_list = parse_page.find(attrs={"class": "members"})
        result = member_list.findAll("a")

        # filter duplicated member_id
        d = collections.OrderedDict()
        for r in result:
            member_id = __re_member.findall(r["href"])
            if len(member_id) > 0:
                d[member_id[0]] = member_id[0]
        result2 = list(d.keys())

        parse_page.decompose()
        del parse_page

    for r in result2:
        item = db.selectMemberByMemberId2(r)
        bookmarks.append(item)

    return bookmarks


# Traceback (ZeroDivisionError)
Input: 5
Include Private bookmarks [y/n/o]:
Start Page (default=1):
End Page (default=0, 0 for no limit):
Importing Bookmarks...
Exporting page 1
Source URL: https://www.pixiv.net/bookmark.php?type=user&amp;p=1
Using default DB Path: /mnt/c/PixivUtil2/db.sqlite
No more data
Result:  0 items.
Error at process_bookmark(): (<class 'ZeroDivisionError'>, ZeroDivisionError('float division by zero'), <traceback object at 0x7fa7885a55a0>)
Traceback (most recent call last):
File "PixivUtil2.py", line 2407, in main
np_is_valid, op_is_valid, selection = main_loop(ewd, op_is_valid, selection, np_is_valid, args)
File "PixivUtil2.py", line 2127, in main_loop
menu_download_from_online_user_bookmark(op_is_valid, args)
File "PixivUtil2.py", line 1722, in menu_download_from_online_user_bookmark
process_bookmark(hide, start_page, end_page)
File "PixivUtil2.py", line 1235, in process_bookmark
print("%d/%d\t%f %%" % (i, len(total_list), 100.0 * i / float(len(total_list))))
ZeroDivisionError: float division by zero
press enter to exit.

# Fixed code
def parseBookmark(page, root_directory, db_path, locale="en", is_json=False):
    """Parse favorite artist page"""
    from PixivDBManager import PixivDBManager

    bookmarks = list()
    result2 = list()
    db = PixivDBManager(root_directory=root_directory, target=db_path)

    if is_json:
        parsed = json.loads(page)
        for member in parsed["body"]["users"]:
            if "isAdContainer" in member and member["isAdContainer"]:
                continue
            result2.append(member["userId"])
    else:
        # old method
        parse_page = BeautifulSoup(page, features="html5lib")
        __re_member = re.compile(locale + r"/users/(\d*)")

        member_list = parse_page.find(attrs={"class": "members"})
        result = member_list.findAll("a")

        # filter duplicated member_id
        d = collections.OrderedDict()
        for r in result:
            member_id = __re_member.findall(r["href"])
            if len(member_id) > 0:
                d[member_id[0]] = member_id[0]
        result2 = list(d.keys())

        parse_page.decompose()
        del parse_page

    for r in result2:
        item = db.selectMemberByMemberId2(r)
        bookmarks.append(item)

    return bookmarks