YT iframe Generator
yt_iframe is a python module which can convert a youtube video link into an embeddable iframe.
Getting started
In order to use this module, install it through your terminal.
foo@bar:~$ pip install yt-iframe
Import the module in Python.
from yt_iframe import yt
Using the module
yt.video()
Generates a YouTube embed video iFrame from a YouTube video link.
url = 'https://www.youtube.com/watch?v=UzIQOQGKeyI' # (Required)
width = '560' # (Optional)
height = '315' # (Optional)
iframe = yt.video(url, width=width, height=height)
Parameters
- link : str (required)
- A link to a YouTube video.
- width : str (optional. default="560")
- The width of the iFrame in pixels.
- height : str (optional. default="315")
- The height of the iFrame in pixels.
Returns
- html : str
- The iFrame for the YouTube video.
yt.channel()
Generates a list of YouTube video links from a YouTube channel.
url = 'https://www.youtube.com/user/ouramazingspace' # (Required)
videolist = yt.channel(url)
Parameters
- link : str (required)
- A link to a YouTube channel.
Returns
- links : list
- A list of links to YouTube videos.
yt.channelDict()
Generates videos and metadata from a YouTube channel.
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
Parameters
- link : str (required)
- A link to a YouTube channel.
Returns
- channel : dict
- A dictionary of the YouTube channel's information.
- Key/value pairs:
- name = the name of the YouTube channel
- videos = List of video links
yt.getFrames()
Generates a list of iFrames from a list of YouTube videos.
channel = yt.channel('https://www.youtube.com/user/ouramazingspace') # (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)
Parameters
- links : list (required)_
- A list of links to YouTube videos.
- width : str (optional. default="560")
- The width of each iFrame in pixels.
- height : str (optional. default="315")
- The height of each iFrame in pixels.
- responsive : bool (optional. default = False)
- Determines whether each iFrame is dynamically or statically sized.
Returns
- iframes : list
- List of iFrames.
yt.linkResponsive()
Get link to css for styling the iFrames. Alternatively, you can add this line of html in your head tag. ''
Returns
- str
- HTML link tag to import css for iFrames
yt.videoResponsive()
Generates a responsive iFrame video. Make sure you have the css file imported with the linkResponsive() function. You can wrap a bunch of these generated tags in a container and the iFrames will resize to fit the layout within that container.
url = 'https://www.youtube.com/watch?v=UzIQOQGKeyI' # (Required)
layout = 'singlecolumn' # (Optional)
video = yt.videoResponsive(url, layout=layout) # Get HTML
Parameters
- link : str (required)
- A link to a YouTube video.
- layout : str (optional. default="onecolumn")
- Soecifies the relative size of the iFrame.
- Acceptable values:
- 'onecolumn' - Generates one column layout
- 'twocolumn' - Generates two column video
Returns
- iframes : list
- List of iFrames.
Changelog
== v1.0.5 ==
- Fix css import link
- Fix argument error in videoResponsive()
- Fix xml parsing (the lxml dependency issue)
- Add docstrings for all functions
- Refactor functions to improve readability
== 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
Metadata
Release files for yt-iframe 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| yt_iframe-1.0.5.tar.gz | 7.3 kB | Without provenance | Details |
Release files / yt_iframe-1.0.5.tar.gz
| Download URL | yt_iframe-1.0.5.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
635524e0929702edf00d98832740b83b156a0be915652f722652a95db28266bf
|
|
BLAKE2b-256 checksum How to use checksums |
024aa6765864e56e967b99203c484fb1d71a6728dc97ea7a8907d090e16faf8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
|
Security for yt-iframe 1.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.