Pārlūkot izejas kodu

fix recommendedPapers name

Ben 1 gadu atpakaļ
vecāks
revīzija
b0903ea210
2 mainītis faili ar 4 papildinājumiem un 4 dzēšanām
  1. 1 1
      paper_spider.papers_data.json
  2. 3 3
      spider.py

+ 1 - 1
paper_spider.papers_data.json

@@ -309,7 +309,7 @@
   "paperId": "12958ac356eb986207d81b79241d03b577ef77f4",
   "publicationDate": "2004-08-01",
   "publicationTypes": null,
-  "recommenderPages": [
+  "recommendedPapers": [
     {
       "paperId": "b958999e1bc38d8b3d2ff51f1e2fed466763d5bb",
       "externalIds": {

+ 3 - 3
spider.py

@@ -154,7 +154,7 @@ def get_references(paper_id):
 
 
 # 接口存在人机验证
-def get_related_pages(paper_id):
+def get_related_papers(paper_id):
     rsp = requests.get(url=f'https://www.semanticscholar.org/api/1/paper/{paper_id}/related-papers?limit=10&recommenderType=relatedPapers',
                        headers={'x-api-key': S2_API_KEY},
                        params={'fields': QUERY_FIELDS3})
@@ -162,7 +162,7 @@ def get_related_pages(paper_id):
     return rsp.json()['papers']
 
 
-def get_recommender_pages(paper_id):
+def get_recommended_papers(paper_id):
     rsp = requests.get(url=f'https://api.semanticscholar.org/recommendations/v1/papers/forpaper/{paper_id}',
                        headers={'x-api-key': S2_API_KEY},
                        params={'fields': QUERY_FIELDS2})
@@ -196,7 +196,7 @@ def fetch_data(paper_id):
     # print(paper)
     data['citations'] = get_citations(paper_id)
     data['references'] = get_references(paper_id)
-    data['recommenderPages'] = get_recommender_pages(paper_id)
+    data['recommendedPapers'] = get_recommended_papers(paper_id)
 
     return data if isinstance(data, dict) else None