Git Product home page Git Product logo

billboard-top-100's People

Contributors

ccfiel avatar cowboysdude avatar darthbatman avatar dependabot[bot] avatar e-e avatar ecbconnors avatar gabe0x02 avatar jasonlaw1994 avatar nechemiaseif1 avatar vcastrejont avatar vedoot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

billboard-top-100's Issues

Follow cb best practice

Good job guys, however, you should follow callback best practice where first argument is error and second is the result.

Getting list from 2 to 100

I am getting list from 2nd to 100 not from 1st and I need from 1st.
Can you please help me for that.

Here is the sample code How I am using this

`
var billboard = require("billboard-top-100").getChart;

billboard('hot-100', function(err, songs) {

    if (err) console.log(err);

    res.end(JSON.stringify(songs));

});

`

add support different charts

Thanks for tool :-) it was very useful. There are more than just 'hot-100' chart and you need just change url suffix.

Templating the current date into the date parameter gives chart not found

Hey, this is a great web scraper to retrieve billboard music chart metadata. Thanks a lot for this service.

I'm getting an error involving the date parameter of getChart(). I have a for loop that loops through 2001 to 2011 and template the current date using a JavaScript object. I then concatenate that together to satisfy the date format YYYY-MM-DD
image
image

(you can ignore addSong)

However, I get this error, saying songs not found
image

After running my server a few more times, I can get the chart data
image

Is there a way to guarantee that getChart() will work all the time? Does getChart() work with await/async?

Thanks for any fixes! :)

Feature addition

Hi, first thank you for making this. It is incredibly useful. Could you add the year in addition to the cover, group, title and rank?

How difficult would it to implement a function to ask for the top-100 of a given year, month or week?

Help needed: How to wait for getChart method to execute its callback?

Hi! I have been using this API for a personal project and I'm kinda stuck in this situation.
Consider the following case

//initialize an empty array
const songTitles = []

//make API call
getChart('hot-100', (err, chart) => {
    if (err) console.log(err);

    //push titles of all songs on the chart to songTitles array
    chart.songs.map(song => {
      songTitles.push(song.title)
    })
});

//log the array
console.log(songs);

An empty array is logged upon executing this piece of code.
So, basically, how do I wait for the callback to mutate the array before it is logged to the console? Any help would be greatly appreciated!

can't parse artist-100

First off - love you. Scraping is a pain, but this is so valuable. If you need help maintaining this, I'd be glad to offer assistance.
And you should be a tip jar at the bottom of the README so I can buy you a coffee ๐Ÿ˜€

But currently seems like artist-100 isn't able to be parsed, as I throw an uncaughtException at the following line:
const d = moment(new Date($('.chart-results') ...

For clarity, here's the exact requestURL: http://www.billboard.com/charts/artist-100/

This happening for you as well? Thanks

Hot 100 is not functional

The HTML for billboard.com's Hot 100 page has changed, and the scraper no longer works for this chart. A user (Gabriel Littman) made a Pull Request here . I tried it out and it does fix the issue (though, like the user said, it may introduce another issue regarding images...not sure).

Rank 1 does not return cover.

Using 2.4.4.

Array returns:

rank: 1,
    title: 'Old Town Road',
    artist: 'Lil Nas X Featuring Billy Ray Cyrus',
    cover: '',
    position: { positionLastWeek: NaN, peakPosition: NaN, weeksOnChart: NaN } },

getting empty array with example code

Hello!

Thanks for creating this package! I've installed the package and copied over the example code but I'm getting an empty array and 'no chart found' message when trying to run the file. Just wondering if anything could have changed that would have effected how .getChart works on billboard's end. Thanks!

Number 1 ranked song is returned twice

Just noticed that billboard chart page was changed again and the first ranked songs appears twice:

  1. In the top of the page (like it was before)
  2. Top of the list which is new :(

An easy fix, though

React cross domain issue corrupted

React cross domain issue corrupted

Dependencies

"dependencies": {
    "billboard-top-100": "^2.5.5",
    "prop-types": "^15.7.2",
    "react": "^16.10.2",
    "react-dom": "^16.10.2",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.2.0",
    "styled-components": "^4.4.0",
    "styled-reset": "^4.0.2"
  },

Code

componentDidMount() {
        try {
            this.setState({ loading: true });
            getChart((err, chart) => {
                if (err) console.log(err);
                else console.log(chart);
            });
        } catch (e) {
            console.log(e);
        } finally {
            this.setState({ loading: false });
        }
    }

Response

TypeError: Failed to fetch

Access to fetch at 'http://www.billboard.com/charts/hot-100/' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

new version 2.4.0 fails reading next week's link

When trying to retrieve current week's list the there is an exception thrown trying to read next week's link.
it files on line 281:
date: $('.dropdown__date-selector-option ')[1].children[1].attribs.href.split('/')[3]
The link does not contain href link because there isn't one :)
The code flies with the following error:

TypeError: Cannot read property 'split' of undefined #

Fetch SSL protocol errors

getting the following console errors when attempting to use getChart function:

Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR
TypeError: Failed to fetch

following from network information on request:
Request URL: https://www.billboard.com:80/charts/hot-100/2021-02-04
Referrer Policy: strict-origin-when-cross-origin

Referer: https:// ***(my site)
sec-ch-ua: "Chromium";v="88", "Google Chrome";v="88", ";Not A Brand";v="99"
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36

note: the function does work locally (https://localhost:3000) using chrome without CORS security

Return the week meta that the results are from

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.

there is no error if chart is missing for given date

I am trying to fetch full history of all charts and call your great function repeatedly (and more important synchronously) with shifted date:

const date = new Date('2016-11-19');
// loop
const formattedDate = format('yyyy-MM-dd', date);
billboard (formattedDate,....)
date.setDate(date.getDate() - 7);
// end of loop

And everything works great but sometimes there is no chart for the given date for some reason. For now billboard function just silently finishes. It would be great to emit some exception or error callback. There is no info that this date should be skipped and it is ok to try to fetch data for the next week.

Hot 100: Top Song is not returned in array

I saw the issue was closed, but I am still getting songs 2->99 chart but not the top song. Here's some code that handles the hot 100 list for getting the top ranked song, haven't tested but should work for most of the other charts as well:
// Rank 1 is a special case that isn't in the list, so grab that separately
const topTrackInfo = $('.chart-number-one__details');
const track = topTrackInfo.children('.chart-number-one__title').text().trim();
const artist = topTrackInfo.children('.chart-number-one__artist').text().trim();
const rank = 1;

Position of an album over the time on chart

Hello!

Can it do smething like mentioned in the topic? I used to use modulo.site API, but not it is deprecated. I am looking for a tool to fetch album positions every time it was on the list with dates of it.

Certain charts breaking because of billboard css redesign

Certain pages like hot-100 and billboard-200 no longer work

I get this error on those pages

TypeError: Cannot read property 'children' of undefined
    at Request._callback (/home/kyler/discordbots/adorabot/node_modules/billboard-top-100/billboard-top-100.js:319:101)
    at Request.self.callback (/home/kyler/discordbots/adorabot/node_modules/request/request.js:185:22)
    at Request.emit (node:events:369:20)
    at Request.<anonymous> (/home/kyler/discordbots/adorabot/node_modules/request/request.js:1154:10)
    at Request.emit (node:events:369:20)
    at IncomingMessage.<anonymous> (/home/kyler/discordbots/adorabot/node_modules/request/request.js:1076:12)
    at /home/kyler/discordbots/adorabot/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:54:19
    at Scope._activate (/home/kyler/discordbots/adorabot/node_modules/dd-trace/packages/dd-trace/src/scope/async_resource.js:53:14)
    at Scope.activate (/home/kyler/discordbots/adorabot/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:12:19)
    at IncomingMessage.bound (/home/kyler/discordbots/adorabot/node_modules/dd-trace/packages/dd-trace/src/scope/base.js:53:20)

That line is this

  chart.week = yyyymmddDateFromMonthDayYearDate($('.chart-detail-header__date-selector-button')[0].children[0].data.replace(/\n/g, ''));

So that jquery selector basically no longer works

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.