Discord Music bot VoiceClient’ object has no attribute ‘create_ytdl_player’

create_ytdl_player was the old way of creating a player. With discord.py@rewrite (> v.1.0), playing music is a bit more complicated. There are two ways to play music. For both ways, using FFmpeg will be necessary, so you’ll have to install it. Here are two of ways to play videos (with youtube-dl and ffmpeg): From file … Read more

Powershell string variable with UTF-8 encoding

For a comprehensive overview of how PowerShell interacts with external programs, which includes sending data to them, see this answer. When PowerShell interprets output from external programs (such as ytd in your case), it assumes that the output uses the character encoding reflected in [Console]::OutputEncoding. Note: Interpreting refers to cases where PowerShell captures (e.g., $output … Read more

Download only audio from youtube video using youtube-dl in python script

Read on in the developer instructions for an amended example: from __future__ import unicode_literals import youtube_dl ydl_opts = { ‘format’: ‘bestaudio/best’, ‘postprocessors’: [{ ‘key’: ‘FFmpegExtractAudio’, ‘preferredcodec’: ‘mp3’, ‘preferredquality’: ‘192’, }], } with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([‘http://www.youtube.com/watch?v=BaW_jenozKc’]) This will download an audio file if possible/supported. If the file is not mp3 already, the downloaded file be … Read more

How to use youtube-dl from a python program?

It’s not difficult and actually documented: import youtube_dl ydl = youtube_dl.YoutubeDL({‘outtmpl’: ‘%(id)s.%(ext)s’}) with ydl: result = ydl.extract_info( ‘http://www.youtube.com/watch?v=BaW_jenozKc’, download=False # We just want to extract the info ) if ‘entries’ in result: # Can be a playlist or a list of videos video = result[‘entries’][0] else: # Just a video video = result print(video) video_url … Read more