Merge pull request #748 from duhaode520/master
🐞 fix(谷歌学术搜索): 包装search.results()为空可能造成的报错
			
			
This commit is contained in:
		
						commit
						5f79fed566
					
				@ -36,14 +36,18 @@ def get_meta_information(url, chatbot, history):
 | 
				
			|||||||
            max_results = 1,
 | 
					            max_results = 1,
 | 
				
			||||||
            sort_by = arxiv.SortCriterion.Relevance,
 | 
					            sort_by = arxiv.SortCriterion.Relevance,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        paper = next(search.results())
 | 
					        try:
 | 
				
			||||||
        if string_similar(title, paper.title) > 0.90: # same paper
 | 
					            paper = next(search.results())
 | 
				
			||||||
            abstract = paper.summary.replace('\n', ' ')
 | 
					            if string_similar(title, paper.title) > 0.90: # same paper
 | 
				
			||||||
            is_paper_in_arxiv = True
 | 
					                abstract = paper.summary.replace('\n', ' ')
 | 
				
			||||||
        else:   # different paper
 | 
					                is_paper_in_arxiv = True
 | 
				
			||||||
 | 
					            else:   # different paper
 | 
				
			||||||
 | 
					                abstract = abstract
 | 
				
			||||||
 | 
					                is_paper_in_arxiv = False
 | 
				
			||||||
 | 
					            paper = next(search.results())
 | 
				
			||||||
 | 
					        except:
 | 
				
			||||||
            abstract = abstract
 | 
					            abstract = abstract
 | 
				
			||||||
            is_paper_in_arxiv = False
 | 
					            is_paper_in_arxiv = False
 | 
				
			||||||
        paper = next(search.results())
 | 
					 | 
				
			||||||
        print(title)
 | 
					        print(title)
 | 
				
			||||||
        print(author)
 | 
					        print(author)
 | 
				
			||||||
        print(citation)
 | 
					        print(citation)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user