import requests
from bs4 import BeautifulSoup


def link_crawler(url, filetype):
    """
    Find and store the desired links from a site.

    Parameters:
        url (character): The url to the website
        filetype (character): The type of file you want to be stored(.txt, .zip, ect.)

    Returns (list): A list containing all the links the selected file types
    """
    response = requests.get(url)
    soup = BeautifulSoup(response.content, features='lxml')

    links = []
    for link in soup.find_all('a', href=True):
        if link['href'].lower().endswith(filetype):
            links.append(link['href'])

    return links