l 5: add yt-next

This commit is contained in:
lassulus 2016-03-19 22:01:16 +01:00
parent 3883a9fce7
commit 369c21ca59
2 changed files with 14 additions and 0 deletions

View file

@ -11,5 +11,6 @@
xmonad-lass =
let src = pkgs.writeNixFromCabal "xmonad-lass.nix" ./xmonad-lass; in
pkgs.haskellPackages.callPackage src {};
yt-next = pkgs.callPackage ./yt-next/default.nix {};
};
}

View file

@ -0,0 +1,13 @@
{ pkgs, ... }:
pkgs.writeScriptBin "yt-next" ''
#! ${pkgs.bash}/bin/bash
vid=$1
num=''${NUM:-1}
curl -Ls $1 \
| grep 'href="/watch?v=' \
| head -n$num \
| sed 's,.*href="\([^"]*\)".*,https://youtube.com\1,'
''