From a750f7b8bac1d01429cab5c58113426e1a0fdda9 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 5 Jul 2023 12:18:15 -0500 Subject: [PATCH 1/2] updated get_chart_infos to grab secondary genres --- rymscraper/utils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rymscraper/utils.py b/rymscraper/utils.py index 196a05b..f0450d6 100644 --- a/rymscraper/utils.py +++ b/rymscraper/utils.py @@ -272,6 +272,18 @@ def get_chart_row_infos(row: element.Tag) -> dict: except Exception as e: logger.error("Error when fetching Genres: %s", e) dict_row["Genres"] = "NA" + try: + dict_row["Secondary Genres"] = ", ".join( + [ + x.text + for x in row.find( + "div", {"class": "page_charts_section_charts_item_genres_secondary"} + ).find_all("a", {"class": "genre"}) + ] + ) + except Exception as e: + logger.error("Error when fetching Secondary Genres (Very likely the album doesn't have secondaries.): %s", e) + dict_row["Genres"] = "NA" try: dict_row["RYM Rating"] = row.find( "span", {"class": "page_charts_section_charts_item_details_average_num"} From 3c6986bb3955eee18ada151d77564c0d6962a96c Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 5 Jul 2023 12:48:21 -0500 Subject: [PATCH 2/2] little error fixes and updated get_chart.py --- examples/get_chart.py | 1 + rymscraper/utils.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/get_chart.py b/examples/get_chart.py index 14d5324..b9fd428 100644 --- a/examples/get_chart.py +++ b/examples/get_chart.py @@ -52,6 +52,7 @@ def main(): "Album", "Date", "Genres", + "Secondary Genres", "RYM Rating", "Ratings", "Reviews", diff --git a/rymscraper/utils.py b/rymscraper/utils.py index f0450d6..9a4a055 100644 --- a/rymscraper/utils.py +++ b/rymscraper/utils.py @@ -283,7 +283,7 @@ def get_chart_row_infos(row: element.Tag) -> dict: ) except Exception as e: logger.error("Error when fetching Secondary Genres (Very likely the album doesn't have secondaries.): %s", e) - dict_row["Genres"] = "NA" + dict_row["Secondary Genres"] = "NA" try: dict_row["RYM Rating"] = row.find( "span", {"class": "page_charts_section_charts_item_details_average_num"}