import re


def load_buckets(bucket_type, filepath):
    """Extract bucket names from a file."""
    with open(filepath, 'r') as buckets:
        bucket_list = buckets.read()
        if bucket_type != 'azure':
            bucket_list = re.findall(r'(?:(?:gs|s3)://)?([\w.-]+)/?', bucket_list, re.I)
        else:
            bucket_list = re.findall(r'((?:\w+://)?[\w.-]+/?)', bucket_list, re.I)
    return bucket_list