Error: 'NoneType' object has no attribute 'replace'
When downloading through the regular command with cookies and headers, I get this error.
> llvd -c "react-design-patterns-25656257" -r 1080 --headers --cookies
Error: 'NoneType' object has no attribute 'replace'
Downloading without --headers starts, but fails after a view videos.
================================================================================
+-----------------------------------------------------------------+------------+
| DOWNLOAD SUMMARY | |
| ------------------------------ | ---------- |
| | |
| VIDEOS | |
| • Total | 39 |
| • Downloaded | 6 |
| • Already existed | 0 |
| • Skipped | 0 |
| • Failed | 33 |
| | |
| CHAPTERS | |
| • Total | 9 |
| • Empty | 6 |
| • Deleted | 6 |
| | |
| ERRORS | |
| 1. Error processing 'What are layout components': No video | |
| URL found | |
| 2. Error processing 'List and item components': No video URL | |
| found | |
| 3. Error processing 'Solution Different list types': No video | |
| URL found | |
| 4. Error processing 'Modal components': No video URL found | |
| 5. Error processing 'What are container components': No video | |
| URL found | |
| ... and 28 more errors | |
+-----------------------------------------------------------------+------------+
================================================================================
There seems to be a change in the website, as it looks like the code is expecting a string, but finds nothing.
how do you setup your headers? i use this - llvd -c one-minute-habits-for-better-memory -r 1080 --caption --cookies --headers and i have not change my header for like 50 days.
i just testes yours course, and i got no problem..
Tried now with several paramters, --captions, --cookies, --headers and so on. All produce the same result. I tried the command you posted and got the same error:
Is that a config problem?
Edit: So I have been investigating a bit. The error seems to come from:
lib/python3.14/site-packages/llvd/process_io.py
exactly here:
def parse_header_file(path = "headers.txt"):
headers = {}
try:
with open(path, "r", encoding="utf8") as cookies_file:
lines = cookies_file.readlines()
for line in lines:
parts = line.split("=",1)
key, value = parts + [None]*(2-len(parts))
headers[key] = value.replace("\"", "").strip() # <------ error happens here
return headers
except FileNotFoundError:
click.echo(
click.style(f"{path} not found or is empty", fg="red"))
sys.exit(0)
It seems, that if your headers.txt file has empty lines, they will produce an error. Not the biggest of bugs, but still a bit annoying, if you have to figure it out. So I'd propose skipping the empty lines:
def parse_header_file(path="headers.txt"):
headers = {}
try:
with open(path, "r", encoding="utf8") as file:
for line in file:
line = line.strip()
if not line:
continue
key, value = line.split("=", 1)
headers[key] = value.replace('"', "")
return headers
except FileNotFoundError:
click.echo(
click.style(f"{path} not found or is empty", fg="red"))
sys.exit(0)
Does that make sense?
@SlawaGurevich Thanks, will look into it