Coder Social home page Coder Social logo

spotify-export's Introduction

spotify-export

Description

Let's convert a Spotify playlist into plain text!

  1. Open Spotify and go to the playlist that you want to export.
  2. Select the tracks that you want to export (Ctrl-A or Cmd-A to Select All).
  3. Right-click on the selected tracks and choose "Copy Spotify URI" from the menu.
  4. Go to the text editor of your choice and Paste.
  5. Save the file.
  6. Run ./bin/spotify-export.rb your-filename.txt.

Running the command on the included spec/support/multiple-tracks.txt test file will produce the following output:

1. Illusions -- Shout Out Louds -- Optica (Bonus Track Version)
2. My Number -- Foals -- Holy Fire
3. Love to Get Used -- Matt Pond -- The Lives Inside The Lines In Your Hand
4. Clouds -- Rangleklods -- Beekeeper (incl. Home EP)
5. Kelly -- When Saints Go Machine -- Konkylie

Listening to the songs might be fun too.

Enjoy!

Features

  • Lookups are performed using the super-efficient Spotify Web API.
  • SQLite is used as a caching layer so that information about each track will only be requested once, which allows you to regularly back up large playlists.

Requirements

Setup

  • bundle install

Acknowledgments

This product uses a SPOTIFY API but is not endorsed, certified or otherwise approved in any way by Spotify. Spotify is the registered trade mark of the Spotify Group.

spotify-export's People

Contributors

jlund avatar lestopher 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

spotify-export's Issues

undefined method `each' for nil:NilC

When trying to use it on Windows, it appears a class is missing:

ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]

bundle install
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using builder 3.2.2
Using arel 6.0.3
Using diff-lcs 1.2.5
Using rspec-support 3.4.1
Using ruby-progressbar 1.7.5
Using sqlite3 1.3.11
Using bundler 1.12.4
Using tzinfo 1.2.2
Using rspec-core 3.4.2
Using rspec-expectations 3.4.0
Using rspec-mocks 3.4.1
Using activesupport 4.2.5.1
Using rspec 3.4.0
Using activemodel 4.2.5.1
Using activerecord 4.2.5.1
Bundle complete! 4 Gemfile dependencies, 19 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
C:\Users\xxx\Documents\Daddy\_transfer\spotify-export-master>.\bin\spotify-export.rb "..\Discover weekly.txt"
C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/lib/spotify-track.rb:49:in `format_artists': undefined method `each' for nil:NilC
lass (NoMethodError)
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/lib/spotify-track.rb:82:in `get_track_attributes'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/lib/spotify-track.rb:32:in `attributes'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/lib/spotify-track.rb:22:in `name'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/bin/spotify-export.rb:23:in `block in <main>'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/bin/spotify-export.rb:20:in `each'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/bin/spotify-export.rb:20:in `each_with_index'
        from C:/Users/xxx/Documents/Daddy/_transfer/spotify-export-master/bin/spotify-export.rb:20:in `<main>'

Did I mixup a version to use?

maximum spotify api requets

Hi there, congrats for this tool. its really useful, specially when you want to try all the new streaming services out there.

do you know how many api requets is spotify supporting at the moment? I was able to run it half of my playlist, 4K songs. I was also wondering if the cache you implemented is to avoid requesting again for the already processed tracks? in this case, maybe I can try resuming it tomorrow? oh yeh...do you know after how long its a good time to try again?

cheers!

undefined method `each' for nil:NilClass

The application throws an exception when trying the example command:

$ ./bin/spotify-export.rb spec/support/multiple-tracks.txt

/Users/owenray/spotify-export/lib/spotify-track.rb:49:in `format_artists': undefined method `each' for nil:NilClass (NoMethodError)
	from /Users/owenray/spotify-export/lib/spotify-track.rb:82:in `get_track_attributes'
	from /Users/owenray/spotify-export/lib/spotify-track.rb:32:in `attributes'
	from /Users/owenray/spotify-export/lib/spotify-track.rb:22:in `name'
	from bin/spotify-export.rb:23:in `block in <main>'
	from bin/spotify-export.rb:20:in `each'
	from bin/spotify-export.rb:20:in `each_with_index'
	from bin/spotify-export.rb:20:in `<main>'

Running on macOS Sierra 10.12.5
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]

cannot load such file -- bundler/setup (LoadError)

Downloaded the latest bundle - running my command I get the below error -
what am I missing ?

bash-3.2$ ./spotify-export.rb test2.txt
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- bundler/setup (LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require'
from ./spotify-export.rb:3:in `

'
bash-3.2$

Question: is there a way to automate the copy/paste of playlists?

Hi,
First thank you for your tool, really useful to have a backup of my playlists!
I just have a question:
Do you know if there is a faster way to copy paste the track URIs into the files? I have quite a lot of playlists and going into each of them, copy/pasting into a file is a bit painful. I didn't find a way to automate this task... Do you think this is possible?
I tried to search into /Applications//spotify.app/Contents to see if I could find my playlists saved somewhere but I didn't find anything.
Thanks.
Good work.

API to update

Hi, i installed your script but the api you use seems to be outdated since i get api errors. Could you maybe correct it :) ? Thanks a lot !!!

New error?

Hello all. Have you been able to use spotify-export? I have been using it for years, but now, I get:

Traceback (most recent call last):
14: from /home/ugah/bin/spotifyexport/spotify-export/bin/spotify-export.rb:6:in <main>' 13: from /home/ugah/bin/spotifyexport/spotify-export/bin/spotify-export.rb:6:in require_relative'
12: from /home/ugah/googledrive/files/bin/spotifyexport/spotify-export/lib/spotify-playlist.rb:1:in <top (required)>' 11: from /home/ugah/googledrive/files/bin/spotifyexport/spotify-export/lib/spotify-playlist.rb:1:in require_relative'
10: from /home/ugah/googledrive/files/bin/spotifyexport/spotify-export/lib/spotify-track.rb:3:in <top (required)>' 9: from /home/ugah/googledrive/files/bin/spotifyexport/spotify-export/lib/spotify-track.rb:3:in require_relative'
8: from /home/ugah/googledrive/files/bin/spotifyexport/spotify-export/lib/spotify-cache.rb:6:in <top (required)>' 7: from /home/ugah/googledrive/files/bin/spotifyexport/spotify-export/lib/spotify-cache.rb:7:in class:SpotifyCache'
6: from /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.7/lib/active_record/connection_handling.rb:51:in establish_connection' 5: from /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:1054:in establish_connection'
4: from /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:1134:in remove_connection' 3: from /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:1163:in owner_to_pool'
2: from /var/lib/gems/2.7.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:100:in []' 1: from /usr/share/rubygems-integration/all/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:998:in block in create_owner_to_pool'
/usr/share/rubygems-integration/all/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:1011:in discard_unowned_pools': undefined method each' for #<Concurrent::Map:0x0

It seems login was successful, got a login notification via email and everything.

Thank you,
-- Fred

Help?

/Downloads/spotify-export-master/lib/spotify-playlist.rb:10:in 'initialize': That file does not exist (SpotifyPlaylist::MissingFileError) from ./bin/spotify-export.rb:16:in 'new' from ./bin/spotify-export.rb:16:in '<main>'
Any suggestions what's wrong?

Missing requirement for devkit

While trying to use on Windows, bundle install fails on json due to missing devkit.

Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Installing i18n 0.7.0
Installing json 1.8.3 with native extensions

Gem::InstallError: The 'json' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
Installing minitest 5.8.4
Installing thread_safe 0.3.5
Installing builder 3.2.2
Installing arel 6.0.3
Installing diff-lcs 1.2.5
Installing rspec-support 3.4.1
Installing ruby-progressbar 1.7.5
Installing sqlite3 1.3.11
Using bundler 1.12.4
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.

Activesupport requires Ruby>=2.2.2

Tried to install but Activesupport requires Ruby>=2.2.2. Here is the output:

xx@xx:~/spotify-export/bin$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
Using minitest 5.9.1
Using thread_safe 0.3.5
Using tzinfo 1.2.2

Gem::InstallError: activesupport requires Ruby version >= 2.2.2.
An error occurred while installing activesupport (5.0.0.1), and Bundler cannot
continue.
Make sure that gem install activesupport -v '5.0.0.1' succeeds before
bundling.

Not a ruby user - how to rectify ?

Is this problem caused by me using ruby2 ?
Ruby2 seems the default on the mac now

ruby -v

ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]

MacBook-Pro:~/dev/spotify-export$ ./bin/spotify-export.rb work-playlist
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- bundler/setup (LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from ./bin/spotify-export.rb:3:in `

'

Cannot find 'Copy Spotify URI' for bulk selection

Not sure if it was removed in an update, but I couldn't find it (macOS). I did find out, however, that you CAN copy the URI in bulk with CMD+Shift+C, or CTRL+Shift+C in Windows. The README should be updated to reflect that.

No RubyUser on Windows - Could not load sqlite_adapter

using bin\spotify-export.rb "myList.txt" I get following error message:

C:/Ruby/Ruby23/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require': Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (LoadError)

I executed following commands:
gem install bundler
bundle install

and in addition to that, i've executed following commands:
gem install activerecord
gem install sqlite3

Any ideas?

No token provided

Hi!

Is your application still supported?

Now when you try to start the conversion, a response arrives with the following content:

{"error"=>{"status"=>401, "message"=>"No token provided"}}

bundler/setup (LoadError)

➜  spotify-export git:(master) ✗ ./bin/spotify-export.rb your-filename.txt
/usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
    from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from ./bin/spotify-export.rb:3:in `<main>'

`initialize': That file does not exist (SpotifyPlaylist::MissingFileError)

$ ./bin/spotify-export.rb spotify.txt
/usr/local/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:206: warning: constant ::Fixnum is deprecated
/usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.0.0.1/lib/active_support/xml_mini.rb:51: warning: constant ::Fixnum is deprecated
/usr/local/lib/ruby/gems/2.4.0/gems/activesupport-5.0.0.1/lib/active_support/xml_mini.rb:52: warning: constant ::Bignum is deprecated
/usr/local/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
/usr/local/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
.../spotify-export/lib/spotify-playlist.rb:10:in `initialize': That file does not exist (SpotifyPlaylist::MissingFileError)
	from ./bin/spotify-export.rb:16:in `new'
	from ./bin/spotify-export.rb:16:in `<main>'

`format_artists': undefined method `each'

  • ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
  • macOS High Sierra 10.13.2 (17C88)

Ran: ./bin/spotify-export.rb ~/Desktop/jazz.txt

/usr/local/lib/ruby/gems/2.5.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
Traceback (most recent call last):                                                                                             |
	7: from ./bin/spotify-export.rb:20:in `<main>'
	6: from ./bin/spotify-export.rb:20:in `each_with_index'
	5: from ./bin/spotify-export.rb:20:in `each'
	4: from ./bin/spotify-export.rb:23:in `block in <main>'
	3: from /Users/af/Code/spotify-export/lib/spotify-track.rb:22:in `name'
	2: from /Users/af/Code/spotify-export/lib/spotify-track.rb:32:in `attributes'
	1: from /Users/af/Code/spotify-export/lib/spotify-track.rb:82:in `get_track_attributes'
/Users/af/Code/spotify-export/lib/spotify-track.rb:49:in `format_artists': undefined method `each' for nil:NilClass (NoMethodError)

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.