diff --git a/examples/intrumental.ipynb b/examples/intrumental.ipynb new file mode 100644 index 0000000..5b03f9b --- /dev/null +++ b/examples/intrumental.ipynb @@ -0,0 +1,221 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from suno import SongsGen\n", + "from dotenv import load_dotenv\n", + "import os\n", + "load_dotenv() \n", + "\n", + "SUNO_COOKIE = os.getenv(\"SUNO_COOKIE\")\n", + "i = SongsGen(SUNO_COOKIE)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Waiting for results...\n",
+ "
\n"
+ ],
+ "text/plain": [
+ "Waiting for results\u001b[33m...\u001b[0m\n"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/html": [
+ ".\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
.\n" + ], + "text/plain": [ + "." + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "output = i.get_songs_custom(\"\"\"\"\"\", \"grand orchestral space\", instrumental=True)\n", + "link = output['song_url']" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "audio = i.get_mp3(link, stream=True)\n", + "for chunk in audio:\n", + " if chunk:\n", + " with open(\"intrumental.mp3\", \"ab\") as f:\n", + " f.write(chunk)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "mad", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.13" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/examples/intrumental.mp3 b/examples/intrumental.mp3 new file mode 100644 index 0000000..ce39fdf Binary files /dev/null and b/examples/intrumental.mp3 differ diff --git a/suno/suno.py b/suno/suno.py index 0fbf0df..fae0e84 100644 --- a/suno/suno.py +++ b/suno/suno.py @@ -192,7 +192,7 @@ def get_songs_custom(self, prompt: str, genre: str, instrumental : str = False) self.session.headers["user-agent"] = ua.random payload = { "mv": "chirp-v3-0", - "prompt": prompt, + "prompt": "" if instrumental else prompt, "tags": genre, "make_instrumental": instrumental, }