diff options
Diffstat (limited to '.config/qutebrowser/userscripts/camel.py')
-rwxr-xr-x | .config/qutebrowser/userscripts/camel.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/.config/qutebrowser/userscripts/camel.py b/.config/qutebrowser/userscripts/camel.py new file mode 100755 index 0000000..926d6e9 --- /dev/null +++ b/.config/qutebrowser/userscripts/camel.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# coding=utf-8 +""" +Description: Qutebrowser userscript. Allows you to download and watch a youtube video +Keyboard binding: config.bind("\\", 'hint all userscript watchyt.py') +Config file location: ~/.config/qutebrowser/config.py +Script file location: ~/.local/share/qutebrowser/userscripts/watchyt.py +Manually set keybinding: :bind \ hint all userscript watchyt.py +Usage: Press \ then the hint keys for the video you wish to watch. + You must select the video title not the image + +This is my first Qutebrowser plugin so it is pretty basic right now. +Why download and watch when you can stream to mpv? +mpv has a thumbnails plugin that doesn't work when streaming. +You don't have to deal with buffering when it is already downloaded. +""" + +from __future__ import unicode_literals + +import os + +from executor import execute +from lxml import html +from qutescript import userscript + + +@userscript +def search_camel(request): + # TODO: Add title, url, img, filepath to a database + #dom = html.parse(request.html) + camel_url = 'https://camelcamelcamel.com/search?sq=%s' % os.environ["QUTE_URL"].strip() + with open(os.environ['QUTE_FIFO'], 'w') as fifo: + fifo.write('open -t %s' % camel_url) + +if __name__ == "__main__": + search_camel() + + |