File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,8 @@ def execute(cls: Self, **kwargs) -> str:
6666 Raises:
6767 Exception: If neither ids, urls, nor input_file_path is provided.
6868 """
69- ids = kwargs .get ("ids" )
70- urls = kwargs .get ("urls" )
69+ ids = kwargs .get ("ids" , [] )
70+ urls = kwargs .get ("urls" , [] )
7171 input_file_path = kwargs .get ("input_file_path" )
7272 output_file_path = kwargs .get ("output_file_path" )
7373 api_key = kwargs .get ("api_key" )
@@ -89,13 +89,12 @@ def execute(cls: Self, **kwargs) -> str:
8989
9090 youtube = YouTube ([api_key ], disable_ipv6 = True )
9191
92- videos_infos = []
93-
94- if ids :
95- videos_infos += list (youtube .videos_infos (ids ))
9692 if urls :
97- # TODO: add get videos_infos using urls to youtool
98- raise NotImplementedError ("videos_infos by url not implemented yet" )
93+ ids += [cls .video_id_from_url (url ) for url in urls ]
94+
95+ # Remove duplicated
96+ ids = list (set (ids ))
97+ videos_infos = list (youtube .videos_infos ([_id for _id in ids if _id ]))
9998
10099 return cls .data_to_csv (
101100 data = [
You can’t perform that action at this time.
0 commit comments