matthieugrieger / mumbledj

A Mumble bot that plays audio fetched from various media sites.
MIT License
170 stars 59 forks source link

MumbleDJ does not have a valid YouTube API key. #84

Closed satinez closed 8 years ago

satinez commented 9 years ago

Hello guys (:

Im getting the Info from the Bot in the mumble chat. Bot is working great. I have registred 2 APIs, 1 very fresh tonight but still I get this warning :(

Im using Ubuntu 15.04

What im doing wrong?

greet;s satinez

matthieugrieger commented 9 years ago

Hi!

Did you export your new API key in ~/.bashrc?

satinez commented 9 years ago

Hello :) Sure I did :( Deleted the key, regenerated the key

matthieugrieger commented 9 years ago

Hmm. Might be an environment issue then.

Do you happen to be running/starting the bot via a cron job, an upstart service, or something similar?

satinez commented 9 years ago

No, just started directly from console. Maybe something wrong with GOLANG.

matthieugrieger commented 9 years ago

I don't think it has to do with Golang.

Please read through the following piece of README and let me know if you're sure you followed each step exactly: https://github.com/matthieugrieger/mumbledj#youtube-api-keys

satinez commented 9 years ago

Good Morning :dancer:

Yes i followed the tutorial and created the key successfully. No error in console, only just the info text in chat.

matthieugrieger commented 9 years ago

Hmm, strange. To be honest I'm not quite sure what the issue is here.

You will receive that chat message when the YouTube API responds with a 403 error. A 403 error corresponds with not having permission to view whatever you are requesting.

Are you running the bot through a server provider or just on your own machine? In the past there has been issues with specific hosting providers.

satinez commented 9 years ago

Well I tested this with my Linux machine at home also. The real server its a dedicated Server, Hosted by Hetzner.de, no managed server, i have full control, so it must be something :(

Bot works fine, fast and so, but dont accept add command :(

greet;s satinez

satinez commented 9 years ago

Ok

  1. Clean Server install Debian 8.1 64bit
  2. Added a new google account, created a new clean Youttube API key.
  3. Followed the MumbleDJ tutorial

BOT connects fine, no errors, no fails. But im getting the same error.

greet;s satinez

MichaelOultram commented 9 years ago

I'm guessing the issue is with youtube-dl, but the bot doesn't print out a useful message. Maybe try downloading a sample song via youtube-dl (I just picked the top song for the UK) youtube-dl --verbose --no-mtime --output ~/.mumbledj/songs/vjW8wmF5VWc.m4a --format m4a vjW8wmF5VWc and see what error it produces (if any)?

satinez commented 9 years ago

Hmmmmmmmmmmm :(

youtube-dl --verbose --no-mtime --output ~ /.mumbledj/songs/vjW8wmF5VWc.m4a --format m4a vjW8wmF5VWc [debug] System config: [] [debug] User config: [u'--force-ipv4', u'--extract-audio', u'--no-mtime'] [debug] Command-line args: [u'--verbose', u'--no-mtime', u'--output', u'/root/.m umbledj/songs/vjW8wmF5VWc.m4a', u'--format', u'm4a', u'vjW8wmF5VWc'] [debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2015.09.03 [debug] Python version 2.7.9 - Linux-3.19.0-25-generic-x86_64-with-Ubuntu-15.04- vivid [debug] exe versions: ffmpeg 2.5.8-0ubuntu0.15.04.1, ffprobe 2.5.8-0ubuntu0.15.0 4.1 [debug] Proxy map: {} [youtube] vjW8wmF5VWc: Downloading webpage [youtube] vjW8wmF5VWc: Downloading video info webpage ERROR: vjW8wmF5VWc: YouTube said: Unfortunately, this video is not available in your country because it could contain music, for which we could not agree on con ditions of use with GEMA. Traceback (most recent call last): File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 655, in extract _info ie_result = ie.extract(url) File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 287, in extract return self._real_extract(url) File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 1078, i n _real_extract expected=True, video_id=video_id) ExtractorError: vjW8wmF5VWc: YouTube said: Unfortunately, this video is not avai lable in your country because it could contain music, for which we could not agr ee on conditions of use with GEMA.

matthieugrieger commented 9 years ago

Ah.. This would explain it. Based on the domain name of your server provider, do you live in Germany?

Unfortunately there is not much we can do about this issue. I will keep this case in mind though, and try to show more descriptive errors when an issue like this occurs. I'm currently working on a refactor of the code.

MichaelOultram commented 9 years ago

Silly me, I didn't think about regions. Maybe try replacing the video id with one that works in your/the servers country? On 6 Sep 2015 4:48 am, "Matthieu Grieger" notifications@github.com wrote:

Ah.. This would explain it. Based on the domain name of your server provider, do you live in Germany?

— Reply to this email directly or view it on GitHub https://github.com/matthieugrieger/mumbledj/issues/84#issuecomment-138038927 .

satinez commented 9 years ago

Thanks. I dont understand. The server is in germany, yes. If i take another youtube file, it works very well on console. Some not working, thats ok cuz of region.

But the MumbleDJ Bot say me to every YT link : MumbleDJ does not have a valid YouTube API key. :(

MichaelOultram commented 9 years ago

Ah okay. If youtube-dl can download a video, then it must be the bot.

Just a last check before I have now clue what it is. Can you make sure that echo $YOUTUBE_API_KEY prints out the API key? And make sure that you are not running the bot with sudo.

satinez commented 9 years ago

Yes the YoutubeKey shows fine, stored fine in the .bashrc.

I installed the server about 10 times :(

MichaelOultram commented 9 years ago

Can you try navigating to this page to check whether youtube is happy with your API key: https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails&id=OglS3Q0Zxik&key=<YOUTUBE_API_KEY>, replacing <YOUTUBE_API_KEY> with your API key.

satinez commented 9 years ago

I also tried with another key and another gmail account :(

{ "error": { "errors": [ { "domain": "usageLimits", "reason": "keyExpired", "message": "Bad Request" } ], "code": 400, "message": "Bad Request" } }

{ "kind": "youtube#videoListResponse", "etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/41bmv8-lVLCK5FrwbR5itaT2Ss4\"", "pageInfo": { "totalResults": 1, "resultsPerPage": 1 }, "items": [ { "kind": "youtube#video", "etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/YiR0fJRBVOz8HgAhZ_3XxAwDu5A\"", "id": "OglS3Q0Zxik", "snippet": { "publishedAt": "2013-08-20T17:41:57.000Z", "channelId": "UCmv1CLT6ZcFdTJMHxaR9XeA", "title": "[Official Video] Can't Hold Us - Pentatonix (Macklemore & Ryan Lewis cover)", "description": "2015 TOUR DATES (CITIES & VENUES LISTED BELOW) -- http://ptxofficial.com/tour\nBUY THAT’S CHRISTMAS TO ME http://smarturl.it/PTXtctmiT?iqiD=YT \nBUY PTX VOL III http://smarturl.it/PTXVol3?IQId=yt | BUY PTXMAS http://smarturl.it/PTXmas?IQId=yt | BUY PTX VOL I http://smarturl.it/PTXVol1?IQid=yt | BUY PTX VOL II http://smarturl.it/PTXVolume2?IQid=yt\n\nSTREAM THAT’S CHRISTMAS TO ME http://smarturl.it/PTXmasSp?iqiD=YT\nSTREAM PTX VOL III ON SPOTIFY: http://smarturl.it/PTXVol3Spot?IQid=yt\nSTREAM PTXMAS http://smarturl.it/PTXmas1Sp?IQid=yt | STREAM PTX VOL I http://smarturl.it/PTXV1Spotify?IQid=yt | STREAM PTX VOL II http://smarturl.it/PTXV2Spotify?IQid=yt\n\nJoin our Patreon Fan Page!! http://www.patreon.com/pentatonix\n\n\n2015 ON MY WAY HOME TOUR DATES\n5/28 - Seoul, KR | Olympic Hall\n5/30 - Kuala Lumpur, MY | Stadium Negara\n6/01 - Singapore, SG | The Star Vista\n6/03 - Jakarta, ID | Balai Kartini Expo - SOLD OUT!\n6/04 - Jakarta, ID | Tennis Indoor Senaya\n6/06 - Manila, PH | Araneta Coliseum\n6/07 - Cebu, PH | Waterfront Hotel and Casino\n6/09 - Tokyo, JP | Zepp DiverCity\n6/10 - Tokyo, JP | Zepp DiverCity - SOLD OUT!\n6/11 - Tokyo, JP | Zepp DiverCity - SOLD OUT!\n6/13 - Nagoya, JP | Zepp Nagoya - SOLD OUT!\n6/15 - Fukuoka, JP | Zepp Fukuoka\n6/16 - Osaka, JP | Zepp Osaka\n\n____\n\nPIECE BY PIECE TOUR DATES WITH KELLY CLARKSON\n7/11/15 – Hershey, PA | Hershey Park Stadium \n7/12/15 – Mansfield, MA | Xfinity Center\n7/14/15 – Holmdel, NJ | PNC Bank Arts Center\n7/16/15 – New York, NY | Radio City Music Hall\n7/19/15 – Pittsburgh, PA | First Niagra Pavilion\n7/21/15 – Darien Lake, NY | Darien Lake Performing Arts Center\n7/23/15 – Uncasville, CT | Mohegan Sun\n7/25/15 – Toronto, ON | Molson Canadian Amphitheatre\n7/26/15 – Clarkston, MI | DTE Energy Music Theatre\n7/28/15 – Cincinnati, OH | Riverbend Music Center\n7/30/15 – Indianapolis, IN | Klipsch Music Center\n8/01/15 – Rosemont, IL | Allstate Arena\n8/02/15 – St. Louis, MO | Hollywood Casino Amphitheatre\n8/04/15 – St. Paul, MN | Xcel Center\n8/06/15 – Denver, CO | Pepsi Center\n8/08/15 – Salt Lake City, UT | USANA Amphitheatre\n8/10/15 – Portland, OR | Moda Center\n8/12/15 – Seattle, WA | Key Arena\n8/15/15 – Las Vegas, NV | Mandalay Bay\n8/16/15 – San Diego, CA | Viejas Arena\n8/19/15 – Los Angeles, CA | Staples Center\n8/21/15 – Wheatland, CA | Toyota Amphitheatre\n8/23/15 – Mountain View, CA | Shoreline Amphitheatre\n8/25/15 – Phoenix, AZ | AK-Chin Amphitheatre\n8/27/15 – Albuquerque, NM | Isleta Amphitheatre\n8/29/15 – Austin, TX | Austin 360 Amphitheatre\n8/30/15 – Dallas, TX | Gexa Energy Pavilion\n9/01/15 – Houston, TX | Cynthia Woods Mitchell Pavilion\n9/03/15 – Little Rock, AR | Verizon Arena\n9/05/15 – Nashville, TN | Bridgestone Arena\n9/10/15 – Atlanta, GA | Aaron’s Amphitheatre at Lakewood\n9/12/15 – Vienna, VA | Wolftrap\n9/13/15 – Vienna, VA | Wolftrap - GA SOLD OUT!\n9/15/15 – Tampa, FL | Mid Florida Credit Amphitheatre\n9/17/15 – West Palm Beach, FL | Coral Sky Amphitheatre\n9/19/15 – Raleigh, NC | Walnut Creek Amphitheatre\n9/20/15 – Camden, NJ | Susquehanna Bank Arts Center\nhttp://www.ptxofficial.com\nhttp://www.twitter.com/ptxofficial @ptxofficial\nhttp://www.facebook.com/Pentatonix", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/OglS3Q0Zxik/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/OglS3Q0Zxik/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/OglS3Q0Zxik/hqdefault.jpg", "width": 480, "height": 360 }, "standard": { "url": "https://i.ytimg.com/vi/OglS3Q0Zxik/sddefault.jpg", "width": 640, "height": 480 }, "maxres": { "url": "https://i.ytimg.com/vi/OglS3Q0Zxik/maxresdefault.jpg", "width": 1280, "height": 720 } }, "channelTitle": "PTXofficial", "tags": [ "Pentatonix", "Penatonix", "PTX", "PTXofficial", "Mitch Grassi", "Kirstie Maldonado", "Scott Hoying", "Avi Kaplan", "Kevin", "Olusola", "K-O.", "Cello", "Cellobox", "Beatbox", "A Cappella", "Harmony", "Acapella", "Acappela", "Choir", "Singing Competition", "The Sing-Off", "Sing-Off", "Reality TV", "Sing", "Singing", "Chorus", "Sara Bareilles", "Shawn Stockman", "Ben Folds", "Ben Folds 5", "American Idol", "X-Factor", "The Voice", "Voice", "Pitch Perfect" ], "categoryId": "10", "liveBroadcastContent": "none", "localized": { "title": "[Official Video] Can't Hold Us - Pentatonix (Macklemore & Ryan Lewis cover)", "description": "2015 TOUR DATES (CITIES & VENUES LISTED BELOW) -- http://ptxofficial.com/tour\nBUY THAT’S CHRISTMAS TO ME http://smarturl.it/PTXtctmiT?iqiD=YT \nBUY PTX VOL III http://smarturl.it/PTXVol3?IQId=yt | BUY PTXMAS http://smarturl.it/PTXmas?IQId=yt | BUY PTX VOL I http://smarturl.it/PTXVol1?IQid=yt | BUY PTX VOL II http://smarturl.it/PTXVolume2?IQid=yt\n\nSTREAM THAT’S CHRISTMAS TO ME http://smarturl.it/PTXmasSp?iqiD=YT\nSTREAM PTX VOL III ON SPOTIFY: http://smarturl.it/PTXVol3Spot?IQid=yt\nSTREAM PTXMAS http://smarturl.it/PTXmas1Sp?IQid=yt | STREAM PTX VOL I http://smarturl.it/PTXV1Spotify?IQid=yt | STREAM PTX VOL II http://smarturl.it/PTXV2Spotify?IQid=yt\n\nJoin our Patreon Fan Page!! http://www.patreon.com/pentatonix\n\n\n2015 ON MY WAY HOME TOUR DATES\n5/28 - Seoul, KR | Olympic Hall\n5/30 - Kuala Lumpur, MY | Stadium Negara\n6/01 - Singapore, SG | The Star Vista\n6/03 - Jakarta, ID | Balai Kartini Expo - SOLD OUT!\n6/04 - Jakarta, ID | Tennis Indoor Senaya\n6/06 - Manila, PH | Araneta Coliseum\n6/07 - Cebu, PH | Waterfront Hotel and Casino\n6/09 - Tokyo, JP | Zepp DiverCity\n6/10 - Tokyo, JP | Zepp DiverCity - SOLD OUT!\n6/11 - Tokyo, JP | Zepp DiverCity - SOLD OUT!\n6/13 - Nagoya, JP | Zepp Nagoya - SOLD OUT!\n6/15 - Fukuoka, JP | Zepp Fukuoka\n6/16 - Osaka, JP | Zepp Osaka\n\n____\n\nPIECE BY PIECE TOUR DATES WITH KELLY CLARKSON\n7/11/15 – Hershey, PA | Hershey Park Stadium \n7/12/15 – Mansfield, MA | Xfinity Center\n7/14/15 – Holmdel, NJ | PNC Bank Arts Center\n7/16/15 – New York, NY | Radio City Music Hall\n7/19/15 – Pittsburgh, PA | First Niagra Pavilion\n7/21/15 – Darien Lake, NY | Darien Lake Performing Arts Center\n7/23/15 – Uncasville, CT | Mohegan Sun\n7/25/15 – Toronto, ON | Molson Canadian Amphitheatre\n7/26/15 – Clarkston, MI | DTE Energy Music Theatre\n7/28/15 – Cincinnati, OH | Riverbend Music Center\n7/30/15 – Indianapolis, IN | Klipsch Music Center\n8/01/15 – Rosemont, IL | Allstate Arena\n8/02/15 – St. Louis, MO | Hollywood Casino Amphitheatre\n8/04/15 – St. Paul, MN | Xcel Center\n8/06/15 – Denver, CO | Pepsi Center\n8/08/15 – Salt Lake City, UT | USANA Amphitheatre\n8/10/15 – Portland, OR | Moda Center\n8/12/15 – Seattle, WA | Key Arena\n8/15/15 – Las Vegas, NV | Mandalay Bay\n8/16/15 – San Diego, CA | Viejas Arena\n8/19/15 – Los Angeles, CA | Staples Center\n8/21/15 – Wheatland, CA | Toyota Amphitheatre\n8/23/15 – Mountain View, CA | Shoreline Amphitheatre\n8/25/15 – Phoenix, AZ | AK-Chin Amphitheatre\n8/27/15 – Albuquerque, NM | Isleta Amphitheatre\n8/29/15 – Austin, TX | Austin 360 Amphitheatre\n8/30/15 – Dallas, TX | Gexa Energy Pavilion\n9/01/15 – Houston, TX | Cynthia Woods Mitchell Pavilion\n9/03/15 – Little Rock, AR | Verizon Arena\n9/05/15 – Nashville, TN | Bridgestone Arena\n9/10/15 – Atlanta, GA | Aaron’s Amphitheatre at Lakewood\n9/12/15 – Vienna, VA | Wolftrap\n9/13/15 – Vienna, VA | Wolftrap - GA SOLD OUT!\n9/15/15 – Tampa, FL | Mid Florida Credit Amphitheatre\n9/17/15 – West Palm Beach, FL | Coral Sky Amphitheatre\n9/19/15 – Raleigh, NC | Walnut Creek Amphitheatre\n9/20/15 – Camden, NJ | Susquehanna Bank Arts Center\nhttp://www.ptxofficial.com\nhttp://www.twitter.com/ptxofficial @ptxofficial\nhttp://www.facebook.com/Pentatonix" } }, "contentDetails": { "duration": "PT4M9S", "dimension": "2d", "definition": "hd", "caption": "false", "licensedContent": false } } ] }

MichaelOultram commented 9 years ago

Well I guess we worked out what the issue is, but I'm not sure how to solve it. Maybe you should wait 5 to 10 minutes between creating the key and using it? Google is seemingly slow to update to API key changes.

satinez commented 9 years ago

Yes I have tried that :( Same error :(

Can someone provide a dependency list for the whole application? Maybe something is missing.

MichaelOultram commented 9 years ago

Whatever key you used to produce the second output starting with the following is a valid key (and should work in the bot)

{
"kind": "youtube#videoListResponse",
"etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/41bmv8-lVLCK5FrwbR5itaT2Ss4\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},

If not however, the full dependency (or at least what I had to install to make the bot work):

matthieugrieger commented 9 years ago

Thanks for all the help @MichaelOultram.

Yes, the dependencies need to be a bit more clear in the README. I am currently working on a rewrite and will hopefully have an easier installation process set up, but I will update the README in the meantime.

The error messaging is one of the bigger problems with the current code. They aren't very descriptive, and sometimes just plain wrong. I am hoping to fix this and also add the option for verbose logging to help narrow down issues like these.

RCambier commented 8 years ago

I don't know if it's related, but I had the same problem and I solved it by using a browser api key instead of a server api key. It now works !

matthieugrieger commented 8 years ago

Closing due to inactivity. @satinez, let me know if you are still having issues and I will reopen.