import csv


def get_urls_from_data(data_path: str, sample):
    """
    Finds and returns a list of URLs from the recipes.csv dataset.
    :param data_path: path to the input csv list
    :param sample: if given, the function will return only n=sample urls
    :return: list of urls
    """
    bbc_urls = []
    all_recipes_urls = []
    with open(data_path) as csv_file:
        csv_reader = csv.reader(csv_file)
        for index, row in enumerate(csv_reader):
            if sample > 0:
                if bbc_urls.__len__() < sample and "www.bbcgoodfood.com" in row[0]:
                    bbc_urls.append(row[0])
            elif "www.bbcgoodfood.com" in row[0]:
                bbc_urls.append(row[0])

    return {
        "bbc": bbc_urls,
        "all_recipes": all_recipes_urls
    }