mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
aa
This commit is contained in:
@@ -35,6 +35,10 @@ class Librarian(object):
|
||||
|
||||
def search_crossref(self, query, uuid):
|
||||
search_result_from_cr = self.cr.works(query = query, limit = self.limit)
|
||||
print("Total results")
|
||||
print(search_result_from_cr['meesage']['total-results'])
|
||||
print("Fetched")
|
||||
print(len(search_result_from_cr['meesage']['total-results']))
|
||||
#add to sql with UUID
|
||||
#sql row - title, doi, author, uuid, last retrieved, is_available
|
||||
with open("results.json", "r+", encoding="UTF-8") as data_file:
|
||||
@@ -49,12 +53,6 @@ class Librarian(object):
|
||||
container = "NO"
|
||||
if "container-title" in item:
|
||||
container = "YES"
|
||||
if 'title' in item:
|
||||
print(item['title'])
|
||||
if 'type' in item:
|
||||
print(item['type'])
|
||||
|
||||
print(item['DOI'])
|
||||
summarized_results.append({"DOI" : item['DOI'], "title": item['title'] if 'title' in item else None,"type": item['type'] if 'type' in item else None, "container": container})
|
||||
result = {"UUID": uuid, "total_results": search_result_from_cr['message']['total-results'], "on_page" : 1, "summary":summarized_results, "results":search_result_from_cr['message']['items'], }
|
||||
file_data.append(result)
|
||||
@@ -97,13 +95,14 @@ class Librarian(object):
|
||||
refined_result = []
|
||||
for item in unrefined_reqult["summary"]:
|
||||
if item["container"] == "NO" and item["title"]:
|
||||
print(item["title"])
|
||||
item_link = "https://sci-hub.se/" + str(item['DOI'])
|
||||
print(item_link)
|
||||
if self.check_if_exists(item_link):
|
||||
refined_result.append(item)
|
||||
print ("HIT")
|
||||
print(item["title"])
|
||||
time.sleep(0.01)
|
||||
print("Existing hits")
|
||||
print(len(refined_result))
|
||||
return refined_result
|
||||
|
||||
def answer_query(self, query, uuid):
|
||||
|
||||
Reference in New Issue
Block a user