Ytfzf Versions Save

A posix script to find and watch youtube videos from the terminal. (Without API)

v2.6.2

3 months ago

IMPORTANT

This will likely be the last update I make regarding features and bug fixes for this project, because this is just no longer the project that I work on

If anyone wants to maintain a fork, create an issue, I don't have admin rights in this repo, so the best i can do is link the readme to your fork.

Thank you to everyone for following the project and giving me inspiration to work on it for so long.

Additions

  • -cs as an alias for -cS
  • -csi as an alias for -cSI
  • selection_meta_key for a way to change all ytfzf alt-* shortcuts to ctrl-* easily
  • action_meta_key for a way to change all ytfzf ctrl-* shortcuts to alt-* easily
  • $preview_window_width to specify how big the preview window should be

Fixes

  • When scraping subscriptions, the whitespace in the channel url is not trimmed properly sometimes
  • The last variable when setting previously exported variables is not used
  • --preview-side could be something ytfzf can't handle, such as bottom, when it should be down
  • trim_blank did not, in fact, trim the blanks, this is a feat of engineering
  • Fix: #717, thumbnails dont load when scraping new page

Addons

yt-music

Fixes

  • #714, utf-8 not kept intact

v2.6.1

7 months ago

Additions

  • support ueberzugpp sway, and wlroots image output methods
  • the yt scraper has been readded to scrape youtube directly
  • from-cache scraper, to scrape from ytfzf's cache.
    • to save to cache use --keep-cache
  • --force-invidious to make it use the chosen invidious instance instead of converting to youtube links
  • a file called created-at is kept in all cache directories to keep track of when it was created

Fixes

  • --keep-cache does not keep cache
  • M scraper does not work (#683 @gardockt)
  • --channel-url does not work with https://www.youtube.com/channel/@channel
  • use wayland instead of wlroots to align with ueberzugpp
  • Fix syntax errors on macos (#662 @readmemyrights)
  • Export FZF_DEFAULT_OPTS (#656 @jellelicht)
  • Subscriptions trim_blank url #677 (#692 @calbrecht)
  • next_page tabular tui did not know about COLUMNS AND LINES (#693 @calbrecht)

Code

  • remove unused remove_quotes_on_var_value function

v2.6.0

1 year ago

Changes

  • ueberzugpp is now the main version of ueberzug that is recommended to use
    • ueberzug should still work

Features

  • sixel thumbnail viewer

    • requires ueberzugpp
    • only works in terminals with sixel support, eg: wezterm, foot
  • kitty thumbnail viewer

    • yes this was removed last update, however it now also requires ueberzugpp
    • only works in terminals with kitty support, eg: kitty
  • iterm2 thumbnail viewer

    • requires ueberzugpp
    • only works in terminals with iterm2 support, eg: wezterm, iterm2
  • when -d fails to download, a notification will be sent if notify_playing is 1

Addons

Extensions

  • comments: detects if a video is playing in ytfzf and will scrape the comments for that video.

    • to use:
      1. have a ytfzf instance playing a video
      2. ytfzf -e comments
  • auto-thumb: basic kitty/sixel/iterm2 detection support (just checks which terminal you are using)

Fixes

  • thumbnail viewer not carried into submenu

  • ytdl_opts does not work

  • --sort does not work (is_sort=1 does)

  • #699, thumbnails not downloading properly when quality is high

  • -s, instead of asking for new search, it used the old search

  • $enable_hist and $enable_search_hist variables do nothing (@futureisfoss #673)

  • -a/-r/-S are now compatible with -D and other interfaces

  • In ksh there is an error that says .../var-fifo [Interrupted system call]

  • in some shells, it complains that there is a syntax error

  • In the playlists extension, --rfp and --atp do not work

Code

  • interface_scripting is now longer a thing, and has been replaced with an initial call to auto_select, then to run_interface if auto_select fails

v2.5.5

1 year ago

For Package Maintainers

  • the Makefile will now take care of changing the default YTFZF_SYSTEM_ADDON_DIR if it doesn't match PREFIX

Removed

  • kitty thumbnail viewer is no longer builtin due to it not working with fzf in kitty version 0.27+ (see #636), it will remain an addon in case you have an older version of kitty.

Features

  • add timezone for search history timestamp (@jpgichw #630)
  • streams, and playlist tabs can be scraped with invidious-channel
  • --disable-actions
    • Puts a blanket disable on all actions, including submenus, and the back button
  • --sort=<name>
    • An easier way to load a sort name.
    • --sort=<0|1> will still turn sorting on/off

Addons

Interfaces

  • sixel
    • Opens a very basic menu written in python but uses sixel to display thumbnails
  • kitty
    • Opens the same menu as sixel, but uses the kitty protocol for thumbnails
  • both sixel, and kitty require the sixel-menu folder.

Extensions

  • smart-thumb-download
    • Instead of downloading thumbnails into that current process' cache directory, save thumbnails in $YTFZF_CUSTOM_THUMBNAILS_DIR, that way when the same results are loaded again there is no need to download the thumbnails again.
  • auto-thumb
    • Automatically picks a thumbnail viewer based on the terminal, and current xdg session (wayland/X11/tty)

Scrapers

  • video-info gets information on a youtube video when provided a link.

Changes

  • A warning will no longer be printed for a non-absolute channel link such as: @pewdiepie

  • By default $YTFZF_LOGFILE is empty instead of /dev/stderr

  • -q sets $search_source to hist instead of hist:$search_source, essentially it will not prompt you if nothign is selected from history

  • url_handler_opts is handled with eval instead of pure word splitting

    • this allows for quoting strings.
  • Video descriptions are no longer folded to fit on half the width.

  • Changed how SI scrapes subscriptions

Fixes

  • invidious-channel scraper, also used in -cSI.
  • ueberzug thumbnail viewer is broken
  • ctrl-p on busybox
  • When running make install with a custom prefix, the default YTFZF_SYSTEM_ADDON_DIR is not changed, this is an unecessary burden on the packager and end user.
  • -s does not use $search_source, always uses prompt
  • -f with --format-selection=normal with youtube-dl is broken
  • Only one missing dependency could be shown at a time
  • Kitty thumbnail causing problems (@greenfoo #628)
  • ard extension scraper

Code

  • Remove the unused ueberzug fd 3

v2.5.4

1 year ago

Features

  • on_open_url_handler

    • Event function that is run right before the url handler is opened.
    • Takes in the urls that were opened as function arguments.
  • Added much more information to ytfzf --help

Addons

Extensions

  • subscription-manager, adds 2 options, --add-sub, and --remove-sub to help manage the subscriptions file.

Scrapers

  • picture scraper, scrapes $XDG_PICTURES_HOME or if a search is given, will scrape that instead.
    • If :w or :wallpaper is given as the search, it will search possible wallpaper folders.
    • Export YTFZF_PICTURES_WALLPAPER_PATH with different paths separated by : to change this.
      • By default, it will search:
        1. /usr/share/wallpapers
        2. /usr/share/backgrounds
        3. ~/.local/share/wallpapers
        4. ~/.local/share/backgrounds

Thumbnail Viewers

  • Added foot thumbnail viewer
    • Extremely basic, does not try to position itself in a correct location

Changes

  • ytfzf instance information is stored in $YTFZF_TEMP_DIR instead of $cache_dir
    • $cache_dir is now only used if $keep_cache is 1, and for files such as search history.
    • $YTFZF_TEMP_DIR defaults to /tmp/ytfzf-$user-id
  • alt-p is now ctrl-p and it doesn't leave the menu.
    • if you want it to be alt-p again set, next_page_action_shortcut="alt-p" in your config file.

Technical Changes

  • sort_video_data_fn no longer takes in the old ytfzf line format, instead it takes in jsonl of videos.
    • Same goes for video_info_text
  • The way previews work in fzf has been refactored completely to enable more possibilities with fzf
  • search history is now a fake extension
  • history is also a fake extension

Fixes

  • long standing bug where -l doesn't save position in fzf

  • some @channel youtube links dont find the correct uuid.

  • some addons didn't have dependancy checks.

  • Preview doesn't work when selecting multiple videos (#612)

  • -s, --search-again is broken (#613)

Plans For Next Update

  • Scraping shorts from a youtube channel
  • making an addon to make --sort work with busybox (possibly using perl or another scripting language)
  • viewed date for history (#626)

v2.5.3

1 year ago

Features

  • With the youtube-channel scraper, if the first word in the search is :videos, :streams, or :playlists it will scrape that tab from the channel.

    • --type=live, --type=playlist, --type=video, and --type=all also all work
  • the youtube-channel, and invidious-channel scrapers now accept @user channel links

    • Example: ytfzf -cyoutube-channel @pewdiepie
    • @user will also work with --channel-link
    • @user will also work in subscriptions files (but will print a warning)
  • swayimg-hyprland thumbnail viewer, forces swayimg to work on hyprland

    • is a little hacky and will mess up rules you have for swayimg

Documentation

  • The documentation misleadingly stated to set addon variables directly instead of using the load_* counterpart.
    • for example: the docs said to use url_handler=handler instead of load_url_handler "handler"

Changes

  • Files stored in /tmp have a ytfzf prefix to be cleaner. (#596 @ammgws)

Technical

  • Make the internal _get_request function a general utility function

Fixes

Bold = big fix.

  • -c S

    • -cSI may still be broken depending on whether the invidious instance has updated to the newest version of invidious.
  • Thumbnails did not take into account how many text lines were produced (this is especially noticeable if the video has a description)

  • --preview-side was broken with swayimg

  • --pages and --pages-start were broken with -c invidious-playlist

  • Thumbnails don't load in busybox

  • Playlists are out of order

  • Custom keypress functions not returning correct exit code

  • -c R does not work

  • If $YTFZF_SYSTEM_ADDON_DIR does not exist, and --list-addons is used, an unnecessary error is printed.

Addons

Scrapers

ani-category

  • works again! in conjunction with tthe new scraper, ani-gogohd-link

Known issues

  • --pages no longer works with -cinvidious-channel, use -c invidious-playlist --pages=x https://www.youtube.com/playlist?list=<channel-id> instead

v2.5.2

1 year ago

Fixes

  • The Ueberzug thumbnail viewer causes all output to be written to $ytfzf_thumbnail_log

v2.5.1

1 year ago

Additions

Options

  • --available-inv-instances
    • prints available invidious instances and exists
  • --thumbnail-log
    • The file to print thumbnail viewer debug info to.

Docs

  • Add the utility functions to the documentation.

Changes

  • breaking change: on_search_<extention_name> has been renamed to ext_on_search_<extention_name> to avoid clashes with on_search_<search>

  • Running make all does nothing for consistency with how make works (@brauliohms #577)

  • Running make with gnu make will install doc and run the main install (@mathisto #586)

  • Thumbnail viewers now print all non-thumbnail related information to $thumbnail_debug_log, which by default is /dev/null

  • Internal change to the title_str internal function to not use dd (@mathisto #591)

Fixes

(bolded = noticeable issue)

  • swayimg doesn't kill previous windows
  • swayimg steals focus for a split second.
  • Sometimes invidious instances without api are picked
  • If $cache_dir is missing, ytfzf throws an error.
  • interface does not carry to submenu
  • $session_cache_dir and $session_temp_dir are unset in thumbnail viewers
  • Typos in ytfzf(1) and ytfzf(5) (@brauliohms #575)
  • --fullscreen and is_fullscreen mentioned in docs despite not existing.

v2.5.0

1 year ago

Additions

  • Invidious instances are picked at random to avoid everyone using the same server (@BSGalvan #571)
  • scrape_next_page aka the (alt-p) shortcut has been implemented for scrape_invidious_search which is the main search function.
  • If --notify-playing is enabled, after downloading a video with -d, there will be a notification saying download complete
  • u scraper, similar to U scraper, but doesn't automatically play the video and exit.
  • get_search_from_<src>: if search_source or --search-source is set to <src> the function will be run. It is supposed to set the variable _search to a search query
  • display_text_<interface> and info_wait_prompt_<interface>
    • This way interfaces can decide how the user picks the option for info_wait, and how to display text in a copyable way.

Addons

Extensions

  • playlists: manage local playlists

    • requires that the rfp and atp url handlers are put in either $YTFZF_SYSTEM_ADDON_DIR/url-handlers or ~/.config/ytfzf/url-handlers
    • This addon is intended to always be loaded, ie: add load_extension playlists to your config file.
    • create a playlist with --create-playlist=name
    • play a playlist with --playlist=name
    • add to a playlist with --atp=name search query
    • remove something from a playlist with --rfp=name
    • delete a playlist with --del-playlist=name
    • list playlists with --list-playlists
    • list items in a playlist with --list-titles
  • bsm, integrates bash with ytfzf's search prompt (only works if /bin/sh points to bash), this allows for

    • bash's history expansion syntax in the search prompt, (eg: !! to mean last search)
    • pressing up/down to cycle through search history
    • ctrl-r to do history search

Url Handlers

  • rfp: required for the playlists extension, removes items from a playlist.
  • atp: required for the playlists extension, adds items to a playlist.

Interfaces

  • implemented display_text and info_wait_prompt to the gui interface
    • this way a gui interface shows for text to be coppied instead of it being printed, and you dont have to type q/Q/m/Enter to continue.

Options

  • -i same as --interface
  • -u same as --url-handler
  • -T same as --thumb-viewer
  • -e same as --ext
  • --search-source: sets the source for search query
    • A list of sources include:
    • args: commandline arguments
    • prompt: search prompt
    • hist: search history
    • next: used internally when multi_search is enabled
    • fn-args: used internally to mean the arguments passed to the function.
  • --version-all: get the version of ytfzf and required dependencies.

Changes

  • -IVJ now puts everything into 1 array.

Fixes

  • -IVJ and -IR should now be significantly faster
  • url handlers in $YTFZF_SYSTEM_ADDON_DIR/url-handlers are not loaded.
  • checking if a selected url has an associated action is too loose.
  • no error is printed if odysee_video_count > 50
  • hist_file and search_hist_file ignore cache_dir if it was set in the config file

Deprecated

  • use_search_hist=1, use search_source=hist instead
    • use_search_hist=0 does nothing

Technical

  • Large refactor to how ytfzf handles scrapers,
    • there are no longer any builtin special cases to reduce code complexity.
    • handle_scrape_error occures for every scrape instead of at the end
  • Large refactor to how searching works.
    • search query comes from a "source" now, by default that is the argumentspassed to the program, if no arguments are passed it uses the prompt source.
  • Refactor to how -I, -L, and --info-wait work.
  • Interfaces are no longer responsible for running handle_keypress, that now happens in the main loop after the interface is run.

Plans for Next Update

  • on_search_<ext> will be changed to <ext>_on_search to prevent clashes with on_search_<search_query>

v2.4.1

1 year ago

Additions

  • A generic error for when a scraper fails
  • When using -h, any extensions that have print_help_<ext-name>(), will also print help
  • load_interface a command to load an interface the correct way instead of setting the intereface variable directly.
  • load_thumbnail_viewer same as load_interface but for thumbnail viewers
  • load_url_handler same as load_interface but for url handlers
  • post_scrape() a function that happens after everything is scraped
  • print_help_<ext-name>() an extension can print it's own help text
  • YTFZF_CHECK_VARS_EXISTS can now be used instead of check_vars_exists

Addons

Extensions

  • buttons - adds extra buttons that when clicked do things such as:
    • enable audio only
    • enable/disable detach
    • ...
  • ipc - allows getting variables from ipc_file which is located in the session's cache dir, see $HOME/.cache/ytfzf
    • example usage:
echo "get is_audio_only" > ipc_file
cat "ipc_file.is_audio_only

yeah it's a bit clunky but working with sockets would be worse

Changes

  • w3m thumbnail preview is now an addon
  • in interface_text if tput is not found, default to $COLUMNS, then 80 columns instead of defaulting to 80 immediately
  • info wait uses quick_menu instead of the read command.
  • handle_actions is much more efficient when handling many selections

Documentation

  • Added example subscriptions file
  • Added exit codes to ytfzf.1

Fixes

  • curl adds a \r character causing weirdness when using --channel-link (issue: #557)
  • get_missing_thumbnails always says all thumbnails are missing, causing them to be redownloaded every time the menu is loaded with the -l option enabled.
  • remove_ansi_escapes removed more than just ansi escapes causing [ to be missing from text.
  • Using new lines in exported variables or variables set before running ytfzf would cause errors (#552 @HoffsMH).
  • line 163 unexpected operator when dependancy is not installed.
  • custom_shortcut_binds not doing anything.
  • __is_submenu does not save it's state when interface opens.
  • Writing watch history uses the jq command less, and should be slightly faster, more so if many videos are selected.
  • ytfzf assumes custom_info_wait_action_$info_wait_action exists.
  • Makefile creates and deletes a file called ${PROG}.bak (issue: #556)
  • the wrong invidious instance was used in the multi scraper.

Technical

  • The codebase is shellcheck compliant (with many disable comments)
  • refactor loading addons, such as interfaces, url_handlers, etc.. so that addons, or the user can just use load_<addon-type> addon-name.

Plans for next update

  • resolving #379 by adding a margin on the side
  • implementing next_page or the alt-p shortcut in the invidious_search scraper