Skip to content

Commit da00e4c

Browse files
committed
Account for gap years in filling citations per year
1 parent 84f9e26 commit da00e4c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scholarly/author_parser.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ def _fill_indices(self, soup, author):
123123
def _fill_counts(self, soup, author):
124124
years = [int(y.text)
125125
for y in soup.find_all('span', class_='gsc_g_t')]
126-
cites = [int(c.text)
127-
for c in soup.find_all('span', class_='gsc_g_al')]
126+
127+
cites = [0]*len(years)
128+
for c in soup.find_all('a', class_='gsc_g_a'):
129+
i = int(c['style'].split(':')[-1])
130+
cites[-i] = int(c.find('span', class_='gsc_g_al').text)
131+
128132
author['cites_per_year'] = dict(zip(years, cites))
129133

130134
def _fill_public_access(self, soup, author):

0 commit comments

Comments
 (0)