Skip to main content

A tool to convert YouTube content to Kindle format

Project description

DESCRIPTION

Automates the conversion of online Youtube videos
(or offline audio files or disorganised text files) into Kindle books.
Uses OpenAI's API for transcription and redrafting of the text (for readability).
Requires OpenAI key.

GETTING STARTED

Installation:
pip install youtube-to-kindle

OpenAI:
You will need to provide you own OpenAI key.
Follow the instructions here: https://platform.openai.com/docs/quickstart

QUICKSTART

1. Convert a single Youtube video
2. Convert a single audiofile
3. Convert a Youtube Playlist
4. Convert multiple Youtube videos
5. Convert multiple audiofiles
6. Convert a text file or text files to Kindle
7. Convert without redrafting
8. Estimate the cost of converting all the mp3s in the Download directory
9. Estimate the cost of redrafting all the text files in the Download directory

All code below must be preceded with:
from youtube_to_kindle import YoutubeToKindle
ytk = YouTubeToKindle(openai_key="your_openai_key_here")
ytk.set_download_dir('Downloads') # set this to any location you want

1. Convert a single YouTubeVideo:
ytk.add_to_files('https://www.youtube.com/watch?v=GWCChO7znyM')
ytk.params['author'] = ''
ytk.params['redraft'] = True
ytk.params['turn_first_video_title_to_book_name'] = True
ytk.params['make_first_video_creator_author'] = True
ytk.make_ebook()

2. Convert multiple YouTubeVideos:
ytk.add_to_files('https://www.youtube.com/watch?v=GWCChO7znyM')
ytk.add_to_files('https://www.youtube.com/watch?v=EUY7Q92aK3w')
ytk.params['title'] = 'Tarantino Videos'
ytk.params['author'] = 'Various'
ytk.params['redraft'] = True
ytk.params['turn_video_title_to_chapter_name'] = True
ytk.make_ebook()

3. Convert a YouTubePlaylist:
ytk.add_to_files('https://www.youtube.com/playlist?list=PLICvGmV1_RRLH25uyKaVYXpBLpbQvlZ8e')
ytk.params['title'] = 'Test Playlist'
ytk.params['author'] = 'Me'
ytk.params['redraft'] = True
ytk.params['turn_playlist_title_to_book_title'] = True
ytk.make_ebook()

4. Convert a single audio file:
ytk.add_to_files('pitchvid.mp3')
ytk.params['title'] = 'Audio File'
ytk.params['author'] = 'Me'
ytk.params['redraft'] = True
ytk.params['turn_filename_root_to_chapter_name'] = True
ytk.make_ebook()

5. Convert a multiple audio files:
ytk.add_to_files('pitchvid.mp3')
ytk.add_to_files('How Tarantino Use Music To Start Writing 😯.mp3')
ytk.params['title'] = 'Audio File'
ytk.params['author'] = 'Me'
ytk.params['redraft'] = True
ytk.params['turn_filename_root_to_chapter_name'] = True
ytk.make_ebook()

6. Convert a multiple text files (.txt) on a Mac:
ytk.add_to_files('Commissioning Execs Session.txt')
ytk.add_to_files('Spec scripts session.txt')
ytk.params['title'] = 'Screenplays'
ytk.params['author'] = 'Writers'
ytk.params['redraft'] = True
ytk.params['turn_filename_root_to_chapter_name'] = True
ytk.params['encoding'] = 'latin-1' # mac encoding
ytk.make_ebook()

7. Convert without redrafting:
ytk.add_to_files('https://www.youtube.com/watch?v=GWCChO7znyM')
ytk.params['author'] = ''
ytk.params['redraft'] = False
ytk.params['turn_first_video_title_to_book_name'] = True
ytk.params['make_first_video_creator_author'] = True
ytk.make_ebook()

8. Estimate the cost of converting all the mp3s in the Download directory:
print(ytk.estimate_cost(file_type=".mp3"))

9. Estimate the cost of redrafting all the text files in the Download directory:
print(ytk.estimate_cost(file_type=".txt"))


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

youtube-to-kindle-1.0.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

youtube_to_kindle-1.0.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file youtube-to-kindle-1.0.0.tar.gz.

File metadata

  • Download URL: youtube-to-kindle-1.0.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.4

File hashes

Hashes for youtube-to-kindle-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d5ec538c156e38961500caae0c7b8fe2229160bd7c3b0240b78e44557a6f88c9
MD5 a2808bcfc80e4138d95773c72b060872
BLAKE2b-256 2d3ea664f15f2fddd3452496d8eeea444154da9fe940c47a1e0e1a71d879ffac

See more details on using hashes here.

File details

Details for the file youtube_to_kindle-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for youtube_to_kindle-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c0dce84d5d8763605e3cf9ba519e58a0cd5c79e0bbbc83a1ff73dd2cbc90b5b
MD5 0f201a567dc8b59484c78c0a2720041a
BLAKE2b-256 b34c743db1beddbf1bbe9d77195059be665b77b4ce6edbf138eda8da18d01d62

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page