fix: guard parse_multi_exp against missing nodes - #77
Open
aditya20-b wants to merge 1 commit into
Open
Conversation
The multi-role parser assumed every nested key existed. When LinkedIn omits pagedListComponent or a per-role caption/titleV2 (common on multi-role / promoted profiles), it raised TypeError and the caller's broad try/except dropped the entire experience — so long-tenured members ended up with no tenure at all. Walk the nested structure safely, skip a single malformed role instead of nuking the whole company, and fall back to the company-level span when per-role data is missing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
parse_multi_expassumed every nested key was present. When LinkedIn omitspagedListComponentor a per-rolecaption/titleV2(which happens on plenty of multi-role / promoted profiles), it raisedTypeError— and the caller's broadtry/exceptswallowed the error and dropped the entire experience entry. The practical effect: members who'd been promoted internally at a company silently lost their tenure in the scraped output, so the people with the longest histories were exactly the ones whose data went missing.This PR:
_nested()helper that walks a chain of keys and returnsNoneon any miss, instead of throwing.No behavioral change for well-formed payloads — only the previously-dropped ones now come through.
Test plan