Skip to content

Commit

Permalink
修复字幕类型链接的BaseURL拼接错误
Browse files Browse the repository at this point in the history
  • Loading branch information
xhlove committed Jul 9, 2022
1 parent 423300d commit 3e1afd8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
2 changes: 1 addition & 1 deletion XstreamDL_CLI/downloader.py
Expand Up @@ -8,7 +8,7 @@
from asyncio import new_event_loop
from asyncio import AbstractEventLoop, Future, Task
from aiohttp import client_exceptions
from aiohttp import ClientSession, ClientTimeout, TCPConnector
from aiohttp import ClientResponse, ClientSession, ClientTimeout, TCPConnector
from aiohttp_socks import ProxyConnector
from concurrent.futures._base import TimeoutError, CancelledError
from XstreamDL_CLI.cmdargs import CmdArgs
Expand Down
16 changes: 2 additions & 14 deletions XstreamDL_CLI/extractors/dash/parser.py
Expand Up @@ -216,6 +216,8 @@ def walk_representation(self, adaptationset: AdaptationSet, period: Period, sind
stream.set_stream_type(adaptationset.mimeType)
else:
stream.set_stream_type(representation.mimeType)
if representation.mimeType == 'text/vtt':
print('debug')
if representation.width is None or representation.height is None:
stream.set_resolution(adaptationset.width, adaptationset.height)
else:
Expand All @@ -224,20 +226,6 @@ def walk_representation(self, adaptationset: AdaptationSet, period: Period, sind
Roles = adaptationset.find('Role') # type: List[Role]
if stream.stream_type == '' and len(Roles) > 0:
stream.set_stream_type(Roles[0].value)
BaseURLs = representation.find('BaseURL') # type: List[BaseURL]
if len(BaseURLs) == 1:
if len(Roles) == 1 and Roles[0].value in ['subtitle', 'caption']:
base_url = BaseURLs[0].innertext.strip()
if base_url.startswith('http') or base_url.startswith('/'):
stream.set_subtitle_url(base_url)
else:
stream.set_subtitle_url('../' + base_url)
streams.append(stream)
continue
# if len(segmenttemplates) == 0 and len(representation.find('SegmentTimeline')) == 0:
# stream.base2url(period.duration)
# streams.append(stream)
# continue
segmentlists = representation.find('SegmentList') # type: List[SegmentList]
r_segmenttemplates = representation.find('SegmentTemplate') # type: List[SegmentTemplate]
# 针对视频音频流处理 分情况生成链接
Expand Down
3 changes: 0 additions & 3 deletions XstreamDL_CLI/models/stream.py
Expand Up @@ -196,9 +196,6 @@ def fix_url(self, url: str) -> str:
return url
elif url.startswith('/'):
return f'{self.home_url}{url}'
elif url.startswith('../'):
fixed_base_url = '/'.join(self.base_url.split("/")[:-1])
return f'{fixed_base_url}{url[2:]}'
elif url == '':
return f'{self.base_url}'
else:
Expand Down
2 changes: 1 addition & 1 deletion XstreamDL_CLI/version.py
@@ -1,2 +1,2 @@
script_name = 'XstreamDL-CLI'
__version__ = '1.4.1_20220709'
__version__ = '1.4.2'

0 comments on commit 3e1afd8

Please sign in to comment.