darthbatman / billboard-top-100

:chart_with_upwards_trend: Node.js API to retrieve the top songs, albums, and artists from Billboard's charts
MIT License
97 stars 30 forks source link

Return the week meta that the results are from #23

Closed bluetidepro closed 5 years ago

bluetidepro commented 5 years ago

Would it be possible in the getChart function to also return the week that the results are actually from?

For example, if you go to http://www.billboard.com/charts/hot-100/1958-08-23, that August 23rd was in the middle of a week so the site is smart enough to actually give you the results for the week of 1958-08-25 (http://bluetide.pro/gSZvgc).

Would it be possible to just add some of that basic info to the top of the return when you build the array? Maybe some basic info like that "week of" date, and maybe the links for the prev/next week (http://bluetide.pro/2Tpqcr). You could just add selectors for those 3 things and append or prepend the array with that info. Or make an object at the start or finish that has that sorta "meta" data of the query in it.

I think it would be super useful info to have. It would also help be able to programmatically cycle that prev/next week by knowing those dates that the site has. Kinda like a "paging" mechanism you see in most api requests.

darthbatman commented 5 years ago

As of version 2.3.0, getChart returns a chart which contains the array of songs and a week.

darthbatman commented 5 years ago

Next and previous weeks added in version 2.4.0.