Skip to content

Snapchat module crashes with IndexError due to outdated scraping logic #228

@ompop-pro21

Description

@ompop-pro21

The snapchat module within the holehe library consistently fails with an IndexError. This happens because the module attempts to parse a response from Snapchat's servers to find an XSRF token, but the token is not found in the expected format. This suggests that Snapchat has updated its website/API, and the library's scraping logic is now outdated.

To Reproduce
Steps to reproduce the behavior:

Install the required libraries: pip install holehe trio httpx

Create a Python script (e.g., test_snapchat.py) with the following code:

Python

import trio
import httpx
from holehe.modules.social_media.snapchat import snapchat

async def main():
email = "[email protected]"
out = []
client = httpx.AsyncClient()

try:
    await snapchat(email, client, out)
finally:
    print(out)
    await client.aclose()

trio.run(main)
Execute the script from the command line: python test_snapchat.py

See the IndexError traceback printed in the console.

Expected behavior
The script should run to completion without crashing. It should check if the email address is registered on Snapchat and append the result to the out list.

Screenshots
Not applicable, as this is a command-line interface (CLI) error. The full text of the error is provided below.

Desktop (please complete the following information):
OS: Windows (but likely affects all OS)

Browser: Not Applicable (This is a command-line Python script)

Version: Not Applicable

Smartphone (please complete the following information):
Device: Not Applicable

OS: Not Applicable

Browser: Not Applicable

Version: Not Applicable

Additional context
This appears to be a breaking change from Snapchat's side that requires an update to the scraping logic in holehe.

Full Error Traceback:

Traceback (most recent call last):
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python313\emailllchecker.py", line 17, in
    trio.run(main)
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python313\Lib\site-packages\trio_core_run.py", line 2435, in run
    raise runner.main_task_outcome.error
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python313\emailllchecker.py", line 12, in main
    await snapchat(email, client, out)
  File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python313\Lib\site-packages\holehe\modules\social_media\snapchat.py", line 12, in snapchat
    xsrf = req.text.split('data-xsrf="')[1].split('"')[0]
IndexError: list index out of range
Environment:

Python Version: 3.13

holehe Version: 1.61

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions