Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python3
- from __future__ import unicode_literals
- import youtube_dl
- import pprint
- class MyLogger(object):
- def debug(self, msg):
- pass
- def warning(self, msg):
- pass
- def error(self, msg):
- print(msg)
- ydl_opts = {'logger': MyLogger(),}
- with youtube_dl.YoutubeDL(ydl_opts) as ydl:
- result = ydl.extract_info('https://www.youtube.com/watch?v=uD96pR-fqeM', download = False)
- #pprint.pprint (result)
- print (result["thumbnail"])
- print (result["title"])
- filtered = []
- for f in result["formats"]:
- if f["acodec"] != "none" and 'abr' in f:
- filtered.append(f)
- #print (f["format"], f["acodec"], f["abr"], f["ext"])
- #pprint.pprint (filtered)
- for f in filtered:
- print (f["format"], f["acodec"], f["abr"], f["ext"])
- #!/usr/bin/python3
- """
- Hello World, but with more meat.
- """
- import wx
- class MainFrame(wx.Frame):
- """
- A Frame that says Hello World
- """
- def __init__(self, *args, **kw):
- # ensure the parent's __init__ is called
- super(MainFrame, self).__init__(*args, **kw)
- # create a panel in the frame
- pnl = wx.Panel(self)
- # create input line
- url_label = wx.StaticText(pnl, label="URL:", pos=(10,8))
- url = wx.TextCtrl(pnl, pos=(45,3), size=(495,-1))
- url_submit = wx.Button(pnl, label="Load", pos=(550,0))
- url_submit.Bind(wx.EVT_BUTTON, self.OnGetVideoInfo)
- # create a menu bar
- self.makeMenuBar()
- # and a status bar
- self.CreateStatusBar()
- self.SetStatusText("Idle!")
- # move to the center of screen
- self.Centre()
- def makeMenuBar(self):
- """
- A menu bar is composed of menus, which are composed of menu items.
- This method builds a set of menus and binds handlers to be called
- when the menu item is selected.
- """
- # Make a file menu with Hello and Exit items
- fileMenu = wx.Menu()
- # The "\t..." syntax defines an accelerator key that also triggers
- # the same event
- helloItem = fileMenu.Append(-1, "&Hello...\tCtrl-H",
- "Help string shown in status bar for this menu item")
- fileMenu.AppendSeparator()
- # When using a stock ID we don't need to specify the menu item's
- # label
- exitItem = fileMenu.Append(wx.ID_EXIT)
- # Now a help menu for the about item
- helpMenu = wx.Menu()
- aboutItem = helpMenu.Append(wx.ID_ABOUT)
- # Make the menu bar and add the two menus to it. The '&' defines
- # that the next letter is the "mnemonic" for the menu item. On the
- # platforms that support it those letters are underlined and can be
- # triggered from the keyboard.
- menuBar = wx.MenuBar()
- menuBar.Append(fileMenu, "&File")
- menuBar.Append(helpMenu, "&Help")
- # Give the menu bar to the frame
- self.SetMenuBar(menuBar)
- # Finally, associate a handler function with the EVT_MENU event for
- # each of the menu items. That means that when that menu item is
- # activated then the associated handler function will be called.
- self.Bind(wx.EVT_MENU, self.OnHello, helloItem)
- self.Bind(wx.EVT_MENU, self.OnExit, exitItem)
- self.Bind(wx.EVT_MENU, self.OnAbout, aboutItem)
- def OnExit(self, event):
- """Close the frame, terminating the application."""
- self.Close(True)
- def OnHello(self, event):
- """Say hello to the user."""
- wx.MessageBox("Hello again from wxPython")
- def OnAbout(self, event):
- """Display an About Dialog"""
- wx.MessageBox("This is a wxPython Hello World sample",
- "About Hello World 2",
- wx.OK|wx.ICON_INFORMATION)
- def OnGetVideoInfo(self, event):
- wx.MessageBox("Placeholder")
- if __name__ == '__main__':
- # When this module is run (not imported) then create the app, the
- # frame, show it, and start the event loop.
- app = wx.App()
- frm = MainFrame(None, title='Youtube Donloader',size=(640, 480))
- frm.Show()
- app.MainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement