Skip to main content

YouTube video iframe generator

Project description

YT iframe Generator

yt_iframe is a python module which can convert a youtube video link into an embeddable iframe. In order to use this module, install it through your terminal.

foo@bar:~$ pip install yt-iframe

# Import statement
from yt_iframe import yt

Using the module

The video() function takes the youtube video link as a string argument. There are width and height optional arguments, so the size of the iframe can be specified. It returns the iframe as a string.

url = '' # (Required)
width = '560' # (Optional)
height = '315' # (Optional)
iframe =, width=width, height=height)

The channel() function takes a youtube channel link as a string argument. It returns a list of youtube video links.

url = '' # (Required)
videolist =


The channelDict() function takes a youtube channel link as a string argument. It returns a nested dictionary containing the name of the channel, and video titles.

url = ''
videolist = yt.channelDict(url)

videolist['name'] # Name of channel
videolist['videos'] # Nested dictionary. Key = video title, Value = link


The getFrames() function takes a list of youtube videos as a list argument. There are width and height arguments (defaults are 560 and 315 respectively), so the size of the iframes can be specified. There is also a responsive argument (defaults to false) which returns html for responsive iframes. It returns a list of iframes.

channel ='') # (Required)
width = '560' # (Optional)
height = '315' # (Optional)
responsive = True # (Optional)

# Fixed size iframes
iframes = yt.getFrames(channel, width=width, height=height)

# Responsive iframes
iframes = yt.getFrames(channel, responsive=responsive)


The linkResponsive() function returns a line of html which links the stylesheet needed for responsive iframes. Alternatively, you can add this line of html in your head tag. '<link rel="stylesheet" href="">'


The videoResponsive() function is similar to the video() function, except it returns the html for a responsive iframe. In order to use responsive iframes, make sure the css file is linked in the html file with the linkResponsive() function. There are two possible layout options for responsive iframes. singlecolumn takes up 100% the width of the parent element, twocolumn will take up 50% and float left.

url = '' # (Required)
layout = 'singlecolumn' # (Optional)

video = yt.videoResponsive(url, layout=layout) # Get HTML


== v1.0.4 ==

  • Add layout argument to videoResponsive() and getFrames()
  • Add two column layout option to videoResponsive()

== v1.0.3 ==

  • Add responsive iframes
  • getFrames() arguments changed from framewidth and frameheight to width and height

== v1.0.1 ==

  • Allow size of iframe to be specified in video() function
  • Allow sizes of iframes to be specified in getFrames() function

== v1.0.0 ==

  • Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for yt-iframe, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size yt_iframe-1.0.4.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page