fix: update JDownloader script to extract package name from URL for crawljob
Some checks failed
validate / lint (push) Failing after 2s
Some checks failed
validate / lint (push) Failing after 2s
This commit is contained in:
parent
9dc4bbe249
commit
c625461e30
@ -141,9 +141,12 @@ spec:
|
|||||||
urls = params.get('urls', [])
|
urls = params.get('urls', [])
|
||||||
if not urls:
|
if not urls:
|
||||||
self.send_response(400); self.end_headers(); return
|
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'
|
fname = f'{WATCH_DIR}/{int(time.time()*1000)}.crawljob'
|
||||||
with open(fname, 'w') as f:
|
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.send_response(200); self.end_headers()
|
||||||
self.wfile.write(b'Ok.')
|
self.wfile.write(b'Ok.')
|
||||||
def log_message(self, *a): pass
|
def log_message(self, *a): pass
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user