youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

commit f4b1c7adb81555fde0dff390b48e4139438b4071
parent c95eeb7b80e5007259df260b64874b675a802431
Author: Philipp Hagemeister <phihag@phihag.de>
Date:   Sun, 28 Sep 2014 08:53:52 +0200

[muenchentv] Move live title generation to common

Diffstat:
Myoutube_dl/extractor/common.py | 7+++++++
Myoutube_dl/extractor/muenchentv.py | 5+----
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals import base64 +import datetime import hashlib import json import netrc @@ -705,6 +706,12 @@ class InfoExtractor(object): self._sort_formats(formats) return formats + def _live_title(self, name): + """ Generate the title for a live video """ + now = datetime.datetime.now() + now_str = now.strftime("%Y-%m-%d %H:%M") + return name + ' ' + now_str + class SearchInfoExtractor(InfoExtractor): """ diff --git a/youtube_dl/extractor/muenchentv.py b/youtube_dl/extractor/muenchentv.py @@ -1,7 +1,6 @@ # coding: utf-8 from __future__ import unicode_literals -import datetime import json from .common import InfoExtractor @@ -33,9 +32,7 @@ class MuenchenTVIE(InfoExtractor): display_id = 'live' webpage = self._download_webpage(url, display_id) - now = datetime.datetime.now() - now_str = now.strftime("%Y-%m-%d %H:%M") - title = self._og_search_title(webpage) + ' ' + now_str + title = self._live_title(self._og_search_title(webpage)) data_js = self._search_regex( r'(?s)\nplaylist:\s*(\[.*?}\]),related:',