Skip to content

selfdeprived/sctracks.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

sctracks.py 🎵

A simple Python library to parse the most recent tracks of any SoundCloud user.

Why use sctracks?

While there are many SoundCloud API wrappers for Python, most of them struggle to fetch "Recent Tracks". This is because SoundCloud has implemented strict bot detection on that specific API section.

sctracks bypasses this by utilizing the mobile version of the site and mimicking natural user behavior (Search > Profile > Tracks) using Selenium and undetected-chromedriver.


🛠 Installation & Requirements

  1. Download: Place sctracks.py in your project folder.
  2. Dependencies: Install the required libraries: pip install selenium undetected-chromedriver

⚠️ Important: Chrome Driver Version

The undetected_chromedriver library usually handles the driver version automatically.

However, if you encounter the SessionNotCreatedException, please specify your Chrome version in the line 44 of the sctracks.py source manually:

driver = uc.Chrome(options=options, version_main=143) # Replace 143 with your Chrome major version

🚀 Usage

Simply import the library and provide the username (found in the SoundCloud profile URL)

import sctracks

# Example: https://soundcloud.com/user-470248955
tracks = sctracks.launch("user-470248955")

print(tracks)

Output Format

The library returns a list of dictionaries:

[
  {
    'title': 'and i love her', 
    'url': 'https://soundcloud.com/user-470248955/and-i-love-her',
    'cover': 'https://i1.sndcdn.com/artworks-Tz8ERTJ1qGi3c251-VxeAIw-t240x240.jpg', 
    'plays': '70.2K', 
    'duration': '0:52', 
    'uploaded': '2y'
  },
  ...
]

🔍 Debug Modes

The launch function supports two debug levels to help you monitor the scraping process:

  • None || Silent mode (default). No console output.
  • "TEXT" || Prints console logs only to track progress.
  • "FULL" || Enables logs + automatic screenshots for deep debugging.

Example:

sctracks.launch("user-470248955", debug="FULL")

🛑 Limitations & Anti-Bot Note

Please be aware that parsing a large number of profiles in a short period may cause the anti-bot system to flag your IP address. Use responsibly and consider adding delays between requests if scraping multiple users.

About

A lightweight Python library to parse a user's recent SoundCloud tracks, bypassing the anti-bot!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages