How to use the scholarly.search_pubs_query function in scholarly

To help you get started, we’ve selected a few scholarly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jdumas / autobib / providers.py View on Github external
def scholarly_query(authors, title):
    """
    Query Google Scholar database.

    Args:
        authors (list): a list of strings for up the first authors last names.
        title (str): the title of the article.

    Returns:
        A record (dict) of the bibtex entry obtained from Google Scholar.
    """
    query = ' '.join(authors) + ' ' + title
    search_query = scholarly.search_pubs_query(query)
    try:
        res = next(search_query)
    except StopIteration:
        return None
    res.fill()
    if 'abstract' in res.bib:
        del res.bib['abstract']

    # Post-process title
    res.bib['title'] = re.sub('\\.*$', '', res.bib['title'])

    print('S: ' + nomenclature.gen_filename(res.bib))
    return res.bib
github perrette / papers / papers / extract.py View on Github external
def fetch_bibtex_by_fulltext_scholar(txt, assess_results=True):
    import scholarly
    scholarly._get_page = _get_page_fast  # remove waiting time
    logger.debug(txt)
    search_query = scholarly.search_pubs_query(txt)

    # get the most likely match of the first results
    results = list(search_query)
    if len(results) > 1 and assess_results:
        maxscore = 0
        result = results[0]
        for res in results:
            score = _scholar_score(txt, res.bib)
            if score > maxscore:
                maxscore = score
                result = res
    else:
        result = results[0]

    # use url_scholarbib to get bibtex from google
    if getattr(result, 'url_scholarbib', ''):
github pelednoam / mmvt / src / misc / google_scholar.py View on Github external
def get_citations_url_scholarbibs_by_publication_title(publication_title):
    bibtex_refs = []
    search_query = scholarly.search_pubs_query(publication_title)
    try:
        pub = next(search_query).fill()
        # pub = pub.fill()
        citations = list(pub.get_citedby())
        # citation = get_citatations()
        print('{} citatations for {}'.format(len(citations), pub.bib['title']))
        for citation in citations:
            bibtex_refs.append(citation.url_scholarbib)
        return bibtex_refs
    except:
        print('Can\'t find "{}"!'.format(publication_title))
        return []

scholarly

Simple access to Google Scholar authors and citations

Unlicense
Latest version published 1 year ago

Package Health Score

63 / 100
Full package analysis