0

I am writing a python bot that will send a message to the broadcast chat from my YouTube channel, but after launching an error appears:

<HTTPError 403 when requested https://youtube.googleapis.com/youtube/v3/liveChat/messages?part=id&liveChatId =(here is the chat id)_M&key=AIzaxxxx&alt=json returned "Referrer requests <empty> blocked". Details: "[{'message': 'Referrer requests <empty> are blocked.', 'domain': 'global', 'reason': 'prohibited'}]"> 

Chat ID not found. Please help me, what is the problem

I filled out my API under website restriction, the chat ID specified the correct one.

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
  • it seems like you can't have an empty referer, try something like: `headers = {'referer': 'https://www.yourwebsite.com'}` – Mayfair Apr 30 '23 at 16:28
  • Where should I enter this line? – stackastack222 May 01 '23 at 05:26
  • I don't know what your code looks like, it was an example. Some websites require a referer to be present which is done in the headers of the request. Your error says `Referrer requests blocked` which indicates that is the case here. Maybe look at this answer for a possible solution: https://stackoverflow.com/questions/20837786/changing-the-referer-url-in-python-requests – Mayfair May 01 '23 at 09:00
  • I'm not writing a script for a website, it's just like a bot, but I do not know how to specify a referer in the code, I can send you my code. – stackastack222 May 06 '23 at 06:08
  • ??????????????? – stackastack222 May 10 '23 at 13:31

0 Answers0