From 59d652a9c43fcc74e5558797640f493284eda9f5 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 22 Mar 2023 23:49:40 -0400 Subject: [PATCH] Fix bug in adding producers --- vrobbler/apps/podcasts/models.py | 2 +- vrobbler/apps/podcasts/scrapers.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vrobbler/apps/podcasts/models.py b/vrobbler/apps/podcasts/models.py index 98ff149..8e9cd34 100644 --- a/vrobbler/apps/podcasts/models.py +++ b/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") diff --git a/vrobbler/apps/podcasts/scrapers.py b/vrobbler/apps/podcasts/scrapers.py index 679d914..87c2aa2 100644 --- a/vrobbler/apps/podcasts/scrapers.py +++ b/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