From f21479c0a382840ea0d7fba9e9d4c8eaa6965308 Mon Sep 17 00:00:00 2001 From: David Parunakian Date: Thu, 8 Aug 2013 20:27:54 +0400 Subject: [PATCH] Added TED.com video downloader Closes #56 --- src/you_get/downloader/__init__.py | 1 + src/you_get/downloader/__main__.py | 1 + src/you_get/downloader/ted.py | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 src/you_get/downloader/ted.py diff --git a/src/you_get/downloader/__init__.py b/src/you_get/downloader/__init__.py index 7a4e315d..9be7e3d6 100644 --- a/src/you_get/downloader/__init__.py +++ b/src/you_get/downloader/__init__.py @@ -38,5 +38,6 @@ from .xiami import * from .yinyuetai import * from .youku import * from .youtube import * +from .ted import * from .__main__ import * diff --git a/src/you_get/downloader/__main__.py b/src/you_get/downloader/__main__.py index 4ce9cbe5..2f5cfbf0 100644 --- a/src/you_get/downloader/__main__.py +++ b/src/you_get/downloader/__main__.py @@ -49,6 +49,7 @@ def url_to_module(url): 'sohu': sohu, 'songtaste':songtaste, 'soundcloud': soundcloud, + 'ted': ted, 'tudou': tudou, 'tumblr': tumblr, 'vid48': vid48, diff --git a/src/you_get/downloader/ted.py b/src/you_get/downloader/ted.py new file mode 100644 index 00000000..167da2a8 --- /dev/null +++ b/src/you_get/downloader/ted.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +__all__ = ['ted_download'] + +from ..common import * + +def ted_download(url, output_dir = '.', merge = True, info_only = False): + page = get_html(url).split("\n") + for line in page: + if line.find("") > -1: + title = line.replace("<title>", "").replace("", "").replace("\t", "") + title = title[:title.find(' | ')] + if line.find("no-flash-video-download") > -1: + url = line.replace('