@@ -97,7 +97,7 @@ def update(self):
9797class Generator :
9898 def __init__ (self ):
9999 self .version = "v1.1"
100- AutoUpdater (self .version ).update ()
100+ # AutoUpdater(self.version).update()
101101 self .config : dict = load (open ('config.json' ))
102102 self .output : IO = open (self .config ["output" ], "a+" )
103103 self .tasks : list = []
@@ -153,17 +153,17 @@ async def run(self) -> None:
153153
154154 async def generate (self , worker , url : str , selector : str ) -> None :
155155 while True :
156- with suppress ( Exception ) :
156+ try :
157157 async with openfile (self .config ["output" ], "a+" ) as file :
158158 async with ClientSession () as session :
159159 request = await session .post (choice (url ), data = {"gen" : "" },
160- timeout = self .config ["request-timeout" ] or 5 )
161- outUrl = \
162- findall ( "http://.*" ,
163- str ( BeautifulSoup ( await request . text (), "html.parser" ). select ( selector )))[
164- 0 ]
165- await aprint ( "%s[%s] " % ( Fore . LIGHTCYAN_EX , worker ) + await self . make_beautiful ( outUrl ))
166- await file . write ( "%s" % outUrl )
160+ timeout = self .config ["request-timeout" ] or 5 )
161+ redirected_url = request . url # Get the redirected URL directly
162+ await aprint ( "%s[%s] " % ( Fore . LIGHTCYAN_EX , worker ) + choice ( self . colors ) + str ( redirected_url ))
163+ await file . write ( "%s" % str ( redirected_url ))
164+ except Exception as e :
165+ print ( f"An error occurred: { e } " ) # Print any encountered error
166+
167167
168168
169169if __name__ == '__main__' :
0 commit comments