[BUGFIX] Fix multiple top-level parents issue (#325)
This commit is contained in:
parent
8d154cc242
commit
26b6ed0add
1 changed files with 11 additions and 7 deletions
|
|
@ -213,19 +213,23 @@ class EntryParent(BaseEntry):
|
||||||
for parent in parents
|
for parent in parents
|
||||||
if not parent.child_entries and _url_matches(parent.webpage_url)
|
if not parent.child_entries and _url_matches(parent.webpage_url)
|
||||||
]
|
]
|
||||||
if len(top_level_parents) == 0:
|
|
||||||
return None
|
|
||||||
|
|
||||||
match len(top_level_parents):
|
match len(top_level_parents):
|
||||||
case 0:
|
case 0:
|
||||||
return None
|
return None
|
||||||
case 1:
|
case 1:
|
||||||
return top_level_parents[0]
|
return top_level_parents[0]
|
||||||
case _:
|
case 2:
|
||||||
raise ValueError(
|
# Channels can have two of the same .info.json. Handle it here
|
||||||
"Detected multiple top-level parents. "
|
top0 = top_level_parents[0]
|
||||||
"Please file an issue on GitHub with the URLs used to produce this error"
|
top1 = top_level_parents[1]
|
||||||
)
|
if top0.uploader_id == top1.uploader_id:
|
||||||
|
return top0 if not top0.webpage_url.endswith("/videos") else top1
|
||||||
|
|
||||||
|
raise ValueError(
|
||||||
|
"Detected multiple top-level parents. "
|
||||||
|
"Please file an issue on GitHub with the URLs used to produce this error"
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_entry_dicts(
|
def from_entry_dicts(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue