simplify function call in traversal

This commit is contained in:
Mozi 2024-11-16 07:17:48 +00:00
parent 5d01746c4c
commit 1db3eaa77e

View File

@ -1,5 +1,3 @@
import urllib.parse
from .common import InfoExtractor
from ..utils import (
get_element_by_id,
@ -8,6 +6,7 @@
mimetype2ext,
traverse_obj,
url_or_none,
urljoin,
)
@ -147,7 +146,7 @@ def _real_extract(self, url):
info_dict.update(**traverse_obj(info, ('included', lambda _, v: v['type'] == 'channel', 'attributes', {
'channel': ('username'),
'channel_id': ('id'),
'channel_url': ('link', {lambda x: urllib.parse.urljoin(url, x)}), # starts with a slash
'channel_url': ('link', filter, {urljoin(base=url)}), # starts with a slash
'channel_follower_count': ('follower_cnt', {int_or_none}),
}), get_all=False))