mirror of
https://github.com/tropicoo/yt-dlp-bot.git
synced 2024-09-20 06:46:08 +08:00
Fix #185
This commit is contained in:
parent
b7a79a7aab
commit
0e82b0591f
|
@ -3,17 +3,19 @@
|
|||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# 4 space indentation
|
||||
[*.py]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
max_line_length = 88
|
||||
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = space
|
||||
|
|
|
@ -62,13 +62,14 @@ class UrlParser:
|
|||
message: Message = context['message']
|
||||
user: UserSchema = context['user']
|
||||
ack_message: Message = context['ack_message']
|
||||
from_user_id = message.from_user.id if message.from_user else None
|
||||
return [
|
||||
URL(
|
||||
url=url,
|
||||
original_url=orig_url,
|
||||
from_chat_id=message.chat.id,
|
||||
from_chat_type=TelegramChatType(message.chat.type.value),
|
||||
from_user_id=message.from_user.id,
|
||||
from_user_id=from_user_id,
|
||||
message_id=message.id,
|
||||
ack_message_id=ack_message.id,
|
||||
save_to_storage=user.save_to_storage,
|
||||
|
|
|
@ -5,7 +5,7 @@ from ytdl_opts.per_host._base import AbstractHostConfig
|
|||
|
||||
class HostConfRegistry(type):
|
||||
REGISTRY: dict[str, type[AbstractHostConfig]] = {}
|
||||
HOST_TO_CLS_MAP = {}
|
||||
HOST_TO_CLS_MAP: dict[str | None, type[AbstractHostConfig]] = {}
|
||||
|
||||
def __new__(
|
||||
mcs: Type['HostConfRegistry'],
|
||||
|
@ -33,6 +33,7 @@ class HostConfRegistry(type):
|
|||
) -> None:
|
||||
if hostnames is None:
|
||||
mcs.HOST_TO_CLS_MAP[None] = host_cls
|
||||
else:
|
||||
return
|
||||
|
||||
for host in hostnames:
|
||||
mcs.HOST_TO_CLS_MAP[host] = host_cls
|
||||
|
|
|
@ -3,8 +3,16 @@ from asyncio import Lock
|
|||
ASYNC_LOCK = Lock()
|
||||
|
||||
|
||||
INSTAGRAM_HOSTS = ('instagram.com', 'www.instagram.com')
|
||||
TIKTOK_HOSTS = ('tiktok.com', 'vm.tiktok.com', 'www.tiktok.com', 'www.vm.tiktok.com')
|
||||
INSTAGRAM_HOSTS = (
|
||||
'instagram.com',
|
||||
'www.instagram.com',
|
||||
)
|
||||
TIKTOK_HOSTS = (
|
||||
'tiktok.com',
|
||||
'vm.tiktok.com',
|
||||
'www.tiktok.com',
|
||||
'www.vm.tiktok.com',
|
||||
)
|
||||
TWITTER_HOSTS = (
|
||||
'twitter.com',
|
||||
'www.twitter.com',
|
||||
|
@ -14,5 +22,4 @@ TWITTER_HOSTS = (
|
|||
'www.t.co',
|
||||
)
|
||||
|
||||
|
||||
REMOVE_QUERY_PARAMS_HOSTS = TWITTER_HOSTS + INSTAGRAM_HOSTS
|
||||
|
|
|
@ -9,7 +9,7 @@ class URL(RealBaseModel):
|
|||
original_url: StrictStr
|
||||
from_chat_id: StrictInt
|
||||
from_chat_type: TelegramChatType
|
||||
from_user_id: StrictInt
|
||||
from_user_id: StrictInt | None
|
||||
message_id: StrictInt
|
||||
ack_message_id: StrictInt
|
||||
save_to_storage: StrictBool
|
||||
|
|
Loading…
Reference in a new issue