Google Scholar Filter

Date:

1 Mar 2019

  • code

from urllib.request import urlopen
from bs4 import BeautifulSoup

results = []

def search(myfile,filters):
    soup = BeautifulSoup(myfile)
    for row in soup('table', {'id': 'gsc_a_t'})[0].tbody('tr'):
        #print('\n', row)
        result = {}
        result['year'] = row('span',{'class':'gsc_a_h gsc_a_hc gs_ibl'})[0].get_text()
        result['publisher'] = row('div',{'class':'gs_gray'})[1].get_text().lower()
        result['title'] = row('a',{'class':'gsc_a_at'})[0].get_text()
        for key in filters:
            if key in result:
                for text in filters[key]:
                    if text.lower() in result[key]:
                        print(result)
                        results.append(result)

## use
myfile = urlopen('https://scholar.google.com.sg/citations?hl=en&user=VB4WBn0AAAAJ&view_op=list_works&sortby=pubdate').read()
filename = 'Desktop/Xiaogang Liu - Google Scholar Citations.html'
myfile = open(filename,"r",encoding='UTF-8').read()
filters = {
    'publisher':['nature'],
}
search(myfile,filters)

import json
with open(filename+'.json','w') as f:
    json.dump(results,f,indent=4, sort_keys=True)
  • output

{'year': '2019', 'publisher': 'nature nanotechnology 14 (12), 1110-1115, 2019', 'title': 'Upconversion superburst with sub-2 μs lifetime'}
{'year': '2019', 'publisher': 'nature photonics 13 (6), 406-411, 2019', 'title': 'Colour-tunable ultra-long organic phosphorescence of a single-component molecular crystal'}
{'year': '2019', 'publisher': 'nature communications 10 (1), 1-9, 2019', 'title': 'Upconversion amplification through dielectric superlensing modulation'}
{'year': '2018', 'publisher': 'nature 561 (7721), 88-93, 2018', 'title': 'All-inorganic perovskite nanocrystal scintillators'}
{'year': '2018', 'publisher': 'nature communications 9 (1), 1-12, 2018', 'title': 'Advances in highly doped upconversion nanoparticles'}
{'year': '2018', 'publisher': 'nature photonics 12 (3), 124-125, 2018', 'title': 'Nanocrystals feel the heat'}
{'year': '2017', 'publisher': 'nature biotechnology 35 (11), 1102, 2017', 'title': 'Molecular afterglow imaging with bright, biodegradable polymer nanoparticles'}
{'year': '2017', 'publisher': 'nature communications 8 (1), 1-7, 2017', 'title': 'Binary temporal upconversion codes of Mn 2+-activated nanoparticles for multilevel anti-counterfeiting'}
{'year': '2016', 'publisher': 'nature nanotechnology 11 (10), 851, 2016', 'title': 'Instantaneous ballistic velocity of suspended Brownian nanocrystals measured by upconversion nanothermometry'}
{'year': '2016', 'publisher': 'nature communications 7 (1), 1-9, 2016', 'title': 'In vivo covalent cross-linking of photon-converted rare-earth nanostructures for tumour localization and theranostics'}
{'year': '2016', 'publisher': 'nature communications 7, 10254, 2016', 'title': 'Three-dimensional controlled growth of monodisperse sub-50 nm heterogeneous nanocrystals'}
{'year': '2015', 'publisher': 'nature communications 6 (1), 1-6, 2015', 'title': 'Subwavelength imaging through ion-beam-induced upconversion'}
{'year': '2015', 'publisher': 'nature nanotechnology 10 (11), 924, 2015', 'title': 'Controlling upconversion nanocrystals for emerging applications'}
{'year': '2015', 'publisher': 'nature materials 14 (7), 685-690, 2015', 'title': 'Stabilizing triplet excited states for ultralong organic phosphorescence'}
{'year': '2015', 'publisher': 'nature chemistry 7 (6), 472-473, 2015', 'title': 'Supramolecular polymers: Chain growth in control'}
{'year': '2015', 'publisher': 'nature nanotechnology 10 (3), 237-242, 2015', 'title': 'Temporal full-colour tuning through non-steady-state upconversion'}
{'year': '2014', 'publisher': 'nature protocols 9 (7), 1634, 2014', 'title': 'Preparation of core-shell NaGdF4 nanoparticles doped with luminescent lanthanide ions to be used as upconversion-based probes'}
{'year': '2014', 'publisher': 'nature materials 13 (2), 157-162, 2014', 'title': 'Enhancing multiphoton upconversion through energy clustering at sublattice level'}
{'year': '2014', 'publisher': 'nature photonics 8 (1), 10, 2014', 'title': 'Optical multiplexing: tunable lifetime nanocrystals'}
{'year': '2013', 'publisher': 'nature nanotechnology 8 (10), 702-703, 2013', 'title': 'Nanocrystals: shining a light on upconversion'}
{'year': '2012', 'publisher': 'nature materials 11 (10), 842-843, 2012', 'title': 'Photonics: Upconversion goes broadband'}
{'year': '2012', 'publisher': 'nature chemistry 4 (4), 310-316, 2012', 'title': 'Imparting functionality to a metal–organic framework material by controlled nanoparticle encapsulation'}
{'year': '2011', 'publisher': 'nature materials 10 (12), 968-973, 2011', 'title': 'Tuning upconversion through energy migration in core–shell nanoparticles'}
{'year': '2010', 'publisher': 'nature communications 1 (1), 1-7, 2010', 'title': 'A systems approach towards the stoichiometry-controlled hetero-assembly of nanoparticles'}
{'year': '2010', 'publisher': 'nature 463 (7284), 1061-1065, 2010', 'title': 'Simultaneous phase and size control of upconversion nanocrystals through lanthanide doping'}
{'year': '2008', 'publisher': 'nature nanotechnology 3 (6), 332, 2008', 'title': 'Superwetting nanowire membranes for selective absorption'}