def extract_bibcodes(filename):
    """Takes a .bib filename, looks for bibcodes on the first line of each entry, and parses into a list."""

    f = open(filename)
    full_list = f.readlines()

    bibcodes = []
    
    # drop yCat, arxiv, PhDT, and other non-refereed entries
    # Workaround, since I couldn't get the API to accept property:refereed or property=refereed to work when searching
    exclude = ['arXiv','tmp','yCat','PhDT','AAS','ASPC','BSRSL','conf','EPJWC','IAUFM','IAUGA','IAUS','hst','iue','jwst','spzr','prop']
    
    for line in full_list:
        if line[0] == "@":
            if not any(x in line for x in exclude):
                bibcodes.append(line.split("{")[1].replace(",\n",""))
    
    return bibcodes