Ver Fonte

Fix bug in adding producers

Colin Powell há 2 anos atrás
pai
commit
59d652a9c4
2 ficheiros alterados com 3 adições e 3 exclusões
  1. 1 1
      vrobbler/apps/podcasts/models.py
  2. 2 2
      vrobbler/apps/podcasts/scrapers.py

+ 1 - 1
vrobbler/apps/podcasts/models.py

@@ -50,7 +50,7 @@ class Podcast(TimeStampedModel):
             podcast_dict = scrape_data_from_google_podcasts(self.name)
             if podcast_dict:
                 if not self.producer:
-                    self.producer = Producer.objects.get_or_create(
+                    self.producer, created = Producer.objects.get_or_create(
                         name=podcast_dict["producer"]
                     )
                 self.description = podcast_dict.get("description")

+ 2 - 2
vrobbler/apps/podcasts/scrapers.py

@@ -35,7 +35,7 @@ def get_url_from_soup(soup) -> Optional[int]:
     return url
 
 
-def get_publisher_from_soup(soup) -> str:
+def get_producer_from_soup(soup) -> str:
     pub = ""
     try:
         potential_pub = soup.find("div", class_="J3Ov7d")
@@ -79,7 +79,7 @@ def scrape_data_from_google_podcasts(title) -> dict:
         soup = BeautifulSoup(r.text, "html")
         data_dict["title"] = get_title_from_soup(soup)
         data_dict["description"] = get_description_from_soup(soup)
-        data_dict["publisher"] = get_publisher_from_soup(soup)
+        data_dict["producer"] = get_producer_from_soup(soup)
         data_dict["url"] = get_url_from_soup(soup)
         data_dict["image_url"] = get_img_url_from_soup(soup)
     return data_dict