fix: update JDownloader script to extract package name from URL for crawljob
Some checks failed
validate / lint (push) Failing after 2s

This commit is contained in:
Nik Afiq 2026-07-26 01:37:03 +09:00
parent 9dc4bbe249
commit c625461e30

View File

@ -141,9 +141,12 @@ spec:
urls = params.get('urls', [])
if not urls:
self.send_response(400); self.end_headers(); return
url = urls[0]
basename = urllib.parse.unquote(urllib.parse.urlparse(url).path.rsplit('/', 1)[-1])
package_name = basename.split('.', 1)[0] or 'subyshare'
fname = f'{WATCH_DIR}/{int(time.time()*1000)}.crawljob'
with open(fname, 'w') as f:
f.write(f'text={urls[0]}\nautoStart=TRUE\nautoConfirm=TRUE\npackageName=subyshare\n')
f.write(f'text={url}\nautoStart=TRUE\nautoConfirm=TRUE\npackageName={package_name}\n')
self.send_response(200); self.end_headers()
self.wfile.write(b'Ok.')
def log_message(self, *a): pass