Esempio n. 1
0
def get_url(yid, quality_id, **kwargs):
    try:
        return ytdl.get_urls([f'https://www.youtube.com/watch?v={yid}'], str(quality_id), proxy=PROXY)[0]
    except ytdl.YoutubeDLError as e:
        if FALLBACK_PROXY is None or FALLBACK_PROXY == '':
            raise e
        return ytdl.get_urls([f'https://www.youtube.com/watch?v={yid}'], str(quality_id), proxy=FALLBACK_PROXY)[0]
Esempio n. 2
0
def get_url_default_quality(yid, **kwargs):
    logger.info(f'/api/{yid}')
    try:
        return ytdl.get_urls([f'https://www.youtube.com/watch?v={yid}'], proxy=PROXY)[0]
    except ytdl.YoutubeDLError as e:
        if FALLBACK_PROXY is None or FALLBACK_PROXY == '':
            raise e
        return ytdl.get_urls([f'https://www.youtube.com/watch?v={yid}'], proxy=FALLBACK_PROXY)[0]
Esempio n. 3
0
def get_url_with_video(yid, quality_id1, quality_id2, **kwargs):
    quality_id = f'{quality_id1}+{quality_id2}'
    try:
        return ytdl.get_urls([f'https://www.youtube.com/watch?v={yid}'], quality_id, proxy=PROXY)[0]
    except ytdl.YoutubeDLError as e:
        if FALLBACK_PROXY is None or FALLBACK_PROXY == '':
            raise e
        return ytdl.get_urls([f'https://www.youtube.com/watch?v={yid}'], quality_id, proxy=FALLBACK_PROXY)[0]
Esempio n. 4
0
def get_url(yid, quality_id, **kwargs):
    return ytdl.get_urls([f'https://www.youtube.com/watch?v={yid}'],
                         quality_id)[0]
Esempio n. 5
0
def get_url_default_quality(yid, **kwargs):
    logger.info(f'/api/{yid}')
    return ytdl.get_urls([f'https://www.youtube.com/watch?v={yid}'])[0]