@@ -158,34 +158,37 @@ def get_links(self, event: Event) -> list[Resource]:
158158
159159 def get_links_from_xml (self , tmp_xml , blacklist ) -> list [Resource ]:
160160 try :
161- xml_parse = ET .parse (tmp_xml )
162- items = xml_parse .findall ('.//item' )
163161 ret = []
164- for i in items :
165- xml_title = i .find ('./title' ).text
162+ for item in ET . parse ( tmp_xml ). findall ( './/item' ) :
163+ xml_title = item .find ('./title' ).text
166164 item_title , item_episode = self .get_anime_info (xml_title )
167- season , season_keyword = self .get_season (xml_title )
168- if item_title is not None :
169- logging .info ('Found Anime "%s" Season %s Episode %s' , item_title , season , item_episode )
170- # Pass blacklist Animes
171- if self .check_blacklist (xml_title , blacklist ):
172- continue
173- res = Resource (
174- url = i .find ('./guid' ).text ,
175- path = self .save_path + (f'/{ item_title } ' if self .classification_on_directory else '' ),
176- file_type = types .FILE_TYPE_VIDEO_TV ,
177- link_type = self .get_link_type (),
178- )
179- if self .api_type == 'torrent' :
180- if self .use_sub_category :
181- sub_category = self .get_subcategory (item_title , season , season_keyword )
182- logging .info ("Using subcategory: %s" , sub_category )
183- res .put_extra_params ({'sub_category' : sub_category })
184- elif season > 1 :
185- res .put_extra_params ({'file_name' : self .rename_season (xml_title , season , season_keyword , item_episode )})
186- ret .append (res )
187- else :
165+
166+ if item_title is None or self .check_blacklist (xml_title , blacklist ):
188167 continue
168+
169+ season , season_keyword = self .get_season (xml_title )
170+ logging .info ('Found Anime "%s" Season %s Episode %s' , item_title , season , item_episode )
171+
172+ final_url = item .find ('./guid' ).text
173+ if 'resources.ani.rip' in final_url :
174+ final_url = final_url .replace ('resources.ani.rip' , 'cloud.ani-download.workers.dev' )
175+
176+ res = Resource (
177+ url = final_url ,
178+ path = self .save_path + (f'/{ item_title } ' if self .classification_on_directory else '' ),
179+ file_type = types .FILE_TYPE_VIDEO_TV ,
180+ link_type = self .get_link_type (),
181+ )
182+
183+ if self .api_type == 'torrent' and self .use_sub_category :
184+ sub_category = self .get_subcategory (item_title , season , season_keyword )
185+ logging .info ("Using subcategory: %s" , sub_category )
186+ res .put_extra_params ({'sub_category' : sub_category })
187+ elif season > 1 :
188+ res .put_extra_params ({'file_name' : self .rename_season (xml_title , season , season_keyword , item_episode )})
189+
190+ ret .append (res )
191+
189192 return ret
190193 except Exception as err :
191194 print (traceback .format_exc ())
0 commit comments