Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added similar artists property to bands #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

msanlop
Copy link

@msanlop msanlop commented Jan 16, 2022

Sorry for resubmiting I just learned that github only allows 1 account and ppl got banned so I wanna play it safe.

  • Added similar artists property that fetches the Similar Artists tab on a band's page.

  • Also added an example in the README.

  • commented requests_cache.core, doesn't exist (?!)

Usage preview:

bands = metallum.band_search('metallica')
band = bands[0].get()

metallica_sa = band.similar_artists
# -> <SimilarArtists: Megadeth (490) | Testament (415) | Exodus (212) | Evile (206) | Anthrax (184) | Death Angel (149) | Diamond Head (119) | Xentrix (114) | Annihilator (110) | Newsted (108) | Heathen (106) | Metal Church (105) | Flotsam and Jetsam (103) | Slayer (71) | Trivium (70) | Overkill (66) | Artillery (58) | Mortal Sin (58) | Volbeat (55) | Sacred Reich (50)>

metallica_sa[0]
# -> <SimilarArtist: Megadeth | United States | Speed/Thrash Metal (early/later); Heavy Metal/Rock (mid) | 490 >

metallica_sa[0].id
# -> '138'

metallica_sa[0].score
# -> 490

metallica_sa[0].genres
# -> ['Speed/Thrash Metal (early/later)', 'Heavy Metal/Rock (mid)']

metallica_sa[0].get()
#-> <Band: Megadeth>

#btw it would make more sense to pass id and append to endpoing in Band's __init__() I think 
band_without_sa = metallum.Band('/bands/_/3540496252') 
# -> <SimilarArtists: None>

This only gets the first 'batch', I'll probably add the option to get the 'see more' bands when I get the time.
Cheers

PS: I had to comment out 2 lines with requests_cache.core because it doesn't seem to work for me idk... I submitted an issue. And some of the tests are outdated with the data on the site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant