-
Notifications
You must be signed in to change notification settings - Fork 340
Increase number of citations returned by citedby #446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
acbb1ef
95db7c4
93f243e
b09dc38
b4c0c9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
import copy | ||
import csv | ||
import pprint | ||
import datetime | ||
import itertools | ||
import warnings | ||
from typing import Dict, List | ||
from ._navigator import Navigator | ||
from ._proxy_generator import ProxyGenerator | ||
|
@@ -255,13 +258,29 @@ def citedby(self, object: Publication)->_SearchScholarIterator: | |
:param object: The Publication object for the bibtex exportation | ||
:type object: Publication | ||
""" | ||
if object['container_type'] == "Publication": | ||
publication_parser = PublicationParser(self.__nav) | ||
return publication_parser.citedby(object) | ||
else: | ||
|
||
if object['container_type'] != "Publication": | ||
self.logger.warning("Object not supported for bibtex exportation") | ||
return | ||
|
||
if object["bib"]["citedby"] < 999: | ||
return PublicationParser(self.__nav).citedby(object) | ||
else: | ||
try: | ||
year_low = int(object["bib"]["pub_year"]) | ||
year_end = int(datetime.date.today().year) | ||
except KeyError: | ||
self.logger.warning("Unknown publication year for paper %s, may result in incorrect number of citedby papers.", object["bib"]["title"]) | ||
return PublicationParser(self.__nav).citedby(object) | ||
|
||
pub_id = int(object["citedby_url"].split("=")[1].split("&")[0]) | ||
iter_list = [] | ||
while year_low < year_end: | ||
iter_list.append(self.search_citedby(publication_id=pub_id, year_low=year_low, year_high=year_low+1)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
year_low += 1 | ||
|
||
return itertools.chain(*iter_list) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
|
||
def search_author_id(self, id: str, filled: bool = False, sortby: str = "citedby", publication_limit: int = 0)->Author: | ||
"""Search by author id and return a single Author object | ||
:param sortby: select the order of the citations in the author page. Either by 'citedby' or 'year'. Defaults to 'citedby'. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
<= 1000