mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-23 01:08:10 +00:00
[muenchentv] Move live title generation to common
This commit is contained in:
parent
c95eeb7b80
commit
f4b1c7adb8
2 changed files with 8 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import netrc
|
import netrc
|
||||||
|
@ -705,6 +706,12 @@ class InfoExtractor(object):
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
return 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):
|
class SearchInfoExtractor(InfoExtractor):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import datetime
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
@ -33,9 +32,7 @@ class MuenchenTVIE(InfoExtractor):
|
||||||
display_id = 'live'
|
display_id = 'live'
|
||||||
webpage = self._download_webpage(url, display_id)
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
now = datetime.datetime.now()
|
title = self._live_title(self._og_search_title(webpage))
|
||||||
now_str = now.strftime("%Y-%m-%d %H:%M")
|
|
||||||
title = self._og_search_title(webpage) + ' ' + now_str
|
|
||||||
|
|
||||||
data_js = self._search_regex(
|
data_js = self._search_regex(
|
||||||
r'(?s)\nplaylist:\s*(\[.*?}\]),related:',
|
r'(?s)\nplaylist:\s*(\[.*?}\]),related:',
|
||||||
|
|
Loading…
Reference in a new issue