├── ytlikely.sh ├── spotify-scrape.pl ├── spot2mp3.sh └── README.md /ytlikely.sh: -------------------------------------------------------------------------------- 1 | #example call: 2 | #sh ./ytlikely.sh 'daft punk - technologic' 3 | #sh ./ytlikely.sh 'search - term' 4 | 5 | #Author: Wouter Vandenneucker 6 | #Author twitter: http://twitter.com/woutervddn 7 | 8 | QUERY=$(echo $1 | sed -e 's/ - / /g' | sed 's/ /+/g') 9 | wget -O foo.html "http://gdata.youtube.com/feeds/api/videos?q=$QUERY&max-results=1&v=2"&& 10 | RESPONSE=$(cat foo.html) 11 | rm foo.html 12 | echo $RESPONSE | sed 's/>>\n//g" 13 | 14 | -------------------------------------------------------------------------------- /spotify-scrape.pl: -------------------------------------------------------------------------------- 1 | #requirement 2 | #if not installed: sudo cpan install Web:Scraper 3 | 4 | #example call: 5 | #perl ./spotify-scrape.pl 'spotify:track:2qpmEFEoc6bVpYhc4Lp5Uo' 6 | #perl ./spotify-scrape.pl 'spotify-uri' 7 | 8 | #Author: Jonathan Spruytte 9 | #Author twitter: http://twitter.com/spruyttej 10 | 11 | #CoAuthor: Wouter Vandenneucker 12 | #CoAuthor twitter: http://twitter.com/woutervddn 13 | 14 | 15 | use strict; 16 | use URI; 17 | use Web::Scraper; 18 | 19 | #init 20 | my @songs=(); 21 | #scraper 22 | my $data = scraper { 23 | # we will save the urls from the teams 24 | process "ul.track-info", "tracks[]" => scraper { 25 | process "ul.track-info>li.track-title", 'title' => 'TEXT'; 26 | process "ul.track-info>li.artist", 'artist' => 'TEXT'; 27 | }; 28 | }; 29 | 30 | #loop over infput 31 | foreach ($ARGV[0]=~/(.*)/){ 32 | 33 | # scrape the data 34 | my $res = $data->scrape(URI->new("https://embed.spotify.com/?uri=$_")); 35 | 36 | #push(@songs,$res->{titles}[0] . " " . $res->{artists}[0]); 37 | 38 | 39 | #print join("\n",@songs),"\n"; 40 | for my $track (@{$res->{tracks}}) { 41 | print "$track->{title} - $track->{artist} \n"; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /spot2mp3.sh: -------------------------------------------------------------------------------- 1 | #requirements 2 | #make sure to have perl installed 3 | #if not installed: sudo cpan install Web:Scraper 4 | #check if spot2mp3.sh, ytlikely.sh and spotify-scrape.pl are in the same folder 5 | #install youtube-dl: sudo apt-get install youtube-dl 6 | 7 | #example call: 8 | #sh ./spot2mp3.sh 'spotify:track:1iNeZGJsoC0D7ZyJTdIbDS' 'DaftPunkTechnoLogic' 9 | #sh ./spot2mp3.sh 'spotify-uri' 'foldername' 10 | 11 | #Author: Wouter Vandenneucker 12 | #Author twitter: http://twitter.com/woutervddn 13 | 14 | #special thanks to: Jonathan Spruytte - http://twitter.com/spruyttej 15 | 16 | 17 | echo "saving playlist $1 in $2" 18 | TITLE="$(wget --quiet -O - https://embed.spotify.com/?uri=$1 \ | sed -n -e 's!.*