improve random limit for paper

This commit is contained in:
mxr612 2024-08-22 19:34:46 +08:00
parent fb7b281d1a
commit 8779907a68

View File

@ -1,5 +1,6 @@
import requests
import json
import random
import datetime
from config import __CONFIG__
@ -20,5 +21,5 @@ def search_paper(question):
for i in question:
query += "+" + i
res = requests.get(headers={'x-api-key':__CONFIG__['semAPI']},
url= 'https://api.semanticscholar.org/graph/v1/paper/search?fieldsOfStudy=Psychology&fields=abstract,citationStyles&query='+query[+1:]).json()
url= 'https://api.semanticscholar.org/graph/v1/paper/search?fieldsOfStudy=Psychology&fields=abstract,citationStyles&minCitationCount='+str(random.randint(10, 500))+'&year='+str(random.randint(1900,datetime.datetime.now().year))+'-&query='+query[+1:]).json()
return res['data']