Skip to content

Commit

Permalink
Merge pull request #485 from opennaslab/cherry-pick-480-release-0.6
Browse files Browse the repository at this point in the history
Cherry pick PR(480)/fix: yutto downloader not recognize url from app
  • Loading branch information
gitautomator[bot] authored Mar 17, 2024
2 parents 6c4b45e + 168e119 commit 72f627e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def send_general_task(self, task: Task) -> TypeError:
data = {'dataSource': task.url, 'path': task.path}
logging.info('Send general task:%s', json.dumps(data))

if not task.url.startswith('https://www.bilibili.com'):
if not (task.url.startswith('https://www.bilibili.com') or task.url.startswith('https://b23.tv')):
return TypeError('yutto only support specific resource')

# This downloading tasks is special, other download software could not handle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Function: download single video link
# encoding:utf-8
import logging
import re
from urllib.parse import urlparse

from source_provider import provider
Expand Down Expand Up @@ -52,7 +53,7 @@ def is_webhook_enable(self) -> bool:
return self.webhook_enable

def should_handle(self, event: Event) -> bool:
parse_url = urlparse(event.source)
parse_url = urlparse(re.findall(r"https?://\S+", event.source)[0])
if parse_url.hostname in ('www.bilibili.com', 'b23.tv'):
logging.info('%s belongs to BilibiliSourceProvider', event.source)
return True
Expand All @@ -63,7 +64,7 @@ def get_links(self, event: Event) -> list[Resource]:
event.put_extra_params(self.get_download_param())

return [Resource(
url=event.source,
url=re.findall(r"https?://\S+", event.source)[0],
path='',
link_type=self.get_link_type(),
file_type=types.FILE_TYPE_VIDEO_MIXED,
Expand Down

0 comments on commit 72f627e

Please sign in to comment.