Loco-CTO / Rystal-V6-Experiments

Test for membership should be 'not in' FLK-E713
Anti-pattern
Major
a month ago2 months old
test for membership should be 'not in'
 84            print("SSL error, retrying")
 85            continue
 86        # Happens not deterministically sometimes.
 87        if not "onResponseReceivedActions" in data: 88            print("Missing onResponseReceivedActions, retrying")
 89            with open("error.json", "w") as f:
 90                json.dump(data, f, indent=4)
test for membership should be 'not in'
 38
 39def getContinuationToken(videoIds, contents):
 40    lastContent = contents[-1]
 41    if not "continuationItemRenderer" in lastContent: 42        return videoIds
 43    return lastContent["continuationItemRenderer"]["continuationEndpoint"][
 44        "continuationCommand"
test for membership should be 'not in'
 29
 30def treatContents(videoIds, contents):
 31    for content in contents:
 32        if not "richItemRenderer" in content: 33            break
 34        videoId = content["richItemRenderer"]["content"]["videoRenderer"]["videoId"]
 35        videoIds.add(videoId)