mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
aa
This commit is contained in:
@@ -2015,7 +2015,7 @@ async def wyszukaj_linki_do_dokumentow(ctx):
|
||||
for item in query_response.json():
|
||||
logger.info(item)
|
||||
resulttab.append(item["title"])
|
||||
item_link = "https://scihub.se/" + str(item["DOI"])
|
||||
item_link = "https://sci-hub.se/" + str(item["DOI"])
|
||||
resultlink.append(item_link)
|
||||
for i in range(1,5):
|
||||
query = quote_plus(resulttab[i-1])
|
||||
|
||||
@@ -31,7 +31,7 @@ class Librarian(object):
|
||||
netrc_mod = netrc.netrc(NETRC_FILE)
|
||||
authTokens = netrc_mod.authenticators("crossref")
|
||||
self.cr = Crossref(mailto=authTokens[0])
|
||||
self.limit = 200
|
||||
self.limit = 20
|
||||
|
||||
def search_crossref(self, query, uuid):
|
||||
search_result_from_cr = self.cr.works(query = query, limit = self.limit)
|
||||
@@ -68,7 +68,6 @@ class Librarian(object):
|
||||
# trunk-ignore(bandit/B310)
|
||||
with urlopen(page_url) as response:
|
||||
info = response.info()
|
||||
print(info.get_content_type())
|
||||
data = response.read()
|
||||
text = data.decode("utf-8")
|
||||
for line in text.splitlines():
|
||||
@@ -89,11 +88,13 @@ class Librarian(object):
|
||||
if self.check_if_exists(page_url):
|
||||
return page_url
|
||||
return None
|
||||
|
||||
def refine_query(self, unrefined_reqult):
|
||||
print("Refine result")
|
||||
refined_result = []
|
||||
for item in unrefined_reqult["summary"]:
|
||||
if item["container"] == "NO":
|
||||
item_link = "https://scihub.se/" + str(item['DOI'])
|
||||
item_link = "https://sci-hub.se/" + str(item['DOI'])
|
||||
if self.check_if_exists(item_link):
|
||||
refined_result.append(item)
|
||||
print (item_link)
|
||||
@@ -103,6 +104,7 @@ class Librarian(object):
|
||||
def answer_query(self, query, uuid):
|
||||
#Search sql for UUID
|
||||
#SQL SELECT * FROM RESULTS WHERE UUID = uuid
|
||||
print("Answer result")
|
||||
uuid_found = False
|
||||
database = None
|
||||
with open("results.json", "r", encoding="UTF-8") as new_file:
|
||||
|
||||
Reference in New Issue
Block a user