Skip to content

Commit

Permalink
Updated the bookmarks script
Browse files Browse the repository at this point in the history
  • Loading branch information
Amele9 committed Jan 23, 2025
1 parent 6654f00 commit a40be49
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Google Chrome/bookmarks.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ import (
)

const (
HistoryPath = ""

BookmarksPath = "Bookmarks"

HistoryRecordCount = 30_000

TargetURL = ""
TargetURLs = ""

InitialID = 300_000

Expand Down Expand Up @@ -67,7 +71,7 @@ type MetaInfo struct {
}

func main() {
historyRecords, err := GetHistoryRecords("")
historyRecords, err := GetHistoryRecords(HistoryPath)
if err != nil {
fmt.Println(err)

Expand All @@ -88,7 +92,7 @@ func main() {
return
}

bookmarks, err := GetBookmarks("Bookmarks")
bookmarks, err := GetBookmarks(BookmarksPath)
if err != nil {
fmt.Println(err)

Expand All @@ -102,7 +106,7 @@ func main() {
return
}

err = SaveBookmarks("Bookmarks-01", bookmarks)
err = SaveBookmarks(BookmarksPath, bookmarks)
if err != nil {
fmt.Println(err)

Expand Down Expand Up @@ -131,9 +135,15 @@ func GetHistoryRecords(filePath string) ([]HistoryRecord, error) {
func ParseHistoryRecords(historyRecords []HistoryRecord) ([]HistoryRecord, error) {
handledHistoryRecords := make([]HistoryRecord, 0, len(historyRecords))

URLs := strings.Split(TargetURLs, ",")

for _, historyRecord := range historyRecords {
if strings.Contains(historyRecord.URL, TargetURL) {
handledHistoryRecords = append(handledHistoryRecords, historyRecord)
for _, URL := range URLs {
if strings.Contains(historyRecord.URL, URL) {
handledHistoryRecords = append(handledHistoryRecords, historyRecord)

break
}
}
}

Expand Down

0 comments on commit a40be49

Please sign in to comment.