Pandora and Spotify Playlist to Apple Music

Pandora to Apple Music only from share sheet in Pandora.app

Spotify Playlist to Apple Music on any Spotify playlist link. Creates link and opens each song in a passed in playlist for adding to Apple Music Requires below python script through Pythonista


import requests, json

import sys, clipboard

from bs4 import BeautifulSoup

from pprint import pprint

sys.setrecursionlimit(300)

content = requests.get(sys.argv[1]).content

soup = BeautifulSoup(content, 'html.parser')

scp = soup.find_all('script')[5]

cleaned = str(scp).replace("""<script>

Spotify = {};

Spotify.Entity = """,'').replace(""";

</script>""",'')

good = json.loads(cleaned)

tracks = good['tracks']['items']

result = ""

for track in tracks:

info = track['track']

#pprint(info)

artists = info['artists']

arts = ""

for artist in artists:

arts += artist['name']

title = info['name']

result += f'{title} {arts}\n'

clipboard.set(result)