Print Web History on .csv and search youtube.com
This commit is contained in:
parent
f9863f8db8
commit
7c33c5eb27
|
@ -2,3 +2,6 @@ executable.py
|
||||||
executable.sh
|
executable.sh
|
||||||
siti.dat
|
siti.dat
|
||||||
history.txt
|
history.txt
|
||||||
|
history.csv
|
||||||
|
test.py
|
||||||
|
.~lock.history.csv#
|
37
main.py
37
main.py
|
@ -3,17 +3,31 @@ import tkinter as tk
|
||||||
#Libraries for execute command
|
#Libraries for execute command
|
||||||
import subprocess
|
import subprocess
|
||||||
#Libraries for read web browser history
|
#Libraries for read web browser history
|
||||||
from browser_history.browsers import Firefox
|
from browser_history import get_history
|
||||||
|
#Libraries for date time
|
||||||
|
from datetime import datetime
|
||||||
|
#Libraries for read csv
|
||||||
|
import csv
|
||||||
|
|
||||||
#Print all browser history on txt
|
#Print all browser history on cvs
|
||||||
with open('history.txt', 'w') as f:
|
outputs = get_history()
|
||||||
fi = Firefox()
|
outputs.save("history.csv")
|
||||||
outputs = fi.fetch_history()
|
|
||||||
his = outputs.histories
|
|
||||||
for line in his:
|
|
||||||
f.write(str(line))
|
|
||||||
f.write('\n')
|
|
||||||
|
|
||||||
|
#Get current date
|
||||||
|
now = datetime.now()
|
||||||
|
date_time_str = now.strftime("%Y-%m-%d %H:%M")
|
||||||
|
print('DateTime String:', date_time_str)
|
||||||
|
|
||||||
|
#Search Youtube Link on history.csv
|
||||||
|
how_to_search = 'https://www.youtube.com/'
|
||||||
|
rows = []
|
||||||
|
with open('history.csv', 'rt') as f:
|
||||||
|
reader = csv.reader(f, delimiter=',')
|
||||||
|
for line in reader:
|
||||||
|
if how_to_search in line:
|
||||||
|
print("Yes!")
|
||||||
|
|
||||||
|
#Create a window
|
||||||
window = tk.Tk()
|
window = tk.Tk()
|
||||||
#Resolution program
|
#Resolution program
|
||||||
window.geometry("800x500")
|
window.geometry("800x500")
|
||||||
|
@ -23,6 +37,7 @@ window.title("Poweroffer")
|
||||||
window.configure(background="blue")
|
window.configure(background="blue")
|
||||||
window.grid_columnconfigure(0, weight=1)
|
window.grid_columnconfigure(0, weight=1)
|
||||||
|
|
||||||
|
#Welcome text
|
||||||
scritta = tk.Label(window, text="Welcome!", font=("Helvetica",15))
|
scritta = tk.Label(window, text="Welcome!", font=("Helvetica",15))
|
||||||
scritta.grid(row=0, column=0, sticky="N", padx=20, pady=10)
|
scritta.grid(row=0, column=0, sticky="N", padx=20, pady=10)
|
||||||
|
|
||||||
|
@ -31,11 +46,11 @@ text_input= tk.Entry(textvariable=sito)
|
||||||
text_input.grid(row=3, column=0, sticky="WE", padx=10, pady=10)
|
text_input.grid(row=3, column=0, sticky="WE", padx=10, pady=10)
|
||||||
|
|
||||||
#Button stop procrastinating
|
#Button stop procrastinating
|
||||||
second_button= tk.Button(text="Stop procrastinating", command=smetti)
|
second_button= tk.Button(text="Stop procrastinating")
|
||||||
second_button.grid(row=5, column=0, sticky="WE", padx=15, pady=8)
|
second_button.grid(row=5, column=0, sticky="WE", padx=15, pady=8)
|
||||||
|
|
||||||
#Button for shutdown pc
|
#Button for shutdown pc
|
||||||
first_button = tk.Button(text="have a break from the pc", command=spegni)
|
first_button = tk.Button(text="have a break from the pc")
|
||||||
first_button.grid(row=1, column=0, sticky="W", padx=50, pady=50)
|
first_button.grid(row=1, column=0, sticky="W", padx=50, pady=50)
|
||||||
|
|
||||||
#Always open window
|
#Always open window
|
||||||
|
|
Loading…
Reference in New Issue