NAV
python

Vitajte v dokumentácii k API MP3.to

Ak chcete získať kľúč vývojára, prejdite na adresuvývojársky portál

Authorization: <api_key>

Prevod z MP3

MP3 do WAV

import requests
import time
import shutil
import json

headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-wav',
}

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.wav

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až M4A

import requests
import time
import shutil
import json

headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-m4a'
}

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.m4a

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do FLAC

import requests
import time
import shutil
import json

headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-flac'
}

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.flac

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do WMA

import requests
import time
import shutil
import json

headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-wma'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.wma

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do WAV

import requests
import time
import shutil
import json

headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-aiff'
}

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.aiff

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do AAC

import requests
import time
import shutil
import json

headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-aac'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.aac

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až MP2

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-mp2'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp2

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-mpeg2'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()


def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mpeg2

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až M4R

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-m4r'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.m4r

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do OGG

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-ogg'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.ogg

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 na AC3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-ac3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.ac3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do AMR

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-amr'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.amr

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až DTS

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-dts'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.dts

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do AMR

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-amr'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.amr

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 na OPUS

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-opus'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.opus

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až MP4

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-mp4'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp4

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do AVI

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-avi'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.avi

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do WMV

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-wmv'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.wmv

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do MPEG

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-mpeg'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mpeg

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do MOV

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-mov'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mov

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až MPG

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-mpg'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mpg

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až DIVX

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-divx'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.divx

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až WEBM

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-webm'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.webm

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do FLV

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-flv'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.flv

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až 3GP

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-3gp'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.3gp

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do VOB

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-vob'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.vob

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do AV1

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-av1'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.av1

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až M4V

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-m4v'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.m4v

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do HLS

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-hls'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.hls

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 až M3U8

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-m3u8'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.m3u8

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do MKV

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-mkv'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mkv

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP3 do ZIP

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp3-zip'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.zip

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

Konvertovať na MP3

WAV do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'wav-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

M4A do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'm4a-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

FLAC do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'flac-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

WMA na MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'wma-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

AIFF do MP3

import requests
import time
import shutil
import json



headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'aiff-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP2 do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp2-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP2 do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp2-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

M4R do MP3

import requests
import time
import shutil
import json



headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'm4r-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

OGG do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'ogg-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

AC3 do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'ac3-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

AMR do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'amr-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

DTS do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'dts-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

OPUS do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'opus-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MP4 do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mp4-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

AVI do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'avi-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

WMV do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'wmv-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MPEG do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mpeg-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MOV do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mov-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MPG do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mpg-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

DIVX do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'divx-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

WEBM do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'webm-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

FLV do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'flv-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

VOB do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'vob-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

M4V do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'm4v-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

AV1 do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'av1-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov

MKV do MP3

import requests
import time
import shutil
import json


headers = {'Authorization': 'f134382194a844c8bb589af58ef283e9'}
file_list = ['testfiles/blah.mp3', 'testfiles/blah.mp3', 'testfiles/blah.mp3']
params = {
    'lang': 'en',
    'convert_to': 'mkv-mp3'
    }

api_url = 'https://api.mp3.to/v1/convert/'
results_url = 'https://api.mp3.to/v1/results/'


def download_file(url, local_filename):
    with requests.get("https://api.mp3.to/%s" % url, stream=True) as r:
        with open(local_filename, 'wb') as f:
            shutil.copyfileobj(r.raw, f)
    return local_filename


def convert_files(api_url, params, headers):
    files = [eval(f'("files", open("{file}", "rb"))') for file in file_list]
    print(files)
    r = requests.post(
        url=api_url,
        files=files,
        data=params,
        headers=headers
    )
    return r.json()

def get_results(params):
    if params.get('error'):
        return params.get('error')
    r = requests.post(
        url=results_url,
        data=params
    )
    data = r.json()
    finished = data.get('finished')
    while not finished:
        if int(data.get('queue_count')) > 0:
            print('queue: %s' % data.get('queue_count'))
        time.sleep(5)
        results = get_results(params)
        print(results)
        results = json.dumps(results)
        if results:
            break
    if finished:
        print(data.get('files'))
        for f in data.get('files'):
            print(f.get('url'))
            download_file("%s" % f.get('url'), "%s" % f.get('filename'))
        return {"finished": "files downloaded"}
    return r.json()


get_results(convert_files(api_url, params, headers))

Vráti sa

/path/to/local/file_processed.mp3

Ak chcete vytvoriť viacero, jednoducho vložte do zoznamu viac súborov