[GH-ISSUE #71] [BUG] #85

Closed
opened 2026-03-13 23:01:21 +03:00 by kerem · 2 comments
Owner

Originally created by @Dec-QXY on GitHub (Jun 12, 2025).
Original GitHub issue: https://github.com/AliAkhtari78/SpotifyScraper/issues/71

Describe the bug

2025-06-12 22:34:57 - spotify_scraper.client - INFO - Getting track info for https://open.spotify.com/track/0VqSdtXseb9khdZrnYVyM1
2025-06-12 22:34:57 - spotify_scraper.parsers.json_parser - ERROR - Failed to extract track data: argument of type 'NoneType' is not iterable
2025-06-12 22:34:57 - spotify_scraper.extractors.track - WARNING - Failed to extract track data from embed URL: argument of type 'NoneType' is not iterable

When I get the information he gets this error

To Reproduce
Steps to reproduce the behavior:

# Code that causes the issue
from spotify_scraper import SpotifyClient

client = SpotifyClient()
# ...

Expected behavior
A clear and concise description of what you expected to happen.

Actual behavior
What actually happened instead.

Error messages

Paste any error messages here

Environment:

  • OS: [e.g. Windows 10, Ubuntu 22.04, macOS 13]
  • Python version: [e.g. 3.11.5]
  • SpotifyScraper version: [e.g. 2.0.0]
  • Installation method: [pip, git clone, etc.]

Additional context
Add any other context about the problem here.

Possible solution
If you have any ideas on how to fix this bug, please share them here.

Originally created by @Dec-QXY on GitHub (Jun 12, 2025). Original GitHub issue: https://github.com/AliAkhtari78/SpotifyScraper/issues/71 **Describe the bug** 2025-06-12 22:34:57 - spotify_scraper.client - INFO - Getting track info for https://open.spotify.com/track/0VqSdtXseb9khdZrnYVyM1 2025-06-12 22:34:57 - spotify_scraper.parsers.json_parser - ERROR - Failed to extract track data: argument of type 'NoneType' is not iterable 2025-06-12 22:34:57 - spotify_scraper.extractors.track - WARNING - Failed to extract track data from embed URL: argument of type 'NoneType' is not iterable When I get the information he gets this error **To Reproduce** Steps to reproduce the behavior: ```python # Code that causes the issue from spotify_scraper import SpotifyClient client = SpotifyClient() # ... ``` **Expected behavior** A clear and concise description of what you expected to happen. **Actual behavior** What actually happened instead. **Error messages** ``` Paste any error messages here ``` **Environment:** - OS: [e.g. Windows 10, Ubuntu 22.04, macOS 13] - Python version: [e.g. 3.11.5] - SpotifyScraper version: [e.g. 2.0.0] - Installation method: [pip, git clone, etc.] **Additional context** Add any other context about the problem here. **Possible solution** If you have any ideas on how to fix this bug, please share them here.
kerem 2026-03-13 23:01:21 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@Dec-QXY commented on GitHub (Jun 12, 2025):

This is all you need to get started!

from spotify_scraper import SpotifyClient

client = SpotifyClient()
track = client.get_track_info("https://open.spotify.com/track/0VqSdtXseb9khdZrnYVyM1")
print(track)
print(f"Track: {track.get('name', 'Unknown')} by {(track.get('artists', [{}])[0].get('name', 'Unknown') if track.get('artists') else 'Unknown')}")

<!-- gh-comment-id:2967130033 --> @Dec-QXY commented on GitHub (Jun 12, 2025): # This is all you need to get started! from spotify_scraper import SpotifyClient client = SpotifyClient() track = client.get_track_info("https://open.spotify.com/track/0VqSdtXseb9khdZrnYVyM1") print(track) print(f"Track: {track.get('name', 'Unknown')} by {(track.get('artists', [{}])[0].get('name', 'Unknown') if track.get('artists') else 'Unknown')}")
Author
Owner

@AliAkhtari78 commented on GitHub (Jun 12, 2025):

Hi @Dec-QXY,

Thank you for reporting this issue! I've identified and fixed the problem. The error was caused by the JSON parser not properly handling None/null values in the track data, particularly when the artists field was null.

The Fix

I've released v2.1.5 which includes:

  • Comprehensive null checks throughout the track data extraction
  • Better error messages for debugging
  • A full test suite to prevent this issue from recurring

To Update

pip install --upgrade spotifyscraper==2.1.5

What Changed

The parser now properly handles tracks with null values for any metadata field (artists, album, etc.). Previously, when checking if a key existed in a null value (e.g., if "items" in track_data["artists"] where track_data["artists"] was None), it would throw the "argument of type 'NoneType' is not iterable" error.

Your track should now work correctly:

from spotify_scraper import SpotifyClient

client = SpotifyClient()
track = client.get_track_info("https://open.spotify.com/track/0VqSdtXseb9khdZrnYVyM1")
print(track)

Please update to v2.1.5 and let me know if the issue is resolved!

Closes #71

<!-- gh-comment-id:2967343241 --> @AliAkhtari78 commented on GitHub (Jun 12, 2025): Hi @Dec-QXY, Thank you for reporting this issue! I've identified and fixed the problem. The error was caused by the JSON parser not properly handling None/null values in the track data, particularly when the `artists` field was null. ## The Fix I've released **v2.1.5** which includes: - Comprehensive null checks throughout the track data extraction - Better error messages for debugging - A full test suite to prevent this issue from recurring ## To Update ```bash pip install --upgrade spotifyscraper==2.1.5 ``` ## What Changed The parser now properly handles tracks with null values for any metadata field (artists, album, etc.). Previously, when checking if a key existed in a null value (e.g., `if "items" in track_data["artists"]` where `track_data["artists"]` was None), it would throw the "argument of type 'NoneType' is not iterable" error. Your track should now work correctly: ```python from spotify_scraper import SpotifyClient client = SpotifyClient() track = client.get_track_info("https://open.spotify.com/track/0VqSdtXseb9khdZrnYVyM1") print(track) ``` Please update to v2.1.5 and let me know if the issue is resolved! Closes #71
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SpotifyScraper#85
No description provided.