diff --git a/01_EJDE_spider/ejde_main.py b/01_EJDE_spider/ejde_main.py index ad6b197..ec9cfee 100644 --- a/01_EJDE_spider/ejde_main.py +++ b/01_EJDE_spider/ejde_main.py @@ -240,7 +240,7 @@ def process_article(title, article_url): "from_article": [article_id], "first_name": name[0], "last_name": name[-1], - "middle_name": ''.join(name[1:-1]) if name[1:-1] else None, + "middle_name": ''.join(name[1:-1]) if len(name[1:-1]) > 0 else None, "affiliation": [{ "year": volume, "affiliation": affiliation, @@ -287,10 +287,10 @@ def process_article(title, article_url): author_data = { "author_id": str(uuid.uuid4()), - "from_article": article_id, + "from_article": [article_id], "first_name": name[0], "last_name": name[-1], - "middle_name": ''.join(name[1:-1]) if name[1:-1] else None, + "middle_name": ''.join(name[1:-1]) if len(name[1:-1]) > 0 else None, "affiliation": [{ "year": volume, "affiliation": affiliation, diff --git a/02_EJQTDE_spider/ejqtde_scrawler.py b/02_EJQTDE_spider/ejqtde_scrawler.py index 9c1bd5d..e27ce6a 100644 --- a/02_EJQTDE_spider/ejqtde_scrawler.py +++ b/02_EJQTDE_spider/ejqtde_scrawler.py @@ -48,7 +48,7 @@ def author_detail(Data, Year, article_id, Author_list): Firstname = author[0] Lastname = author[-1] - Middlename = ''.join(author[1:-1]) if author[1:-1] else None + Middlename = ''.join(author[1:-1]) if len(author[1:-1]) > 0 else None # infor table = Data.find('table', attrs={'border': '1', 'cellpadding': '2px'}) diff --git a/04_SpringerOpen_spider/SD_detail.py b/04_SpringerOpen_spider/SD_detail.py index 98c78b4..76535be 100644 --- a/04_SpringerOpen_spider/SD_detail.py +++ b/04_SpringerOpen_spider/SD_detail.py @@ -20,7 +20,7 @@ def Author_dict(soup, article_id, Author_list): Firstname = author[0] Lastname = author[-1] - Middlename = ''.join(author[1:-1]) if author[1:-1] else None + Middlename = ''.join(author[1:-1]) if len(author[1:-1]) > 0 else None # Year Year = info.find('span', attrs={'data-test': 'article-publication-year'}).get_text() if info.find\