human
I am working on the file "Reading papers from user.ipynb".
The first task is:
Obtaining list of references
Now, we are going to extract the list of published papers.
Can you write Python code for it?
assistant
#Here is the Python code you requested.

def scopus_search_list(query, field, max=100, *, debug=False):
    msg = "search/scopus?query={}&nofield={}&count={}".format(query, field, max)
    
    if debug:
        print_json(scopus_get_info_api(msg))
        
    resp = scopus_get_info_api(msg)['search-results']
    list = []
    
    if resp['entry']:
        list = resp['entry']
        
    return list

def extract_info_papers(list):
    def get_type(code):
        if code in ['ar','re', 'ed', 'ip']:
            return 'article'
        elif code == 'cp':
            return 'congress'
        else:
            return code
        
    return [{'id': info['dc:identifier'], 
             'title': info['dc:title'], 
             'url': info['prism:url'], 
            'citations': int(info['citedby-count']), 
            'type': get_type(info['subtype']), 
             'year': info['prism:coverDate'][:4], 
            'journal': info['prism:publicationName']} for info in list]

def scopus_papers_from_author(author_id, *, max=100):
    """
    Return the list of papers from the author
    """
    query = "AU-ID({})".format(author_id)
    field = "dc:identifier"
    
    list = scopus_search_list(query, field, max)
    #print_json(list)
    return extract_info_papers(list)
    

papers = scopus_papers_from_author(MY_AUTHOR_ID)
print('{} papers'.format(len(papers)))