How to sync PyCon videos to your iPhone


You want to all the PyCon videos on your iPhone for offline viewing.


Use the following Python script to fetch pycon videos from YouTube and convert them to M4V format so they can be imported to iTunes.

This gist is stale now - the code for downloading videos has been expanding into a [Github repository](

To run the script:

  1. Ensure you have requests and BeautifulSoup installed in your Python environment;
  2. Ensure you have ffmpeg available on your path;
  3. Download youtube-dl to the same directory as this script

Run this script using:


The script will display the title and description of each available PyCon video and prompt you as to whether you want to download it. Once all videos have been reviewed, each selected one will be downloaded and converted. When all videos have been processed, you can import the files into iTunes and sync them onto your Apple device.


As is plain to see, the script is a hacky bit of Python plumbing that:

  • Scrapes the PyCon category and video pages of;
  • Prompts the user to choose which videos to download;
  • Fetches the Flash content from YouTube using the youtube-dl utility;
  • Converts the .flv files to the M4V QuickTime format.

Something wrong? Suggest an improvement or add a comment (see article history)
Tagged with: python
Filed in: tips

Previous: Tips for using a git pre-commit hook
Next: Validating international postcodes in Django

Copyright © 2005-2023 David Winterbottom
Content licensed under CC BY-NC-SA 4.0.