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
yt.video()
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 = 'https://www.youtube.com/watch?v=UzIQOQGKeyI' # (Required)
width = '560' # (Optional)
height = '315' # (Optional)
iframe = yt.video(url, width=width, height=height)
yt.channel()
The channel() function takes a youtube channel link as a string argument. It returns a list of youtube video links.
url = 'https://www.youtube.com/user/ouramazingspace'
videolist = yt.channel(url)
yt.channelDict()
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 = 'https://www.youtube.com/user/ouramazingspace'
videolist = yt.channelDict(url)
videolist['name'] # Name of channel
videolist['videos'] # Nested dictionary. Key = video title, Value = link
yt.getFrames()
The getFrames() function takes a list of youtube videos as a list argument. There are framewidth and frameheight optional arguments, so the size of the iframes can be specified. It returns a list of iframes.
channel = yt.channel('https://www.youtube.com/user/ouramazingspace') # (Required)
framewidth = '560' # (Optional)
frameheight = '315' # (Optional)
iframes = yt.getFrames(channel, framewidth=framewidth, frameheight=frameheight)
Changelog
== 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.