(self, form)
| 269 | } |
| 270 | |
| 271 | def form_valid(self, form): |
| 272 | url = form.cleaned_data["url"] |
| 273 | print(f'[+] Adding URL: {url}') |
| 274 | parser = form.cleaned_data["parser"] |
| 275 | tag = form.cleaned_data["tag"] |
| 276 | depth = 0 if form.cleaned_data["depth"] == "0" else 1 |
| 277 | extractors = ','.join(form.cleaned_data["archive_methods"]) |
| 278 | input_kwargs = { |
| 279 | "urls": url, |
| 280 | "tag": tag, |
| 281 | "depth": depth, |
| 282 | "parser": parser, |
| 283 | "update_all": False, |
| 284 | "out_dir": OUTPUT_DIR, |
| 285 | } |
| 286 | if extractors: |
| 287 | input_kwargs.update({"extractors": extractors}) |
| 288 | add_stdout = StringIO() |
| 289 | with redirect_stdout(add_stdout): |
| 290 | add(**input_kwargs) |
| 291 | print(add_stdout.getvalue()) |
| 292 | |
| 293 | context = self.get_context_data() |
| 294 | |
| 295 | context.update({ |
| 296 | "stdout": ansi_to_html(add_stdout.getvalue().strip()), |
| 297 | "form": AddLinkForm() |
| 298 | }) |
| 299 | return render(template_name=self.template_name, request=self.request, context=context) |
| 300 | |
| 301 | |
| 302 | class HealthCheckView(View): |
nothing calls this directly
no test coverage detected