Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Move a Soundcloud Item, Playlist, User file to an existing Archive.org Item
#!/bin/bash
# Move a Soundcloud item/playlist to a Archive.org iten leaving a copy on the local drive
# (thanks to @kragen and kevin for impetus)
#
# Please read the Terms of Use on archive.org, tl;dr you can move files there if you are the creator or they are
# in the Public Domain. Please also go back and add any metadata to the things you move up to archive.org.
# https://archive.org/about/faqs.php#Uploading_Content
#
# Usage
# ./soundcloudtoia.sh URL_of_the_SoundCloud_item Archive.org_identifier_to_move_files_into
#
# Requirements
# youtube-dl https://github.com/rg3/youtube-dl
# InternetArchive Cli Tools https://internetarchive.readthedocs.io/en/latest/installation.html
iatarget=$2
sctarget=$1
[ ! -d "$iatarget" ] && mkdir "$iatarget"
cd "$iatarget"
youtube-dl -i -w --write-description --write-info-json --no-progress "$sctarget"
wait ${!}
for scfile in *mp3
do
ia upload "$iatarget" "$scfile" --metadata="mediatype:audio"
done
for scfile in *description
do
ia upload "$iatarget" "$scfile" --metadata="mediatype:texts"
done
cat *json |grep -Pom 1 '"thumbnail": "\K[^"]*'>thumbnails.lst
wget -i thimbnails.lst
for scfile in *jpg
do
ia upload "$iatarget" "$scfile" --metadata="mediatype:image"
done
echo "Done"
Owner

tomhiggins commented Jul 15, 2017 edited

Requirements

youtube-dl https://github.com/rg3/youtube-dl
InternetArchive Cli Tools https://internetarchive.readthedocs.io/en/latest/installation.html
Please read the Terms of Use on archive.org, tl;dr you can move files there if you are the creator or they are
in the Public Domain. Please also go back and add any metadata to the things you move up to archive.org.
https://archive.org/about/faqs.php#Uploading_Content

  1. Get and install the Requirements if you need
  2. Run ia configure if you need
  3. Go to your archive.org account and set up an Item you will be moving files into
  4. Go to a directory where you want the files to be saved locally
    5 Run soundcloudtoia.sh

Usage

./soundcloudtoia.sh URL_of_the_SoundCloud_item Archive.org_identifier_to_move_files_into

URL_of_the_SoundCloud_item = the full url of the Soundcloud user page, item page, or playlist page that lists the items you want to move

Archive.org_item_to_move_files_into = the archive.org identifier of the item you created to house the files. Use only the identifier and not the full url (ex. SCArchiveForUser and not https://archive.org/details/SCArchiveForUser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment