def _convert_url_to_downloadable(url):
    """Convert a url to the proper style depending on its website."""

    if 'drive.google.com' in url:
        # For future support of google drive
        file_id = url.split('d/')[1].split('/')[0]
        base_url = 'https://drive.google.com/uc?export=download&id='
        out = '{}{}'.format(base_url, file_id)
    elif 'dropbox.com' in url:
        if url.endswith('.png'):
            out = url + '?dl=1'
        else:
            out = url.replace('dl=0', 'dl=1')
    elif 'github.com' in url:
        out = url.replace('github.com', 'raw.githubusercontent.com')
        out = out.replace('blob/', '')
    else:
        out = url
    return out
def _convert_url_to_downloadable ( url ) : if 'drive.google.com' in url : file_id = url . split ( 'd/' ) [ 1 ] . split ( '/' ) [ 0 ] base_url = 'https://drive.google.com/uc?export=download&id=' out = '{}{}' . format ( base_url , file_id ) elif 'dropbox.com' in url : if url . endswith ( '.png' ) : out = url + '?dl=1' else : out = url . replace ( 'dl=0' , 'dl=1' ) elif 'github.com' in url : out = url . replace ( 'github.com' , 'raw.githubusercontent.com' ) out = out . replace ( 'blob/' , '' ) else : out = url return out
Convert a url to the proper style depending on its website.