Skip to content

Commit

Permalink
remove output messages from yt-dlp
Browse files Browse the repository at this point in the history
  • Loading branch information
iamtalhaasghar committed Jan 28, 2022
1 parent 0357cca commit cdc0f01
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions mps_youtube/pafy.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
from youtubesearchpython import VideosSearch, StreamURLFetcher, Video
from youtubesearchpython import VideosSearch
import yt_dlp

class MyLogger:
def debug(self, msg):
# For compatibility with youtube-dl, both debug and info are passed into debug
# You can distinguish them by the prefix '[debug] '
if msg.startswith('[debug] '):
pass
else:
self.info(msg)

def info(self, msg):
pass

def warning(self, msg):
pass

def error(self, msg):
print(msg)


def get_video_streams(ytid):
with yt_dlp.YoutubeDL() as ydl:
with yt_dlp.YoutubeDL({'logger':MyLogger()}) as ydl:
info_dict = ydl.extract_info(ytid, download=False)
return [i for i in info_dict['formats'] if i['format_note'] != 'storyboard']
def video_search(query):
Expand Down

0 comments on commit cdc0f01

Please sign in to comment.