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 196a05b..9a4a055 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["Secondary Genres"] = "NA" try: dict_row["RYM Rating"] = row.find( "span", {"class": "page_charts_section_charts_item_details_average_num"}