diff --git a/article/controller.py b/article/controller.py index 48ede7f3..0c7e31e0 100644 --- a/article/controller.py +++ b/article/controller.py @@ -369,7 +369,7 @@ def bulk_export_articles_to_articlemeta( "article_id": article.id, "article_pid": getattr(article, "pid", None), "journal_acron": getattr(article, "journal_acron", None), - "pub_year": getattr(article, "pub_year", None), + "pub_date_year": getattr(article, "pub_date_year", None), "force_update": force_update, }, ) @@ -524,9 +524,9 @@ def _iter_from_article(self): if journal_id_list: filters["journal__in"] = journal_id_list if self.from_pub_year: - filters["pub_year__gte"] = self.from_pub_year + filters["pub_date_year__gte"] = self.from_pub_year if self.until_pub_year: - filters["pub_year__lte"] = self.until_pub_year + filters["pub_date_year__lte"] = self.until_pub_year if self.from_date: filters["updated__gte"] = self.from_date if self.until_date: @@ -596,6 +596,7 @@ def _build_harvester(self, collection_acron): timeout=self.timeout, ) if collection_acron == "scl": - return OPACHarvester(self.opac_url or "www.scielo.br", collection_acron, **kwargs) + domain = self.opac_url or Collection.get(collection_acron).base_url + return OPACHarvester(domain, collection_acron, **kwargs) return AMHarvester("article", collection_acron, **kwargs) diff --git a/article/models.py b/article/models.py index 85a4e434..0aeebef0 100755 --- a/article/models.py +++ b/article/models.py @@ -1812,6 +1812,7 @@ def create(cls, user, url=None, source_date=None, am_article=None, force_update= obj.source_date = source_date obj.am_article = am_article obj.status = cls.StatusChoices.PENDING + obj.save() obj.add_pid_provider(user, force_update, auto_solve_pid_conflict=auto_solve_pid_conflict) return obj except IntegrityError: diff --git a/core/utils/harvesters.py b/core/utils/harvesters.py index 928b7233..6b500928 100644 --- a/core/utils/harvesters.py +++ b/core/utils/harvesters.py @@ -3,6 +3,8 @@ from typing import Any, Dict, Generator, Optional from urllib.parse import urlencode +from article.utils.url_builder import ArticleURLBuilder + from core.utils.utils import fetch_data @@ -224,7 +226,9 @@ def harvest_documents(self) -> Generator[Dict[str, Any], None, None]: # ConstrĂ³i URL do XML journal_acron = item["journal_acronym"] - xml_url = f"{self.domain}/j/{journal_acron}/a/{pid_v3}/?format=xml" + xml_url = ArticleURLBuilder( + self.domain, journal_acron, pid_v3=pid_v3 + ).get_xml_url() # Extrai data de origem origin_date = self._parse_gmt_date( @@ -288,4 +292,3 @@ def _parse_gmt_date(self, date_str: Optional[str]) -> Optional[str]: except (ValueError, TypeError) as e: logging.warning(f"Failed to parse GMT date '{date_str}': {e}") return None -