Fix bug in adding producers

This commit is contained in:
2023-03-22 23:49:40 -04:00
parent 945776b885
commit 59d652a9c4
2 changed files with 3 additions and 3 deletions

View File

@ -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")

View File

@ -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