NAV
python

Добре дојдовте во документацијата MP3.to API

За да добиете клуч за програмери, одете напортал за програмери

Authorization: <api_key>

Претвори од MP3

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.wav

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.m4a

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.flac

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.wma

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.aiff

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.aac

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.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-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))

Ќе се врати

/path/to/local/file_processed.mpeg2

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.m4r

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 на 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))

Ќе се врати

/path/to/local/file_processed.ogg

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.ac3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.amr

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

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': '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))

Ќе се врати

/path/to/local/file_processed.dts

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.amr

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.opus

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.mp4

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.avi

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.wmv

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 во 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))

Ќе се врати

/path/to/local/file_processed.mpeg

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

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': '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))

Ќе се врати

/path/to/local/file_processed.mov

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 во 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))

Ќе се врати

/path/to/local/file_processed.mpg

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.divx

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 на 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))

Ќе се врати

/path/to/local/file_processed.webm

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.flv

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.3gp

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.vob

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.av1

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.m4v

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.hls

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.m3u8

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

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': '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))

Ќе се врати

/path/to/local/file_processed.mkv

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP3 до 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))

Ќе се врати

/path/to/local/file_processed.zip

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

Претворете во MP3

WAV до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

M4A до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

FLAC на 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))

Ќе се врати

/path/to/local/file_processed.mp3

WMA до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

AIFF до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP2 до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP2 до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

M4R до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

OGG на 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

AC3 до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

AMR до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

ДТС до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

OPUS до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MP4 до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

AVI до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

WMV на 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MPEG на 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

МОВ на 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MPG до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

DIVX на 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

WEBM на 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

FLV до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

VOB до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

M4V до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

AV1 до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа

MKV до 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))

Ќе се врати

/path/to/local/file_processed.mp3

За да направите повеќекратни, едноставно ставете повеќе датотеки во вашата листа