How to filter and delete Google Chrome history items with Python

The following snippet can be used for filtering out URLs that where keywords match title or url. They are then deleted from history saving you lots of time that you’d otherwise spend manually filtering and deleting. Google Chrome must be closed before running this script. import sqlite3, webbrowser def cleanChrome(): con = sqlite3.connect('C:\\Users\\{username}\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\History') cursor = con.cursor() cursor.execute("select id, url, title from urls") urls = cursor.fetchall() # keywords that you'd like to detect and delete # it looks for these keywords in page title and urls keywords = [] total = len(urls) done = 0 deleted = 0 pendingIds = [] for url in urls: jenny.output(f'Processing {done} / {total} urls [deleted: {deleted}]') uid = url[0] link = url[1].lower() title = url[2].lower() for keyword in keywords: if keyword in link or keyword in title: jenny.output(f'{keyword} matched, deleting..') pendingIds.append((uid,)) deleted += 1 done += 1 query = 'DELETE FROM urls WHERE id=?' cursor.executemany(query, pendingIds) con.commit()

June 11, 2021 · 1 min · 153 words · Saqib Razzaq

How to open a URL in chrome using Python

import webbrowser webbrowser.register('chrome', None, webbrowser.BackgroundBrowser("C://Program Files (x86)//Google//Chrome//Application//chrome.exe")) webbrowser.get('chrome').open('http://url.com')

April 11, 2021 · 1 min · 8 words · Saqib Razzaq

Markdown Syntax Guide

This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme. ...

March 11, 2019 · 3 min · 446 words · Hugo Authors

How to view Google Chrome extension source code

Go to chrome://extensions/ Find extension and copy ID Go to %localappdata% C:\\Users\\{username}\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Extensions Find extension folder Bingo!

February 19, 2018 · 1 min · 17 words · Saqib Razzaq