guoguo12 / billboard-charts

Python API for downloading Billboard charts.
https://pypi.python.org/pypi/billboard.py
MIT License
389 stars 117 forks source link

403 Client Error: Forbidden for url #57

Closed juliancamp closed 5 years ago

juliancamp commented 5 years ago

A 403 Client Error: Forbidden for url is thrown in billboard.py.

Error occurs at self.fetchEntries() at line 152.

Error occurs at line 199 inside the fetchEntries function.

line 199: req = requests.get(url, timeout=self._timeout)

This error most likely occurs because billboard added some kind of new scraping safeguard.

The way I got around this was by changing the Headers User Agent to this:

'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36'

It's the latest User Agent for Chrome. It should solve any problems having to do with a 403 Client Error: Forbidden for url.

guoguo12 commented 5 years ago

Thanks! This should have already been fixed in the latest version (5.2.2). Does that version not work for you?

juliancamp commented 5 years ago

I'm sorry, I was still on 5.0.2. My fault. I just updated to the latest version (5.2.2) and it works perfectly. Thanks for creating and keeping this project up to date! I really appreciate all the time and work you put in. Let me know if you ever need any help.

abigailrose commented 4 years ago

I'm having this error with billboard 5.3.0 and Python 3.6

emo-eth commented 4 years ago

I'm having this error with billboard 5.3.0 and Python 3.6

I was able to grab the hot-100 chart on my machine with billboard 5.3.0 and python 3.7.1. It could be a couple things: Have you been grabbing a lot of chart data recently? It could be some sort of IP filtering on Billboard's end. Alternatively, double check that the pip you're using to install is the pip bundled with python 3, and not some version of python 2 (or other installed python). It could be installing the latest billboard for the wrong python. Aside from that, I'm not too sure what the issue could be without reproducing it locally.