mirror of
https://github.com/soimort/you-get.git
synced 2025-02-11 04:32:27 +03:00
Fixed bilibili title extract
This commit is contained in:
parent
68a0e9c4b0
commit
87bbc496fc
1
.gitignore
vendored
1
.gitignore
vendored
@ -83,3 +83,4 @@ _*
|
|||||||
/.idea
|
/.idea
|
||||||
*.m4a
|
*.m4a
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
|
.vscode
|
||||||
|
@ -4,7 +4,9 @@ from .common import match1, maybe_print, download_urls, get_filename, parse_host
|
|||||||
from .common import print_more_compatible as print
|
from .common import print_more_compatible as print
|
||||||
from .util import log
|
from .util import log
|
||||||
from . import json_output
|
from . import json_output
|
||||||
|
from subprocess import DEVNULL
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
class Extractor():
|
class Extractor():
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
@ -242,6 +244,8 @@ class VideoExtractor():
|
|||||||
print('Downloading {} ...\n'.format(filename))
|
print('Downloading {} ...\n'.format(filename))
|
||||||
with open(os.path.join(kwargs['output_dir'], filename), 'w', encoding='utf8') as fp:
|
with open(os.path.join(kwargs['output_dir'], filename), 'w', encoding='utf8') as fp:
|
||||||
fp.write(self.danmuku)
|
fp.write(self.danmuku)
|
||||||
|
output = get_filename(self.title)
|
||||||
|
subprocess.check_call(['danmaku2ass', '-o', output + '.ass', '-s', '1920x1080', '-fn', 'MS PGothic', '-fs', '48', '-a', '0.8', '-dm', '15', '-ds', '10', output + '.cmt.xml'], stdin=DEVNULL);
|
||||||
|
|
||||||
# For main_dev()
|
# For main_dev()
|
||||||
#download_urls(urls, self.title, self.streams[stream_id]['container'], self.streams[stream_id]['size'])
|
#download_urls(urls, self.title, self.streams[stream_id]['container'], self.streams[stream_id]['size'])
|
||||||
|
@ -125,7 +125,7 @@ class Bilibili(VideoExtractor):
|
|||||||
self.referer = self.url
|
self.referer = self.url
|
||||||
self.page = get_content(self.url)
|
self.page = get_content(self.url)
|
||||||
|
|
||||||
m = re.search(r'<h1.*?>(.*?)</h1>', self.page)
|
m = re.search(r'<h1.*?>(?:<!-+>)?[\n ]*(.*?)[\n ]*</h1>', self.page, flags=re.DOTALL)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
self.title = m.group(1)
|
self.title = m.group(1)
|
||||||
if self.title is None:
|
if self.title is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user