Giter VIP home page Giter VIP logo

ytfzf's People

Contributors

0mp avatar 8manz avatar amarakon avatar brauliohms avatar calbrecht avatar cybardev avatar euro20179 avatar futureisfoss avatar gardockt avatar hoowwshii avatar ionenwks avatar jac-zac avatar jojiiofficial avatar jose1711 avatar jpgichw avatar kr1ss-xd avatar mathisto avatar mudskipper875 avatar ohmyhub avatar paniash avatar pystardust avatar qoheniac avatar sdushantha avatar shrekhavingabadday avatar simonhughxyz avatar spector-9 avatar vouivre avatar westofer avatar wschnee avatar xystel 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

ytfzf's Issues

Video playing error

some videos won't play:

[ytdl_hook] ERROR: requested format not available
[ytdl_hook] youtube-dl failed: unexpected error occurred
Failed to recognize file format.

Exiting... (Errors when loading file)
ERROR[#3]: Couldn't play the video/audio using the current player.
Try updating youtube-dl

mpd for audio stream ?

Hi,
really great work! I like it! :)

I was playing around with mpc, and I got the following command:

youtube-dl -f bestaudio -g uIphNGLBeZQ | mpc add

It works, with mpc play it plays the song.

But I can not find the way to use it with ytfzf. Could you help?

Thx,
Thomas

UTF8

ytfzf-cols
I love it... but it needs utf8 support to adjust the columns

Error.

➜ ~ ytfzf test
[ytdl_hook] ERROR: QZ36oaXHkOU: YouTube said: Unable to extract video data
[ytdl_hook] youtube-dl failed: unexpected error occurred
Failed to recognize file format.

Exiting... (Errors when loading file)
ERROR[#3]: Couldn't play the video/audio using the current player: mpv
Try updating youtube-dl
Check for new versions and report at: https://github.com/pystardust/ytfzf

Thumbnails non-functional in Wayland using normal terminal emulators

Thumbnails do not display in Wayland using a normal terminal emulator due to ueberzug relying on X. This is obviously an upstream issue but something I feel is worth mentioning. For example gnome-terminal does not work.

I tested in kittyhowever, which has its own image protocol and it does work, but in 99% of terminals it will likely not work by default.

Automatically play first result

Hello there. This is a real nice script, but I'd like to have it play the first result automatically without me needing to press enter (assume that I'm satisfied with the first result, regardless of accuracy). Can this be done currently via flags (I don't see it in the docs) or via some shell syntax magic? If so then could you please let me know how?

I only tried ytfz -m <search-query> <<< printf "\n" and that didn't work (I thought it'd automatically press Enter after search).

PS: I use zsh but I have bash installed for scripts, so either syntax suggestion is welcome. Thank you.

FIX: bash - hist and current files

Line 352, doesn't parse "\n"s which results in exporting empty lines to ytfzf_hst ytfzf_cur
selected_data="$(echo "$selected_data" | sed 1d )"

Working (in both dash and bash under linux) solution is to change the 'echo' to 'printf' OR to use 'echo -e' whenever backslash escapes need to be parsed.

MacOS imag-preview

Just to make you aware of this, preview of thumbnails doesn't work on macOS. The script download the images were it should, but it doesn't show them. It looks like the problem has to do with Überzug. I also tried to run fontpreview-ueberzug which won't work either. But I might also be wrong so if other people have mac they might be helpful. I also tried to used Überzug to preview images in ranger and It doesn't work. In ranger they use a preview for that works with iTerm terminal emulator. An example is imgcat

Possible MPV/youtube-dl error while trying to play video

I just installed this program after I saw its showcase on reddit.com/r/unixporn
I followed all the installation instructions and installed all of the dependencies. I also got the most up to date verison of youtube-dl.

Not sure what the error means.
Here is the video I was trying to watch: https://www.youtube.com/watch?v=mAFMJ1LnQu8

Error given

Downloading Thumbnails................................
[ytdl_hook] ERROR: mAFMJ1LnQu8: YouTube said: Unable to extract video data
[ytdl_hook] youtube-dl failed: unexpected error occurred
Failed to recognize file format.

Exiting... (Errors when loading file)
ERROR[#3]: Couldn't play the video/audio using the current player: mpv
Try updating youtube-dl
Check for new versions and report at: https://github.com/pystardust/ytfzf

Is there a way to use ytfzf from inside rofi-script?

Hi, I'd like to be able to do something like this (to only have one shortcut to invoke rofi):

rofi  -modi run,file-browser,"CALC:qalc +u8","youtube:/usr/bin/ytfzf -D" \
        -show run \
        -display-drun "Run" \
        -display-file-browser FILES \
        -display-run SHELL \
        -columns 2

As I am switching modes I get an error message for ytfzf "Do not launch..". I am not sure if it's possible to achieve this functionality but it would be great if that's possible. Thanks.

Loop mode

Please consider adding a flag to loop the currently playing song until the user presses q to quit mpv. mpv has a --loop flag for that, so I'm assuming you need only to call that flag in your script when passed a custom loop flag.

Output currently playing video info into file

Output currently playing video info so another status indicator can extract and show it
Below is my poor way of doing that

#PLAY
current_playing_info=~/.cache/ytfzf_cur # File location
printf "%s" "$selected_data" > "$current_playing_info" ; # Write data to the file
[ -n "$preferred_format" ] &&...
...
#QUIT
printf "" > "$current_playing_info"; # Blank the file when quit player
[ $save_history -eq 1 ] && printf "%s\n" "$selected_data" >> "$history_file" ;

parse error: Invalid numeric literal at line 1, column 17

Getting the following error on macOS 10.14.6

$> ytfzf test string
parse error: Invalid numeric literal at line 1, column 17
No results found. Try different keywords.
Check for new versions and report at: https://github.com/pystardust/ytfzf

Don't have enough experience to debug further. Would appreciate some help.

Multiple sessions break thumbnails

Thumbnails do not show properly if more than one session with thumbnails enabled exists on the system.
The issue probably originates from the hard-coded variables for ueberzug (line 230-232).

Not an issue

This is not an issue: just an appreciation. I can now watch YT on repeat without leaving my work.

You guys are Gods among men!

Much appreciated!

Would it be possible to see the comments?

I have the habit of reading through the comments after watching a video.
Would it be possible to add this option? Perhaps put the comments into stout or a file? That would be a real game-changer for me. Thanks for the AMAZING work!

not work in dmenu mode

I've got ytfzf from AUR and this is the output:

ytfzf -D starboy
usage: dmenu [-bvcfsxF] [-l lines] [-p prompt] [-fn font] [-m monitor]
[-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]
[-bw width] [-hb color] [-hf color] [-hp items] [-h height]
[-nhb color] [-nhf color] [-shb color] [-shf color]
Usage: ytfzf
ytfzf -h # to show help text

Project Website

Is there a website for this project? If not, will you make it?

It's pretty simple these days:

  1. Create a repo named pystardust.github.io
  2. Go to Repo Settings
  3. Scroll down to Github Pages section
  4. Select Choose Theme
  5. Copy-paste the contents of your main branch's README.md to index.md in the newly created gh-pages branch
  6. Customize layout elements to suit your repo (set download links, etc.)

If you don't want to or can't invest too much time into this, then I can do it. I want to contribute more but since I can't code sh very well, I can at least do this simple thing :3

I think if you just do steps 2-4 (for both this repo and pystardust.github.io) then I can fork the gh-pages branch, do the rest, then make a pull request if you want.

Dmenu and thunbails

Amazing script.

the -D -t switch doesn't work.
I guess thats too much for dmenu.

Also uberzug has this bug that the thumbnail doesnt get deleted or updated once it was cached.
Have a look at lfimg and lf-ueberzug here in git they found a solution for the file manager lf + ueberzug.

hmmm was a one time thing I guess ... not doing it anymore ... you are very fast :)

Thumbnails don't render in st or alacritty

I'm testing this on Artix linux with dwm. As clearly mentioned in the README, running with -t does download thumbnails but doesn't render on the terminal. This happens on both st and alacritty. I only receive the message Loading... at the placeholder of the thumbnails.

Screenshots

st:
st-issue

alacritty:
pic-full-210304-2312-58

MacOS errors out when trying to play videos

I'm on Catalina(still) and had been a user of the one liner version of the script. I upgraded to the newer style and now when I try and view videos i get this:

➜ ytfzf git:(master) ytfzf "nintendo"
2021-03-03 11:38:20.166 mpv[80733:9519816] This NSLayoutConstraint is being configured with a constant that exceeds internal limits. A smaller value will be substituted, but this problem should be fixed. Break on BOOL _NSLayoutConstraintNumberExceedsLimit(void) to debug. This will be logged only once. This may break in the future.
Playing: h
[file] Cannot open file 'h': No such file or directory
Failed to open h.

Playing:
[file] Cannot open file '': No such file or directory
Failed to open .

Playing: ps://www.you
No protocol handler found to open URL ps://www.you
The protocol is either unsupported, or was disabled at compile-time.

Playing: ube.com/wa
[file] Cannot open file 'ube.com/wa': No such file or directory
Failed to open ube.com/wa.

Playing: ch?v=Super Smash Bros. Ul
[file] Cannot open file 'ch?v=Super Smash Bros. Ul': No such file or directory
Failed to open ch?v=Super Smash Bros. Ul.

Playing: ima
[file] Cannot open file 'ima': No such file or directory
Failed to open ima.

Playing: e - Mr. Sakurai Presen
[file] Cannot open file 'e - Mr. Sakurai Presen': No such file or directory
Failed to open e - Mr. Sakurai Presen.

Playing: s
[file] Cannot open file 's': No such file or directory
Failed to open s.

Exiting... (Errors when loading file)
ERROR[#3]: Couldn't play the video/audio using the current player: mpv
Try updating youtube-dl
Check for new versions and report at: https://github.com/pystardust/ytfzf

I've tried it on both iTerm and the vanilla Terminal program. I've also tried both bash and zsh. I used the MacOS install instructions listed in the README file.

It lets me browse and select videos. But once I select one it errors out as above.

EDIT

It looks like the error is coming from mpv(0.33.0).

Information about code

Hello there. I'd like to understand your code a bit better in order to drop the features I don't need from my fork of your script. If you're willing to help with that...

  1. In the below image, what exactly is the variable main doing in lines 43 and 68-69? Is that really necessary?
    (also note that using a loop for dep check makes the code easier to modify - just add/remove names to the dep variable)

image

  1. Another thing is, I'd like to remove this if-else block and the *_len variables if it isn't required if I use your -a flag to autoplay stuff, since I'm not displaying the names. Are any of these required nonetheless for searching the video or playing it, or can I just remove them? (I removed the fzf parts already btw)

image

Search result encoding

Hi,

I'm on iTerm2 on MAC (which has a pretty good unicode support) and polish diactrics look kind of wonky in search results.

Zrzut ekranu 2021-02-24 o 10 57 37
Eg.
first line should say: Pal Hajs TV - 43 - Dożynki W Nidzicy
last line should be: Pal Hajs TV - 124 - Święto Kwiatów Owoców i Warzyw 2020
Cheers,

save video stream?

Thanks for the script, it is really cool!
Would it be possible to implement to dump the video stream into a file?

unknown action: first

May I know is it supposed to work for win10 WSL? :)
After many dependency installations, when I type ytfzf then I got this output.
Only ytfzf -h works for me.

YT API support (option?)

I love the script, but at least for me, YT API is way faster than using only youtube-dl. It would be lovely to have an option like that or even just enabling it in the script itself.

error when using -t option

I am getting the following error when using the -t option

ytfzf -t funny
Downloading Thumbnails................................
invalid preview window layout: left:50%:noborder:wrap

I tried it in mate-terminal and guake. Same error

thank you for taking a moment to read this.

Issue: Archlinux/AUR selecting a video outputs mpw help prompt

I just installed ytfzf from the AUR via yay -s ytfzf.

First attempt to run it got me an error message that fzf is missing. So I installed the optional fzf and ueberzug, since thumbnails seem nice to have.

Downloading thumbnails and selecting a video via the fuzzy search and arrow keys works great, but as I hit enter I get this:

$ ytfzf -t rickroll
Downloading Thumbnails............................
mpv 0.33.0-dirty Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
 built on UNKNOWN
FFmpeg library versions:
   libavutil       56.51.100
   libavcodec      58.91.100
   libavformat     58.45.100
   libswscale      5.7.100
   libavfilter     7.85.100
   libswresample   3.7.100
FFmpeg version: n4.3.1

Usage:   mpv [options] [url|path/]filename

Basic options:
 --start=<time>    seek to given (percent, seconds, or hh:mm:ss) position
 --no-audio        do not play sound
 --no-video        do not play video
 --fs              fullscreen playback
 --sub-file=<file> specify subtitle file to use
 --playlist=<file> specify playlist file

 --list-options    list all mpv options
 --h=<string>      print options which contain the given string in their name

I am on arch and using ytfzf from bash in xfce4-terminal emulator.

$ uname -a
Linux archws 5.11.1-arch1-1 #1 SMP PREEMPT Tue, 23 Feb 2021 14:05:30 +0000 x86_64 GNU/Linux

last colume in search

What is the last colume F=$url [0jfa008004eh] displayed for?

Very nice script by the way, Thanks

Support for styling and number of search results

Currently, the default number of search results seems to be some number less than 40. I think an option in conf.sh could be added to include a user-defined number of search results.

Currently the previews are on the left and fzf on right. An option to swap the two would be nice. Thanks!

FZF_DEFAULT_OPTS not being referenced

I like using the following in my default opts: FZF_DEFAULT_OPTS="--bind=ctrl-a:select-all,ctrl-d:deselect-all,ctrl-t:toggle-all", but I noticed they weren't taking when I added them to the script. $FZF_DEFAULT_OPTS needs to be referenced in the following functions:

format_menu () {
	if [ $is_ext_menu -eq 0 ]; then
		dep_ck "fzf"
++		prompt_menu='fzf -m --bind change:top --tabstop=1 --layout=reverse --delimiter="$(printf "\t")" --nth=1,2 $FZF_DEFAULT_OPTS'
--		prompt_menu='fzf -m --bind change:top --tabstop=1 --layout=reverse --delimiter="$(printf "\t")" --nth=1,2'
video_menu_img () {
	title_len=400
	format_awk | fzf -m --tabstop=1 --bind change:top --delimiter="$(printf "\t")" --nth=1,2 \
		--layout=reverse --preview "sh $0 -U {}" \
++        	--preview-window "left:50%:noborder:wrap" $FZF_DEFAULT_OPTS
--        	--preview-window "left:50%:noborder:wrap" $FZF_DEFAULT_OPTS
}

column: invalid option -- 'o'

I'm running. Ubuntu 20.04. The column command doesn't have an 'o' flag it seems. I even checked the man pages. I'm not sure how you got this working that case. Maybe consider using awk instead?

column: invalid option -- 'o'
usage: column [-txne] [-c columns] [-s sep] [file ...]
No results found. Try different keywords.
Check for new versions and report at: https://github.com/pystardust/ytfzf

MacOS "ytfzf -H" "/usr/local/bin/ytfzf: line 596: tac: command not found"

MacOS "ytfzf -H" "/usr/local/bin/ytfzf: line 596: tac: command not found"

Since there is no "tac" in MacOS, replacing line number 596
hist_data="$(tac "$history_file")"
with
hist_data="$(tail -r "$history_file")"
fix the issue.

Also there is "tac" in line number 534, but I'm not sure if fixing this will brake the functionality or not.
Could you please test it?
Thanks!

Discussion for thumbnails

Hi everyone, I need some suggestions and help to implement thumbnails.

Here is what I am able to do so far

  • Download all the thumbnails
  • Show them in an external viewer (sxiv) while fzf highlights a certain video.

Drawbacks : It doesn't look clean, as it is using 2 separate windows.

Feel free to share you ideas on how you would like thumnails implemented.

I can always fallback to a filemanager (like ranger, lf) which will make life much easier.

It would be nice if the dependencies are available in standard debian and arch repos.

Invalid parsing of YTFZF_EXTMENU

Seems parsing of YTFZF_EXTMENU variable containing blanks is broken. Here's an attempt to set prompt to Search Youtube:

YTFZF_EXTMENU='dmenu -i -l 15 -p "Search Youtube"' ytfzf -D

This results in
obrázok

Support for standard input

Hi! Is it possible to add standard input (if not already done) to be used in other scripts?

Great project btw :-)

Only download thumbnails if they're going to be displayed

I usually want to show thumbnails, so i aliased ytfzf="ytfzf -t" in my .zshrc to not always having to add the -t. Now it always takes up 1-2s to download them, even when I run ytfzf with -a, which is useless. It would be nice if ytfzf would download the thumbnails only when a fzf menu is going to be opened.

Change player

Could an option to configure the video player be added? I am using devour to swallow the terminal window of mpv. So being able to do something like ytfzf -p "devour mpv" would be fantastic. Thanks!

Cooler looking gif

I want to add a cooler looking gif to the readme.
I am not very good at ricing.
It would be really nice if someone with a really cool rice makes a gif 😎
@westofer

subscriptions

Hi
Thank you for making ytfzf. Really enjoying it!
Subscriptions would make it even more powerful. Could be a simple text file with channels in it and a command to view the latest videos.

Cheers
Johannes

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.