Skip to content

Commit

Permalink
Updated README, added hashbangs to fetching scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
codeinthehole committed Mar 18, 2012
1 parent 939774b commit cabddbc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
49 changes: 34 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
=================
pyvideo2quicktime
=================

What does this do?
------------------

It provides a few simple commands for downloading videos from the excellent
pyvideo.org site, and converting them to QuickTime format so they can be
`pyvideo.org`_ site, and converting them to QuickTime format so they can be
imported into iTunes and synced to an Apple device.

For example, you can fetch all the videos from PyCon 2012 that you are
intereseted in.
.. _`pyvideo.org`: http://pyvideo.org/

Eg, you can can run::

python fetch_pyvideo.py http://pyvideo.org/video/604/introduction-to-django

and the 'Introduction to Django' talk from PyCon 2012 will be downloaded and
converted to ``.m4v`` format so it can be imported into iTunes.

What's the point?
-----------------

It just lets you watch interesting videos when you're offline and can't watch
them directly through YouTube.

For instance, my daily commute involves around 2 hours on London's underground,
sans internet. This is the perfect time for watching Python videos, hence why I
scratched this itch.

How do I install it?
--------------------
Expand All @@ -15,35 +35,34 @@ After cloning the repo, do the following::

pip install requests BeautifulSoup mock

Next fetch ``youtube-dl`` from https://github.com/rg3/youtube-dl/ and add this
Next download ``youtube-dl`` from https://github.com/rg3/youtube-dl/ and add this
to the directory, ensuring its execute bit is set.

Ensure you have ``ffmpeg`` installed - this is used to convert from ``.flv`` to
``.m4v``. You can install with::

brew install --use-gcc ffmpeg

How to I use it?
Then you're ready to go.

How do I use it?
----------------

Fetch a single video:
Fetch a single video::

python fetch_pyvideo.py http://pyvideo.org/video/880/stop-writing-classes some-filename

Browse all videos from PyCon 2012 and choose which to download:
Browse all videos from a category page choose which to download::

python fetch_pyvideos.py http://pyvideo.org/category/17/pycon-us-2012

Do the videos take a long time to download and convert?
-------------------------------------------------------

Yes.

Is the code high quality and well tested?
-----------------------------------------

No. It's a quick and dirty bit of plumbing. It's also quite brittle as it uses
screen-scraping to fetch the YouTube URLs.

How does this work?
-------------------

1. It scrapes the pyvideo site for the relevant YouTube URLs.
2. The ``youtube-dl`` script is used to fetch the Flash content into a ``.flv``
file.
3. This is converted to a ``.m4v`` file using ``ffmpeg``.
4 changes: 3 additions & 1 deletion fetch_pyvideo.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env python
import sys

from pyvideo import fetch_youtube_url
from download import download

if __name__ == '__main__':
url, name = sys.argv[1], sys.argv[2]
url = sys.argv[1]
name = url.split('/').pop()
youtube_url = fetch_youtube_url(url)
download(youtube_url, name)
1 change: 1 addition & 0 deletions fetch_pyvideos.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env python
import sys

from pyvideo import fetch_youtube_urls
Expand Down

0 comments on commit cabddbc

Please sign in to comment.