Code Monkey home page Code Monkey logo

buku's Introduction

buku

Latest release Availability PyPI Build Status Docs Status Privacy Awareness License

buku in action!

buku in action!

Introduction

buku is a powerful bookmark manager and a personal textual mini-web.

For those who prefer the GUI, bukuserver exposes a browsable front-end on a local web host server.

When I started writing it, I couldn't find a flexible command-line solution with a private, portable, merge-able database along with seamless GUI integration. Hence, buku.

buku can import bookmarks from browser(s) or fetch the title, tags and description of a URL from the web. Use your favourite editor to add, compose and update bookmarks. Search bookmarks instantly with multiple search options, including regex and a deep scan mode (handy with URLs).

It can look up broken links on the Wayback Machine. There's an Easter Egg to revisit random bookmarks.

There's no tracking, hidden history, obsolete records, usage analytics or homing.

To get started right away, jump to the Quickstart section. buku has one of the best documentation around. The man page comes with examples. For internal details, please refer to the operational notes.

buku is a library too! There are several related projects, including a browser plug-in.

Table of Contents

Features

  • Store bookmarks with auto-fetched title, tags and description
  • Auto-import from Firefox, Google Chrome, Chromium and MS Edge
  • Open bookmarks and search results in browser
  • Shorten, expand URLs
  • Browse cached page from the Wayback Machine
  • Text editor integration
  • Lightweight, clean interface, custom colors
  • Powerful search options (regex, substring...)
  • Continuous search with on the fly mode switch
  • Portable, merge-able database to sync between systems
  • Import/export bookmarks from/to HTML, XBEL, Markdown or Orgfile
  • Smart tag management using redirection (>>, >, <<)
  • Multi-threaded full DB refresh
  • Manual encryption support
  • Shell completion scripts, man page with examples
  • Privacy-aware (no unconfirmed user data collection)

Installation

Dependencies

Feature Dependency
Lang, SQLite Python 3.8+
HTTPS certifi, urllib3
Encryption cryptography
HTML beautifulsoup4, html5lib

To copy URL to clipboard buku uses xsel (or xclip) on Linux, pbcopy (default installed) on OS X, clip (default installed) on Windows, termux-clipboard on Termux (terminal emulation for Android), wl-copy on Wayland. If X11 is missing, GNU Screen or tmux copy-paste buffers are recognized.

From a package manager

To install buku with all its dependencies from PyPI, run:

# pip3 install buku

You can also install buku from your package manager. If the version available is dated try an alternative installation method.

Packaging status (expand)


Packaging status

Unlisted packagers:


PyPI (pip3 install buku)
● Termux (pip3 install buku)

Release packages

Auto-generated packages (with only the cli component) for Arch Linux, CentOS, Debian, Fedora, openSUSE Leap and Ubuntu are available with the latest stable release.

NOTE: CentOS may not have the python3-beautifulsoup4 package in the repos. Install it using pip3.

From source

If you have git installed, clone this repository. Otherwise download the latest stable release or development version (risky).

Install the dependencies. For example, on Ubuntu:

$ apt-get install ca-certificates python3-urllib3 python3-cryptography python3-bs4

Install the cli component to default location (/usr/local):

$ sudo make install

To remove, run:

$ sudo make uninstall

PREFIX is supported, in case you want to install to a different location.

Running standalone

buku is a standalone utility. From the containing directory, run:

$ chmod +x buku
$ ./buku

Shell completion

Shell completion scripts for Bash, Fish and Zsh can be found in respective subdirectories of auto-completion/. Please refer to your shell's manual for installation instructions.

Usage

Command-line options

usage: buku [OPTIONS] [KEYWORD [KEYWORD ...]]

Bookmark manager like a text-based mini-web.

POSITIONAL ARGUMENTS:
      KEYWORD              search keywords

GENERAL OPTIONS:
      -a, --add URL [tag, ...]
                           bookmark URL with comma-separated tags
      -u, --update [...]   update fields of an existing bookmark
                           accepts indices and ranges
                           refresh title and desc if no edit options
                           if no arguments:
                           - update results when used with search
                           - otherwise refresh all titles and desc
      -w, --write [editor|index]
                           edit and add a new bookmark in editor
                           else, edit bookmark at index in EDITOR
                           edit last bookmark, if index=-1
                           if no args, edit new bookmark in EDITOR
      -d, --delete [...]   remove bookmarks from DB
                           accepts indices or a single range
                           if no arguments:
                           - delete results when used with search
                           - otherwise delete all bookmarks
      -h, --help           show this information and exit
      -v, --version        show the program version and exit

EDIT OPTIONS:
      --url keyword        bookmark link
      --tag [+|-] [...]    comma-separated tags
                           clear bookmark tagset, if no arguments
                           '+' appends to, '-' removes from tagset
      --title [...]        bookmark title; if no arguments:
                           -a: do not set title, -u: clear title
      -c, --comment [...]  notes or description of the bookmark
                           clears description, if no arguments
      --immutable N        disable web-fetch during auto-refresh
                           N=0: mutable (default), N=1: immutable

SEARCH OPTIONS:
      -s, --sany [...]     find records with ANY matching keyword
                           this is the default search option
      -S, --sall [...]     find records matching ALL the keywords
                           special keywords -
                           "blank": entries with empty title/tag
                           "immutable": entries with locked title
      --deep               match substrings ('pen' matches 'opens')
      -r, --sreg expr      run a regex search
      -t, --stag [tag [,|+] ...] [- tag, ...]
                           search bookmarks by tags
                           use ',' to find entries matching ANY tag
                           use '+' to find entries matching ALL tags
                           excludes entries with tags after ' - '
                           list all tags, if no search keywords
      -x, --exclude [...]  omit records matching specified keywords

ENCRYPTION OPTIONS:
      -l, --lock [N]       encrypt DB in N (default 8) # iterations
      -k, --unlock [N]     decrypt DB in N (default 8) # iterations

POWER TOYS:
      --ai                 auto-import bookmarks from web browsers
                           Firefox, Chrome, Chromium, Vivaldi, Edge
      -e, --export file    export bookmarks to Firefox format HTML
                           export XBEL, if file ends with '.xbel'
                           export Markdown, if file ends with '.md'
                           format: [title](url) <!-- TAGS -->
                           export Orgfile, if file ends with '.org'
                           format: *[[url][title]] :tags:
                           export buku DB, if file ends with '.db'
                           combines with search results, if opted
      -i, --import file    import bookmarks from file
                           supports .html .xbel .json .md .org .db
      -p, --print [...]    show record details by indices, ranges
                           print all bookmarks, if no arguments
                           -n shows the last n results (like tail)
      -f, --format N       limit fields in -p or JSON search output
                           N=1: URL; N=2: URL, tag; N=3: title;
                           N=4: URL, title, tag; N=5: title, tag;
                           N0 (10, 20, 30, 40, 50) omits DB index
      -j, --json [file]    JSON formatted output for -p and search.
                           prints to stdout if argument missing.
                           otherwise writes to given file
      --colors COLORS      set output colors in five-letter string
      --nc                 disable color output
      -n, --count N        show N results per page (default 10)
      --np                 do not show the subprompt, run and exit
      -o, --open [...]     browse bookmarks by indices and ranges
                           open a random bookmark, if no arguments
      --oa                 browse all search results immediately
      --replace old new    replace old tag with new tag everywhere
                           delete old tag, if new tag not specified
      --url-redirect       when fetching an URL, use the resulting
                           URL from following *permanent* redirects
                           (when combined with --export, the old URL
                           is included as additional metadata)
      --tag-redirect [tag] when fetching an URL that causes permanent
                           redirect, add a tag in specified pattern
                           (using 'http:{}' if not specified)
      --tag-error [tag]    when fetching an URL that causes an HTTP
                           error, add a tag in specified pattern
                           (using 'http:{}' if not specified)
      --del-error [...]    when fetching an URL causes any (given)
                           HTTP error, delete/do not add it
      --export-on [...]    export records affected by the above
                           options, including removed info
                           (requires --update and --export; specific
                           HTTP response filter can be provided)
      --shorten index|URL  fetch shortened url from tny.im service
      --expand index|URL   expand a tny.im shortened url
      --cached index|URL   browse a cached page from Wayback Machine
      --offline            add a bookmark without connecting to web
      --suggest            show similar tags when adding bookmarks
      --tacit              reduce verbosity, skip some confirmations
      --nostdin            do not wait for input (must be first arg)
      --threads N          max network connections in full refresh
                           default N=4, min N=1, max N=10
      -V                   check latest upstream version available
      -g, --debug          show debug information and verbose logs

SYMBOLS:
      >                    url
      +                    comment
      #                    tags

PROMPT KEYS:
    1-N                    browse search result indices and/or ranges
    O [id|range [...]]     open search results/indices in GUI browser
                           toggle try GUI browser if no arguments
    a                      open all results in browser
    s keyword [...]        search for records with ANY keyword
    S keyword [...]        search for records with ALL keywords
    d                      match substrings ('pen' matches 'opened')
    r expression           run a regex search
    t [tag, ...]           search by tags; show taglist, if no args
    g taglist id|range [...] [>>|>|<<] [record id|range ...]
                           append, set, remove (all or specific) tags
                           search by taglist id(s) if records are omitted
    n                      show next page of search results
    o id|range [...]       browse bookmarks by indices and/or ranges
    p id|range [...]       print bookmarks by indices and/or ranges
    w [editor|id]          edit and add or update a bookmark
    c id                   copy URL at search result index to clipboard
    ?                      show this help
    q, ^D, double Enter    exit buku

Colors

buku supports custom colors. Visit the wiki page on how to customize colors for more details.

Quickstart

  1. Export VISUAL or EDITOR to point to your favourite editor. Note that VISUAL takes precedence over EDITOR.

  2. Create a sweeter shortcut with some convenience.

    alias b='buku --suggest'
    
  3. Auto-import bookmarks from your browser(s). Please quit the relevant browsers beforehand to ensure the databases are not locked.

    b --ai
    
  4. Manually add a bookmark (for hands-on).

    b -w
    
  5. List your bookmarks with DB index.

    b -p
    
  6. For GUI and browser integration (or to sync bookmarks with your favourite bookmark management service) refer to the wiki page on System integration.

  7. Quick (bash/zsh) commands to fuzzy search with fzf and open the selection in Firefox:

    firefox $(buku -p -f 10 | fzf)
    firefox $(buku -p -f 40 | fzf | cut -f1)
    

    POSIX script to show a preview of the bookmark as well:

    #!/usr/bin/env sh
    
    url=$(buku -p -f4 | fzf -m --reverse --preview "buku -p {1}" --preview-window=wrap | cut -f2)
    
    if [ -n "$url" ]; then
        echo "$url" | xargs firefox
    fi

Examples

  1. Edit and add a bookmark from editor:

    $ buku -w
    $ buku -w 'gedit -w'
    $ buku -w 'macvim -f' -a https://ddg.gg search engine, privacy
    

    The first command picks editor from the environment variable EDITOR. The second command opens gedit in blocking mode. The third command opens macvim with option -f and the URL and tags populated in template.

  2. Add a simple bookmark:

    $ buku --nostdin -a https://github.com/
    2648. GitHub: Let’s build from here · GitHub
    > https://github.com/
    + GitHub is where over 94 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs
     and features, power your CI/CD and DevOps workflows, and secure code before you commit it.
    
    $ buku --nostdin -a https://github.com/
    [ERROR] URL [https://github.com/] already exists at index 2648
    

    >: URL, +: comment, #: tags

    Title, description and tags will be fetched from site. Buku only stores unique URLs and will raise error if the URL already present in the database:

  3. Add a bookmark with tags search engine and privacy, comment Search engine with perks, fetch page title from the web:

    $ buku -a https://ddg.gg search engine, privacy -c Search engine with perks
    336. DuckDuckGo
    > https://ddg.gg
    + Alternative search engine with perks
    # privacy,search engine
    

    where, >: URL, +: comment, #: tags

  4. Add a bookmark with tags search engine & privacy and immutable custom title DDG:

    $ buku -a https://ddg.gg search engine, privacy --title 'DDG' --immutable 1
    336. DDG (L)
    > https://ddg.gg
    # privacy,search engine
    

    Note that URL must precede tags.

  5. Add a bookmark without a title (works for update too):

    $ buku -a https://ddg.gg search engine, privacy --title
    
  6. Edit and update a bookmark from editor:

    $ buku -w 15012014
    

    This will open the existing bookmark's details in the editor for modifications. Environment variable EDITOR must be set.

  7. Update existing bookmark at index 15012014 with new URL, tags and comments, fetch title from the web:

    $ buku -u 15012014 --url http://ddg.gg/ --tag web search, utilities -c Private search engine
    
  8. Fetch and update only title for bookmark at 15012014:

    $ buku -u 15012014
    
  9. Update only comment for bookmark at 15012014:

    $ buku -u 15012014 -c this is a new comment
    

    Applies to --url, --title and --tag too.

  10. Export bookmarks tagged tag 1 or tag 2 to HTML, XBEL, Markdown, Orgfile or a new database:

    $ buku -e bookmarks.html --stag tag 1, tag 2 $ buku -e bookmarks.xbel --stag tag 1, tag 2 $ buku -e bookmarks.md --stag tag 1, tag 2 $ buku -e bookmarks.org --stag tag 1, tag 2 $ buku -e bookmarks.db --stag tag 1, tag 2 All bookmarks are exported if search is not opted.

  11. Import bookmarks from HTML, XBEL, Markdown or Orgfile:

    $ buku -i bookmarks.html
    $ buku -i bookmarks.xbel
    $ buku -i bookmarks.md
    $ buku -i bookmarks.org
    $ buku -i bookmarks.db
    
  12. Delete only comment for bookmark at 15012014:

    $ buku -u 15012014 -c
    

    Applies to --title and --tag too. URL cannot be deleted without deleting the bookmark.

  13. Update or refresh full DB with page titles from the web:

    $ buku -u
    $ buku -u --tacit (show only failures and exceptions)
    

    This operation can update the title or description fields of non-immutable bookmarks by parsing the fetched page. Fields are updated only if the fetched fields are non-empty. Tags remain untouched.

  14. Delete bookmark at index 15012014:

    $ buku -d 15012014
    Index 15012020 moved to 15012014
    

    The last index is moved to the deleted index to keep the DB compact. Add --tacit to delete without confirmation.

  15. Delete all bookmarks:

    $ buku -d
    
  16. Delete a range or list of bookmarks:

    $ buku -d 100-200
    $ buku -d 100 15 200
    
  17. Search bookmarks for ANY of the keywords kernel and debugging in URL, title or tags:

    $ buku kernel debugging
    $ buku -s kernel debugging
    
  18. Search bookmarks with ALL the keywords kernel and debugging in URL, title or tags:

    $ buku -S kernel debugging
    
  19. Search bookmarks tagged general kernel concepts:

    $ buku --stag general kernel concepts
    
  20. Search for bookmarks matching ANY of the tags kernel, debugging, general kernel concepts:

    $ buku --stag kernel, debugging, general kernel concepts
    
  21. Search for bookmarks matching ALL of the tags kernel, debugging, general kernel concepts:

    $ buku --stag kernel + debugging + general kernel concepts
    
  22. Search for bookmarks matching any of the keywords hello or world, excluding the keywords real and life, matching both the tags kernel and debugging, but excluding the tags general kernel concepts and books:

    $ buku hello world --exclude real life --stag 'kernel + debugging - general kernel concepts, books'
    
  23. List all unique tags alphabetically:

    $ buku --stag
    
  24. Run a search and update the results:

    $ buku -s kernel debugging -u --tag + linux kernel
    
  25. Run a search and delete the results:

    $ buku -s kernel debugging -d
    
  26. Encrypt or decrypt DB with custom number of iterations (15) to generate key:

    $ buku -l 15
    $ buku -k 15
    

    The same number of iterations must be specified for one lock & unlock instance. Default is 8, if omitted.

  27. Show details of bookmarks at index 15012014 and ranges 20-30, 40-50:

    $ buku -p 20-30 15012014 40-50
    
  28. Show details of the last 10 bookmarks:

    $ buku -p -10
    
  29. Show all bookmarks with real index from database:

    $ buku -p
    $ buku -p | more
    
  30. Replace tag 'old tag' with 'new tag':

    $ buku --replace 'old tag' 'new tag'
    
  31. Delete tag 'old tag' from DB:

    $ buku --replace 'old tag'
    
  32. Append (or delete) tags 'tag 1', 'tag 2' to (or from) existing tags of bookmark at index 15012014:

    $ buku -u 15012014 --tag + tag 1, tag 2
    $ buku -u 15012014 --tag - tag 1, tag 2
    
  33. Open URL at index 15012014 in browser:

    $ buku -o 15012014
    
  34. List bookmarks with no title or tags for bookkeeping:

    $ buku -S blank
    
  35. List bookmarks with immutable title:

    $ buku -S immutable
    
  36. Shorten URL www.google.com and the URL at index 20:

    $ buku --shorten www.google.com
    $ buku --shorten 20
    
  37. Append, remove tags at prompt (taglist index to the left, bookmark index to the right):

    // append tags at taglist indices 4 and 6-9 to existing tags in bookmarks at indices 5 and 2-3
    buku (? for help) g 4 9-6 >> 5 3-2
    // set tags at taglist indices 4 and 6-9 as tags in bookmarks at indices 5 and 2-3
    buku (? for help) g 4 9-6 > 5 3-2
    // remove all tags from bookmarks at indices 5 and 2-3
    buku (? for help) g > 5 3-2
    // remove tags at taglist indices 4 and 6-9 from tags in bookmarks at indices 5 and 2-3
    buku (? for help) g 4 9-6 << 5 3-2
    
  38. List bookmarks with colored output:

    $ buku --colors oKlxm -p
    
  39. Add a bookmark after following all permanent redirects, but only if the server doesn't respond with an error (and there's no network failure)

    $ buku --add http://wikipedia.net --url-redirect --del-error
    2. Wikipedia
       > https://www.wikipedia.org/
       + Wikipedia is a free online encyclopedia, created and edited by volunteers around the world and hosted by the Wikimedia Foundation.
    
  40. Add a bookmark with tag http redirect if the server responds with a permanent redirect, or tag shaped like http 404 on an error response:

    $ buku --add http://wikipedia.net/notfound --tag-redirect 'http redirect' --tag-error 'http {}'
    [ERROR] [404] Not Found
    3. Not Found
       > http://wikipedia.net/notfound
       # http 404,http redirect
    
  41. Update all bookmarks matching the search by updating the URL if the server responds with a permanent redirect, deleting the bookmark if the server responds with HTTP error 400, 401, 402, 403, 404 or 500, or adding a tag shaped like http:{} in case of any other HTTP error; then export those affected by such changes into an HTML file, marking deleted records as well as old URLs for those replaced by redirect.

    $ buku -S ://wikipedia.net -u --url-redirect --tag-error --del-error 400-404,500 --export-on --export backup.html
    
  42. More help:

    $ buku -h
    $ man buku
    

Automation

Interactive workflows can be automated using expect. Issue #368 has a working example on automating auto-import.

Troubleshooting

Editor integration

You may encounter issues with GUI editors which maintain only one instance by default and return immediately from other instances. Use the appropriate editor option to block the caller when a new document is opened. See issue #210 for gedit.

Collaborators

Copyright © 2015-2024 Arun Prakash Jana

gitter chat

Contributions

Missing a feature? There's a rolling ToDo List with identified tasks. Contributions are welcome! Please follow the PR guidelines.

See also our documentation here Stable Docs

Related projects

  • bukubrow, WebExtension for browser integration
  • oil, search-as-you-type cli front-end
  • buku_run, rofi front-end
  • pinku, a Pinboard-to-buku import utility
  • buku-dmenu, a simple bash dmenu wrapper
  • poku, sync between Pocket and buku
  • Ebuku, Emacs interface to buku
  • diigoku, buku importer for Diigo

Videos

In the Press

buku's People

Contributors

alex-bender avatar amdmi3 avatar asergi avatar captainquirk avatar chenrui333 avatar ckolumbus avatar codingcoffee avatar csill1634 avatar dertuxmalwieder avatar haze-sh avatar humcopper avatar jabagawee avatar jarun avatar jpralves avatar kishore-narendran avatar krzp avatar lexofleviafan avatar lucasmgrando avatar mosegontar avatar professorjamesmoriarty avatar rachmadaniharyono avatar rogeliodh avatar stkw0 avatar szlin avatar the-wayvy avatar toyg avatar vinfall avatar wheresmyjetpack avatar zmwangx avatar zwodahs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

buku's Issues

Buku doesn't work in VoidLinux

Hello there,
I have some weird issue on VoidLinux distro:

~ [ buku -p | tail -3                                                 ] 9:59 PM
  File "/usr/bin/buku", line 1535
    print('\nInterrupted.', file=sys.stderr)
                                ^
SyntaxError: invalid syntax

I would like to know, if there is problem with database, or the package is somehow wrong in VoidLinux:

pkgver: buku-2.5_1
repository: http://repo.voidlinux.eu/current

mysql (data)

Idea of saving data to mysql database? LIVE database not on local pc

ZSH Autocompletion not working

not working due to:
_arguments:comparguments:319: invalid option definition: (-f --format)-f[limit fields in print and Json output:value

fixed with #110

Missing + when shortening URL

When shortening the following URL:
https://launchpad.net/~twodopeshaggy/+archive/ubuntu/jarun/
we receive:
http://tny.im/HntZ2
which expands to
https://launchpad.net/~twodopeshaggy/archive/ubuntu/jarun/

Note the missing +.

zsh auto-completion errors

I've recently installed Buku via Homebrew on OS X (zsh version 5.0.8) and using the provided makefile on Fedora 24 (zsh version 5.2). On both systems I get an error when trying to tab-complete:

_arguments:comparguments:313: invalid argument: (--merge){--merge}[merge another buku database]:buku db file

Deleting the line starting with "(--merge)" only causes the next line in the completion file to be reported. I came across a similar error with SVN completions, but the solution provided there was not helpful in case of Buku. I wonder if anyone else is experiencing this issue. I'm quite sure that its not my particular zsh configuration that's at fault, the error keeps popping out even when running a fresh shell with zsh --no-rcs.

buku does not write tags properly

with the git version of buku writing of tags is not handled correctly

With version 2.0:

carnager@caprica ~ > buku -a http://www.catsthatlooklikehitler.com/cgi-bin/seigmiaow.pl "hitler, cats, fun"
Title: [Cats That Look Like Hitler!]
Added at index 106

106. http://www.catsthatlooklikehitler.com/cgi-bin/seigmiaow.pl
    Cats That Look Like Hitler!
    [TAGS] hitler, cats, fun

With checkout from git:

carnager@caprica ~ > /home/carnager/Buku/buku -a http://www.catsthatlooklikehitler.com/cgi-bin/seigmiaow.pl "hitler, cats, fun"
106. http://www.catsthatlooklikehitler.com/cgi-bin/seigmiaow.pl
   > Cats That Look Like Hitler!
   #  cats, fun,hitler

ToDo list

Continued from #78.

Notes

The list below is a growing one. While suggesting new features please consider contributing to Buku. The code is intentionally kept simple and easy to understand with comments. We'll be happy to help out any new contributor.

Some of the fresh-baked features may not have been released yet. Grab the master branch for those.

Identified tasks

  • Ubuntu Unity scope
  • A browser plugin (probably a new project; see #122)
  • Add more tests
  • API documentation
  • Rest API for webapps
  • Android app (using the same database)
  • Text editor support (thanks @ZwodahS)
  • Need a PyPI maintainer
  • Make refreshdb faster using threads (record updates should be synchronized).
  • Show usage count in lag list
  • Proxy support
  • Continuous search at prompt
  • Add prompt help
  • Specify custom DB file to class BukuDb (library usage, no exposed option)
  • Move to urllib3
  • Handle redirects using referrer masking. Example URL. Fixed with urllib3.
  • Support URL shortening. This helps to share URLs. (see #92 for limitations)
  • Make a bookmark title immutable via refreshdb()
  • Markdown import/export
  • Regex search
  • Ubuntu PPA
  • Export specific tags to HTML
  • Exact word match using REGEX. Make substring match optional.
  • Delete all records based on a search result
  • Delete multiple items, support combination of indices and ranges
  • Append tags
  • Travis CI integration
  • Ubuntu deb package generation on new tag
  • Merge bookmark database files (for users who work on multiple systems)
  • Export bookmarks in FF or Chrome html format.
  • Option to add folder names as tags while importing HTML (see #80)
  • Implement self-upgrade (see #83)
  • Anything else which would add value (please discuss in this thread)

Support adding shortened URLs to the database

With the support for URL shortening, why not introduce an option to store URLs directly shortened with --add option. Another improvement would be to (un)shorten URLs stored in DB with --update.

Using Buku with Opera

Hi,

Some years ago, Opera has been refactored completely. I did not like how bookmarks were reorganised, so I went to use Buku for bookmarking. After feeding Opera's bookmarks into Buku, I attempted to use Buku with Opera. To force Buku to open bookmarks in Opera, I am exporting BROWSER=opera. There are two generations of Opera I tried this with: Opera v12.16 (before the refactoring) and Opera v42 & v43 (recent). With the latter, when opening the bookmark of https://github.com/jarun/Buku, I am obtaining:

  • In the address bar, http://openurl%28https//github.com/jarun/Buku [sic] is displayed;
  • instead of the web content, This site can't be reached / openurl%28https's server DNS address could not be found. shows up.

This makes it impossible for me to use Buku with a recent Opera. The %28 corresponds to the character (: chr(0x28) is (. So it looks like that Buku is trying to tell Opera to openurl(https://github.com/jarun/Buku), however, it fails to do so. Nota bene that the colon : is missing in the https//github.com/jarun/Buku substring of the address bar content shown. I am not knowledgeable about how Buku instructs the browser of choice to open an URL. I am also not sure if the behaviour described here pertains to all users of Opera, or if it has something to do with my export BROWSER=opera approach described above. Buku is working fine on my Arch Linux machine with both recent versions of Firefox as well as with the ancient Opera v12.16 when using the abovementioned BROWSER=[...] method. So there are alternatives for me to using Buku with recent versions of Opera. However, I still would like to see this problem fixed to not have to work around it.

Friedrich

Json output

Hi there !

First, thanks for your work, it's very promising !

I'm trying to make a small nodejs server that calls buku to retrieve my bookmarks. For simplicity, it would be great if buku could return the bookmarks formatted in json through a command line flag !

Thanks in advance

'update' command confirmation

Accidentally, by omitting the bookmark number, I updated the titles to all my records :) Not fun..
I believe the update command should ask for confirmation if no index is provided.
It would be very frustrating if you have 10K records..
Thanks,

Feature request: batch delete

It would be useful to delete multiple records at once:

  • delete all records based on a search result
  • delete multiple items eg: 1,2,3,10-30,45 (to delete records 1,2,3, from 10 to 30.. etc)

Json output does not contain index

Hi there,
great work! Was searching a bit to get a quick workflow going to view/search/open bookmarks. Was going with buku-run as advised but found it already scraping the boundary of what poor old bash should be tasked with. Trying to extend it I was quickly in need to parse buku output.

With the pretty format being detrimental to stream processing, as it should be, I turned to JSON output and found that the index does not feature as a key. Although I am not sure I will really need it in the future I expect other people might.

Cheers

Feature request: API

I really like the concept, but keeping it only as a CLI-utility makes it hard to do interesting things.

It would be cool if you could abstract out some of the complexity (db connections, file encryption etc) so that you end up with a simple object that can then be called from other scripts. I'm thinking something like

import buku
db = buku.BukuDb()
db.addItem(url, title, description, keywords)
items = db.search(param=value)

This would make it easier to write add-ons / import mechanisms and so on in Python, rather than having to pipe through the CLI (slow) or decipher all your internals (error-prone, inflexible).

Keep up the good work! 👍 👍

Feature request: search using regexp

It would be nice to have regexp search in titles/keywords
Also, an idea would be to have an option to fetch the page content (eg. wget/w3m/curl) and search inside the body

buku is missing -i command.

With version 2.0 I can't seem to import any bookmarks.

carnager@caprica ~/Documents > buku -i bookmarks_5_26_16.html 
usage: buku [-a URL [tags ...]] [-u [N [URL tags ...]]]
            [-t [...]] [-d [N]] [-h]
            [-s keyword [...]] [-S keyword [...]]
            [-k [N]] [-l [N]] [-p [N]] [-f N]
            [-r oldtag [newtag ...]] [-j] [-o N] [-z]
buku: error: unrecognized arguments: -i bookmarks_5_26_16.html

TODO list

Continued from #14.

Notes

The list below is a growing one. While suggesting new features please consider contributing to Buku. The code is intentionally kept simple and easy to understand with comments. We'll be happy to help out any new contributor.

Some of the just-completed features may not have been released yet. Grab the master branch for those.

Currently identified ToDos

  • Implement self-upgrade (refer to googler source)
  • Move to REPL style (re-use the current Argparser, make sure DB is consistent after each run). Branch - repl
  • Load DB in memory, use encryption by default (unlock for a complete REPL session, lock before program exit)
  • Option to add folder names as tags while importing HTML (refer to #80)
  • Search as you type at REPL prompt
  • Fuzzy search at REPL prompt
  • PyPI packaging (branch pypi-packaging)
  • Android app (using the same database)
  • Markdown import/export
  • Regex search
  • Ubuntu PPA
  • Export specific tags to HTML
  • Add more tests (incremental @wheresmyjetpack, @poikjhn)
  • Exact word match instead of substring match as it works currently. (Hint: REGEXP)
  • Delete all records based on a search result
  • Delete multiple items eg: 1,2,3,10-30,45 (to delete records 1,2,3, from 10 to 30.. etc)
  • Append tags
  • Travis CI integration
  • Ubuntu deb package generation on new tag
  • Merge bookmark database files (for users who work on multiple systems)
  • Export bookmarks in FF or Chrome html format.
  • Anything else which would add value (please discuss in this thread)

'ascii' codec can't encode character '\u2014'

Hello,
When I add bookmarks, sometimes I get this error, and the entry is invalid

$ buku -a https://medium.com/@Spurrya/20-pcb-tips-and-tricks-47b95a4ba706#.4ksvpq9hi
297. https://medium.com/@Spurrya/20-pcb-tips-and-tricks-47b95a4ba706#.4ksvpq9hi
EXCEPTION [add_bookmark]: (UnicodeEncodeError) 'ascii' codec can't encode character '\u2014' in position 37: ordinal not in range(128)
dstoica@pentoo ~ $

$ buku -s ''
297. https://medium.com/@Spurrya/20-pcb-tips-and-tricks-47b95a4ba706#.4ksvpq9hi [297]
Traceback (most recent call last):
File "/usr/local/bin/buku", line 1466, in
bdb.searchdb(args.sany, False, jsonOutput)
File "/usr/local/bin/buku", line 402, in searchdb
prompt(results)
File "/usr/local/bin/buku", line 891, in prompt
print_record(row, count)
File "/usr/local/bin/buku", line 931, in print_record
print(' \x1B[91m>\x1B[0m %s' % row[2])
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 37: ordinal not in range(128)

InsecureRequestWarning when adding HTTPS URL

When adding a https url (https://www.example.com), urllib3 emits a warning that an Unverified HTTPS request is being made.

Buku version: 2.6

How to test:

$ buku -a https://www.example.com

Result:

$ buku -a https://www.example.com
/usr/lib/python3.5/site-packages/urllib3/connectionpool.py:821: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
1. https://www.example.com
   > Example Domain

Possible solutions:

More information: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

Would it be beneficial to verify the certificate or is it unnecessary?

Syncing with Chrome

Is there any way to make this sync with Chrome/Firefox/etc without having to manually import/export after each change?

UnicodeDecodeError: 'ascii' codec can't decode

buku.py is an UTF-8 file but setup.py opened it in ASCII mode instead of UTF-8 mode.

I: pybuild base:184: python3.5 setup.py clean
Traceback (most recent call last):
File "setup.py", line 13, in
version = re.search('version = '([^\']+)'', f.read()).group(1)
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 65988: ordinal not in range(128)
E: pybuild pybuild:276: clean: plugin distutils failed with: exit code=1: python3.5 setup.py clean

I already sent the pull request. #101

Import functionality

I would like to propose some sort of import functionality.

For those of us with a significant bookmark collection, it might be easier than starting from scratch. The chrome export format could be used, or something else which is easily accessible.

Search-as-you-type

Thanks for this tool, very useful.

It would be great if it could filter entries as-you-typed, similar to peco, specially for those with very large collections.

Can't import bookmarks

Hi! I just installed buku from Homebrew on a mac running Mac OS 10.11.15, and tried to import a bookmarks file exported from Chrome. Buku threw the following error:

usage: buku [-a URL [tags ...]] [-u [N [URL tags ...]]]
            [-t [...]] [-d [N]] [-h]
            [-s keyword [...]] [-S keyword [...]]
            [-k [N]] [-l [N]] [-p [N]] [-f N]
            [-r oldtag [newtag ...]] [-j] [-o N] [-z]
buku: error: unrecognized arguments: --import bookmarks_5_26_16.html

I also tried using -i instead of --import, with the same result, and checked the man page and found no mention of 'import'. Is this feature still supported?

Support comment field.

Please refer to issue #16 raised by @nick-s-b: Also, buku doesn't seem to have a "comment" field. Most bookmark managers have that.

Breaking out as a separate request.

Bug: Delete at index 1 gives TypeError

Note: This is my first interaction with an Open Source Community. My apologies if I happen to make any mistakes. I was directed to this project from http://up-for-grabs.net/#/

Getting to the point:
Operating System: OS X El Capitan Version 10.11
Python Version: 3.4.2

I followed the installation steps and got buku v1.9 running on a virtual environment.

  • The first thing I did is added a sample bookmark as follows:
sagarbhuta$ buku -a -m 'Up for Grabs' http://up-for-grabs.net/#/ oss, projects

Output:

Added at index 1
1. http://up-for-grabs.net/#/
    Up for Grabs
    [TAGS] oss,projects
  • The next thing I did was tried to remove the added bookmark as follows:
sagarbhuta$ buku -d 1

Output:

Removed index 1
Traceback (most recent call last):
  File "/usr/local/bin/buku", line 1224, in <module>
    cleardb(conn, cur, entry)
  File "/usr/local/bin/buku", line 599, in cleardb
    compactDB(conn, cur, int(index))
  File "/usr/local/bin/buku", line 566, in compactDB
    if row[0] > index:
TypeError: unorderable types: NoneType() > int()
  • Trying to delete at index 1 after adding more than 1 bookmarks. Found out that the error exists only if there is just one bookmark in the database.
sagarbhuta$ buku -a -m 'Bookmark Manager' https://github.com/jarun/Buku command line, bookmarks, manager
Added at index 1

1. https://github.com/jarun/Buku
    Bookmark Manager
    [TAGS] command line,bookmarks,manager

sagarbhuta$ buku -a -m 'Up for Grabs' http://up-for-grabs.net/#/ oss, projects
Added at index 2

2. http://up-for-grabs.net/#/
    Up for Grabs
    [TAGS] oss,projects

sagarbhuta$ buku -d 1
Removed index 1
Index 2 moved to 1

sagarbhuta$ buku -g
     1. oss
     2. projects

sagarbhuta$ buku -d 1
Removed index 1
Traceback (most recent call last):
  File "/usr/local/bin/buku", line 1224, in <module>
    cleardb(conn, cur, entry)
  File "/usr/local/bin/buku", line 599, in cleardb
    compactDB(conn, cur, int(index))
  File "/usr/local/bin/buku", line 566, in compactDB
    if row[0] > index:
TypeError: unorderable types: NoneType() > int()
  • I could reproduce the same error on buku v1.8 as well.

Consider using subcommands

Hi,

I was wondering if you would consider using subcommands rather than command line flags for the various operations that buku provides.

For now, I found the usage section too complicated to read : I need to read the description to know how to perform an action.

Instead, you could have

  • `buku add``
  • buku rm|remove|delete
  • buku tags
  • buku open
  • buku ls
  • buku show

What do you think ?

Feature request: Import for bookmarks.html file

What a great little utility! Really like how buku works. But to make it useful to me, I'd need to import all of my bookmarks in it somehow. Now that Delicious is dead (it's basically unusable), I’ve been looking for alternatives so I'm glad I came across this.

Since I have 40,000+ links in my bookmarks.html, adding them is a problem. I wish there was an automated way. Also, buku doesn't seem to have a "comment" field. Most bookmark managers have that.

Great util! Thank you for releasing it.

How to add tags when importing

Hey guys,

is it possible to set the tags in the markdown-file? I just only discovered the syntax (title)[url]. Or maybe with html?

thanks for your help,
Hans

Error on URL's with "!"

$ buku -a "https://groups.google.com/forum/#!forums/iamthecavalry" personal, security
-bash: !forums/iamthecavalry": event not found

I tried wrapping the URL in "" and not, both ways get the same error. I don't find anything about this in the help or readme.md.

Any ideas? Thanks.

Feature: manually add a title?

short:
Could you implement an option to simply allow the user to update the title manually?

long explenation:
A few years ago, I remapped the bookmarking hotkey in my .vimperatorrc for some sites, to a javascript snippet that serves as a shim. It fetches and then simplifies the title of the current page, and automatically applies tags, before it bookmarks that page using firefox's internal service. Since vimperator makes it is possible to execute some shell commands, I might try to change that to bookmark using Buku.

thanks for this tool!

Cryptography lib(s) missing

On OS X El Capitan, I installed buku via brew and core functionality seems to work: adding, deleting, searching, and opening web pages. However, I cannot lock or unlock the database.

$ buku -z -l
[DEBUG] Version 2.5
[ERROR] cryptography lib(s) missing
$ buku -z -k
[DEBUG] Version 2.5
[ERROR] cryptography lib(s) missing

ToDo list

Continued from #39.

Notes

The list below is a growing one. While suggesting new features please consider contributing to Buku. The code is intentionally kept simple and easy to understand with comments. We'll be happy to help out any new contributor.

Some of the just-completed features may not have been released yet. Grab the master branch for those.

Identified tasks

  • Need a PyPI maintainer
  • Make refreshdb faster using threads (record updates should be synchronized).
  • API documentation
  • Add more tests
  • Android app (using the same database)
  • Rest API for webapps
  • Show usage count in lag list
  • Proxy support
  • Continuous search at prompt
  • Add prompt help
  • Specify custom DB file to class BukuDb (library usage, no exposed option)
  • Move to urllib3
  • Handle redirects using referrer masking. Example URL. Fixed with urllib3.
  • Support URL shortening. This helps to share URLs. (see #92 for limitations)
  • Make a bookmark title immutable via refreshdb()
  • Markdown import/export
  • Regex search
  • Ubuntu PPA
  • Export specific tags to HTML
  • Exact word match using REGEX. Make substring match optional.
  • Delete all records based on a search result
  • Delete multiple items, support combination of indices and ranges
  • Append tags
  • Travis CI integration
  • Ubuntu deb package generation on new tag
  • Merge bookmark database files (for users who work on multiple systems)
  • Export bookmarks in FF or Chrome html format.
  • Option to add folder names as tags while importing HTML (see #80)
  • Implement self-upgrade (see #83)
  • Anything else which would add value (please discuss in this thread)

Deleting tags for all bookmarks possible unintended behavior

When there is more than one tag specified for deletion while deleting tags from all bookmarks, there is some (possibly) unintended behavior. The behavior is that not all tags specified are getting deleted.

I have only been able to replicate this when all of the following conditions are true:

  • when the to-be-deleted string contains more than one tag
  • when one of the tags in the to-be-deleted string matches a tag in only one bookmark
  • one of the following:
    • when at least one bookmark contains multiple tags specified by the string
    • - or - when each specified tag matches a tag for a different bookmark

It looks like if the string meets these conditions, then only the last tag in the string is deleted (last tag being the last one alphabetically, after input has been parsed and sorted). If the tag second-to-last in the order is found for a bookmark which also contains the last tag, then this penultimate tag is also deleted. However, if that penultimate tag exists for other bookmarks, those instances of the tag are not deleted.

Search results are deleted even if -d is passed with indices/range

The following command deletes search results though it should delete the bookmark at DB index 5:

$ buku -s hello -d 5

Search results should be deleted only if -d is passed without a value, like:

$ buku -s hello -d

Otherwise, it should process delete option separately.

TODO list

  • Add more tests
  • PyPI packaging
  • Exact word match (instead of substring match as it works currently. Hint: REGEXP)
  • Travis CI integration
  • Ubuntu deb package generation on new tag
  • Merge bookmark database files (for users who work on multiple systems)
  • Export bookmarks in FF or Chrome html format.
  • Anything else which would add value (please discuss)

REST API

This is the scratchpad I had with the envisioned endpoints:

get     api/bookmarks/firefox.html  # export to html
get     api/bookmarks/firefox.md  # export to markdown

get     api/bookmarks     #get all bookmarks
post    api/bookmarks     #new bookmark
delete  api/bookmarks     #delete table
post    api/bookmarks/refresh     #refresh all bookmarks

get     api/bookmarks/search   # get all bookmarks that match search
put     api/bookmarks/search   # update all bookmarks that match search
delete  api/bookmarks/search  # delete all bookmarks that match search

get     api/bookmarks/:id   # get bookmark with given id
put     api/bookmarks/:id   # update bookmark with given id
delete  api/bookmarks/:id   # delete bookmark with given id
post    api/bookmarks/:id/refresh   # refresh bookmark with given id
get     api/bookmarks/:id/tiny   # tinyurl of bookmark with given id
get     api/bookmarks/:id/long   # expanded url of bookmark with given id

get     api/bookmarks/:id/:id   # get bookmark in the given range
put     api/bookmarks/:id/:id   # update bookmark in the given range
delete  api/bookmarks/:id/:id   # delete bookmark in the given range
post    api/bookmarks/:id/:id/refresh   # refresh bookmark in the given range

get     api/tags/   # get tags
put     api/tags/:tag   # replace tag

Edit: There are still things that are not yet clear, but I was thinking this was a good starting subset:

get     api/bookmarks
post    api/bookmarks

get     api/bookmarks/:id
put     api/bookmarks/:id
delete  api/bookmarks/:id

get     api/tags/

search tag short option broken

All of the short arg options have a single hyphen if they support a long and short form. Example:

-a, --add URL [tags ...]

But currently the search tags option lists the following options:

--st, --stag [...] search bookmarks by tag list tags alphabetically, if no arguments

It appears to be the only option where the short option enforces two hyphens as opposed to 1 hyphen.

I attempted to use buku -st to list my tags and saw no output; while I expected the option to work. Perhaps this was a simple typo in the sourcecode? I can supply a PR later today.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.