You are not logged in.

#1 2013-01-26 05:09:08

herrflockig
Member
Registered: 2012-10-15
Posts: 8

Curses Youtube search client

I wrote a python Youtube search client with a curses interface. It's dramatically faster than the website and all it's missing is the thumbnails. It even has autocomplete!
Here's the Github. And here's a nifty little aur package.

yt in action
http://i.imgur.com/iP2YbX6.png

Please let me know what you think. Feed back, as always, appreciated. smile

Last edited by herrflockig (2013-01-26 05:28:10)

Offline

#2 2013-01-26 06:31:00

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 438

Re: Curses Youtube search client

So just out of curiosity, what's the deal with the portishead default? Your band? Favorite band? yikes


dots (or just the awesomewm config)

$ whatis this?
this?: nothing appropriate.

Offline

#3 2013-01-26 06:33:40

herrflockig
Member
Registered: 2012-10-15
Posts: 8

Re: Curses Youtube search client

Favorite band xD I just thought it would be a nice default.

Offline

#4 2013-01-26 10:11:21

ksira
Member
Registered: 2009-10-27
Posts: 31

Re: Curses Youtube search client

Very nice!

Can I suggest an option to dl a clip to your hd, and perhaps a quality option or display.

Offline

#5 2013-01-26 16:12:22

tdy
Member
From: Sacremende
Registered: 2008-12-14
Posts: 438

Re: Curses Youtube search client

line 84:
('J/K', 'prev/next'),

Looks like this should be updated to the new bindings (pgup/pgdn, brackets, or ^u/^d). Also, my preference would be to include ^f/^b (if indeed the bindings are inspired by vim).

Summarized the suggestions here:

diff -Naur yt~/yt.py yt/yt.py
--- yt~/yt.py	2013-01-24 11:33:54.582183050 -0600
+++ yt/yt.py	2013-01-24 11:35:09.410006840 -0600
@@ -81,7 +81,7 @@
 
         self._status = ''
         self._help = [
-                ('J/K', 'prev/next'),
+                ('^u/^d', 'prev/next'),
                 ('j', 'down'),
                 ('k', 'up'),
                 ('enter', 'select'),
@@ -235,12 +235,12 @@
                     self.chosen = n_per_page - 1
             elif c == ord('\n') or c == curses.KEY_RIGHT: # enter
                 self._play_video(self.chosen)
-            elif c == ord(']') or c == curses.KEY_NPAGE or c == ord(curses.ascii.ctrl('d')): # next
+            elif c == ord(']') or c == curses.KEY_NPAGE or c == ord(curses.ascii.ctrl('d') or c == ord(curses.ascii.ctrl('f')): # next
                 # have we had all the items?
                 if not 'data' in self._last_feed or not 'totalItems' in self._last_feed['data'] or len(self._items) + idx < self._last_feed['data']['totalItems']:
                     idx += n_per_page
                 self.chosen = 0
-            elif c == ord('[') or c == curses.KEY_PPAGE or c == ord(curses.ascii.ctrl('u')): # previous
+            elif c == ord('[') or c == curses.KEY_PPAGE or c == ord(curses.ascii.ctrl('u') or c == ord(curses.ascii.ctrl('b')): # previous
                 if idx > n_per_page:
                     idx -= n_per_page
                 else:
diff -Naur yt~/README yt/README
--- yt~/README	2013-01-24 11:33:54.582183050 -0600
+++ yt/README	2013-01-24 11:39:14.300460672 -0600
@@ -24,14 +24,14 @@
         *searches youtube for "black moth super rainbow"
 
 Key Bindings:
-    q            - quit
-    j            - go down one result
-    k            - go up one result
-    ^d or pgdown - go down one page
-    ^u or pgup   - go up one page
-    /            - search
-    enter        - play selected video
-    o            - change ordering (relevance, view count, published date, rating)
+    q                       - quit
+    j                       - go down one result
+    k                       - go up one result
+    ^d or ^f or ] or pgdown - go down one page
+    ^u or ^b or [ or pgup   - go up one page
+    /                       - search
+    enter                   - play selected video
+    o                       - change ordering (relevance, view count, published date, rating)
 
 ChangeLog
 ---------

dots (or just the awesomewm config)

$ whatis this?
this?: nothing appropriate.

Offline

#6 2013-01-26 17:50:43

HalosGhost
Member
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 1,485
Website

Re: Curses Youtube search client

ksira's suggestion for a download feature would make this very cool. You could add youtube-dl as an opt-depends and call it to download things.

All the best,

-HG


"All errors are ᴘᴇʙᴋᴀᴄ errors—It's just a matter of narrowing down which keyboard and chair." -Trilby
\ldots

Online

#7 2013-01-26 18:32:57

askurihin
Member
Registered: 2012-10-03
Posts: 5

Re: Curses Youtube search client

Very, very nice, enjoying it right now.
Thank you wink

Offline

#8 2013-01-27 00:08:08

whitethorn
Member
Registered: 2010-05-02
Posts: 153

Re: Curses Youtube search client

Is there a way to view a channel? Is there possibly a way to set a default resolution? I can't watch 1080 on my netbook, so I usually watch 720 or 480. Otherwise it's amazing.

Thanks a lot.

Edit:

Figured out how to change the resolution. On line 396 where youtube-dl is being called. Change the

yt_dl = subprocess.Popen(['youtube-dl', '-g', url],

to

yt_dl = subprocess.Popen(['youtube-dl', '-g', '-f', '35', url]

To change the format just change the 35 to whatever youtude-dl code you want. To view the formats run youtube-dl -F http://linktoyoutubevideo


Still haven't figured out how to view channels.

Last edited by whitethorn (2013-01-27 19:30:54)

Offline

#9 2013-01-27 14:26:08

Pranavg1890
Member
From: Nagpur,India
Registered: 2012-09-07
Posts: 111

Re: Curses Youtube search client

Thanks, I was looking for such a console app. Many Many thanks @herrflockig.


Using Openbox + Tint2 + Idesk

Offline

#10 2013-02-03 19:19:03

Berveris
Member
From: Banfield
Registered: 2012-05-14
Posts: 11

Re: Curses Youtube search client

very nice!! maybe the quality option as suggested before would be a good idea.
i really like it, thank you!!

Offline

#11 2013-02-04 11:18:05

Isildur
Member
Registered: 2009-05-26
Posts: 76

Re: Curses Youtube search client

Very nice - thanks a lot for this cool idea.

Do you think it would be possible to integrate the sound into MPD? Would be really awesome to have a Youtubeplaylist in MPD.

Offline

Board footer

Powered by FluxBB