Libsyn podcast API
Project description
Libpyn
======
> A third-party API for **libsyn**.
___
Installation
------------
In order to install _libpyn_, run this command on the terminal
``` console
foo@bar:~$ pip install libpyn
```
___
Features
--------
* ### The Podcast class <a name="podcast-class"></a>
The _Podcast class_ is the main feature of this package.
``` python
# Import statement
from libpyn.podcast import Podcast
```
In order to create an instance of the Podcast class, pass a link to a _libsyn_ channel in with the instance declaration.
``` python
channel = 'https://therabbithole.libsyn.com/'
example = Podcast(channel)
```
Once initialized, the Podcast class contains useful information about the podcast.
``` python
example.name = # Name of the podcast channel
self.mp3list = # List of episodes, each episode saved as a dictionary
self.htmllink = # Link to the podcast's website
```
Each dictionary in _self.mp3list_ contains these key/value pairs:
``` python
podcast = {} # Dictionary for storing podcast info
podcast['title'] = # Name of episode
podcast['date'] = # Publish date
podcast['mp3'] = # Link to mp3 file
podcast['image'] = # Channel logo
```
* ### Downloading podcasts
In order to download the mp3 files of a podcast channel, use the **download()** function.
``` python
# This will download the mp3 files in a directory named after the podcast channel
# in the Downloads directory
example.download()
```
A specific _path_ can be specified, the name of the directory (_foldername_) in which the mp3 files will be stored can also be specified. If the foldername is not specified, it will be the name of the channel. (Spaces are replaced with underscores.)
``` python
path = 'path/to/store/mp3'
directory = '/files'
example.download(path=path, foldername=directory)
```
* ### iframes
In order to get iframes of the latest episodes to embed on a webpage, use the **iframes()** function.
It returns a dictionary where the key is the title of the episode (if one is present) and the value is the iframe (if iframes are present).
``` python
iframesList = example.iframes()
```
___
Changelog
---------
### == v1.0.3 ==
* _iframes function only runs if iframes are present_
* _iframes function generates titles when there is no title given_
### == v1.0.2 ==
* _iframes now returns a dictionary. (key = Title, value = iframe)_
### == v1.0.1 ==
* _Fix bugs involving download function_
* _Remove HTML tags from podcast.name attribute_
* _Fix logger, log always in same directory as podcast.py_
### == v1.0.0 ==
* _Initial release_
======
> A third-party API for **libsyn**.
___
Installation
------------
In order to install _libpyn_, run this command on the terminal
``` console
foo@bar:~$ pip install libpyn
```
___
Features
--------
* ### The Podcast class <a name="podcast-class"></a>
The _Podcast class_ is the main feature of this package.
``` python
# Import statement
from libpyn.podcast import Podcast
```
In order to create an instance of the Podcast class, pass a link to a _libsyn_ channel in with the instance declaration.
``` python
channel = 'https://therabbithole.libsyn.com/'
example = Podcast(channel)
```
Once initialized, the Podcast class contains useful information about the podcast.
``` python
example.name = # Name of the podcast channel
self.mp3list = # List of episodes, each episode saved as a dictionary
self.htmllink = # Link to the podcast's website
```
Each dictionary in _self.mp3list_ contains these key/value pairs:
``` python
podcast = {} # Dictionary for storing podcast info
podcast['title'] = # Name of episode
podcast['date'] = # Publish date
podcast['mp3'] = # Link to mp3 file
podcast['image'] = # Channel logo
```
* ### Downloading podcasts
In order to download the mp3 files of a podcast channel, use the **download()** function.
``` python
# This will download the mp3 files in a directory named after the podcast channel
# in the Downloads directory
example.download()
```
A specific _path_ can be specified, the name of the directory (_foldername_) in which the mp3 files will be stored can also be specified. If the foldername is not specified, it will be the name of the channel. (Spaces are replaced with underscores.)
``` python
path = 'path/to/store/mp3'
directory = '/files'
example.download(path=path, foldername=directory)
```
* ### iframes
In order to get iframes of the latest episodes to embed on a webpage, use the **iframes()** function.
It returns a dictionary where the key is the title of the episode (if one is present) and the value is the iframe (if iframes are present).
``` python
iframesList = example.iframes()
```
___
Changelog
---------
### == v1.0.3 ==
* _iframes function only runs if iframes are present_
* _iframes function generates titles when there is no title given_
### == v1.0.2 ==
* _iframes now returns a dictionary. (key = Title, value = iframe)_
### == v1.0.1 ==
* _Fix bugs involving download function_
* _Remove HTML tags from podcast.name attribute_
* _Fix logger, log always in same directory as podcast.py_
### == 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.
Source Distribution
libpyn-1.0.3.tar.gz
(4.2 kB
view details)
File details
Details for the file libpyn-1.0.3.tar.gz
.
File metadata
- Download URL: libpyn-1.0.3.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cd3605ea8bbfe73e629c6c11d8cf918604d08dd2f0e212aec79fcd3f3f8d29c |
|
MD5 | 6a94be5fc07af0c27b7061fa9966fd5a |
|
BLAKE2b-256 | 2bcad38fc0e6dc87cedb61956504453587f6102c6e56a17ea3777042497da741 |