A GUI application for searching The Pirate Bay by usernames and terms, built with CustomTkinter and Pmw. It saves search data to CSV, sorts results, and displays clickable torrent links. Multiple users and terms can be targeted and sorted at once and relevant links from the torrent's page are also displayed (e.g., screenshots).
- Search torrents by usernames and search terms.
- Save and load search data to/from CSV files.
- Sort results by date, size, seeders and more.
- Display clickable Pirate Bay URLs, magnet links, and relevant URLs (e.g., screenshots).
- Modern interface with CustomTkinter, scalable to different screen sizes.
- Tooltips for navigation using Pmw.Balloon.
- Python 3.8+: Ensure Python is installed with
tclandtk(usually included by default). - Install dependencies from
requirements.txt:pip install -r requirements.txt
- PyInstaller: Required for building the executable (optional for running):
pip install pyinstaller
PirateUserSearcherGUI.py: Main application script.Resources/: Directory containing images (storm.jpg,pirate.png, etc.) and theme (harle.json).PirateUserSearcherGUI.spec: PyInstaller specification file for building the executable.requirements.txt: Lists all Python dependencies required to run the application.
To run the application directly (without building an executable):
- Clone the repository:
git clone https://github.com/AutomationsByAuto/PirateUserSearcherGUI.git cd PirateUserSearcherGUI - Install dependencies:
pip install -r requirements.txt
- Ensure all resources are in the
Resources/directory (see below). - Run the script:
python PirateUserSearcherGUI.py
To create a standalone executable, use PyInstaller with the provided PirateUserSearcherGUI.spec file. You must customize the .spec file to include the path to your Pmw library and match your system’s file paths for Python libraries and the Resources/ folder.
- Ensure the
Resources/directory is in the project root. - Verify the following files are in
Resources/:- Images:
storm.jpg,pirate.png,pirate.ico,home.png,form.png,delete.png,search.png,back.png,coffee.png,selected.png,unselected.png - Theme:
harle.json
- Images:
- Confirm file names match those referenced in
PirateUserSearcherGUI.py.
The PirateUserSearcherGUI.spec file specifies paths to resources and Python libraries. You must update the datas section to include the path to your Pmw library and other system-specific paths.
-
Locate Your Python Environment and Pmw Path:
- Find your Python installation’s
site-packagesandtcl/tkdirectories. Examples:- Windows:
C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python313\Lib\site-packages,C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python313\tcl\tcl8.6,C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python313\tcl\tk8.6 - Linux:
/usr/lib/python3.9/site-packages,/usr/lib/tcl8.6,/usr/lib/tk8.6 - macOS:
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
- Windows:
- Locate the
Pmwlibrary in yoursite-packagesdirectory (e.g.,<path-to-your-python>/Lib/site-packages/Pmw). - Use Python to find
site-packages:python -c "import site; print(site.getsitepackages())"
- Find your Python installation’s
-
Update the
.specFile:- Open
PirateUserSearcherGUI.specand modify thedatassection to include thePmwpath and other resources. Below is a sample.specwith placeholders:a = Analysis( ['PirateUserSearcherGUI.py'], pathex=[], binaries=[], datas=[ ('<path-to-your-python>/Lib/site-packages/Pmw', 'Pmw'), ('<path-to-your-python>/tcl/tcl8.6', 'tcl'), ('<path-to-your-python>/tcl/tk8.6', 'tk'), ('Resources/storm.jpg', 'Resources'), ('Resources/pirate.png', 'Resources'), ('Resources/home.png', 'Resources'), ('Resources/form.png', 'Resources'), ('Resources/delete.png', 'Resources'), ('Resources/search.png', 'Resources'), ('Resources/back.png', 'Resources'), ('Resources/coffee.png', 'Resources'), ('Resources/selected.png', 'Resources'), ('Resources/unselected.png', 'Resources'), ('Resources/harle.json', 'Resources'), ('Resources/pirate.ico', 'Resources') ], hiddenimports=['Pmw', 'Pmw.Balloon', 'tkinter', 'customtkinter', 'Pmw.Color', 'Pmw.MessageDialog', 'Pmw.ScrolledText', 'PIL', 'PIL.Image', 'PIL.ImageTk'], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[], noarchive=False, optimize=0, ) pyz = PYZ(a.pure) exe = EXE( pyz, a.scripts, [], exclude_binaries=True, name='PirateUserSearcherGUI', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, console=True, # Set to False for no console window disable_windowed_traceback=False, argv_emulation=False, target_arch=None, codesign_identity=None, entitlements_file=None, ) coll = COLLECT( exe, a.binaries, a.datas, strip=False, upx=True, upx_exclude=[], name='PirateUserSearcherGUI', )
- Replace
<path-to-your-python>with your Python installation path (e.g.,C:/Users/<YourUsername>/AppData/Local/Programs/Python/Python313). - Ensure the
Pmwpath points to thePmwdirectory in yoursite-packages(e.g.,C:/Users/<YourUsername>/AppData/Local/Programs/Python/Python313/Lib/site-packages/Pmw). - Ensure
Resources/paths point to the project’sResources/directory (e.g.,Resources/storm.jpgassumes the file is inproject/Resources/). - The
Resourcesdestination indatas(e.g.,('Resources/harle.json', 'Resources')) ensures files are placed in aResources/subfolder in the built executable, matching the script’sresource_path("Resources/<filename>")usage.
- Open
-
Verify Resources:
- Confirm all listed files exist in the project’s
Resources/directory. - Missing files will cause
FileNotFoundErrorat runtime.
- Confirm all listed files exist in the project’s
- Run PyInstaller with the customized
.spec:pyinstaller PirateUserSearcherGUI.spec
- Find the executable in
dist/PirateUserSearcherGUI/.
Run the executable:
# Windows
.\dist\PirateUserSearcherGUI\PirateUserSearcherGUI.exe
# Linux/macOS
./dist/PirateUserSearcherGUI/PirateUserSearcherGUI- Check for errors in the console (if
console=Truein.spec). - Verify the GUI loads with the custom theme (
harle.json), background (storm.jpg), button icons, and tooltips.
- Resources Folder: The
Resources/folder is critical. It contains all images and theharle.jsontheme file. Ensure it is included in the repository and placed in the project root. - Why Customize the
.spec?: The.specfile tells PyInstaller where to find resources and libraries, includingPmw. Paths are system-specific, so users must update them. The script uses aresource_pathfunction to locate files in PyInstaller’s_MEIPASSdirectory, requiring the.specto bundle files into aResources/subfolder. - Single-File Executable: For a single
.exe, modify the.spec:Remove theexe = EXE( pyz, a.scripts, a.binaries, a.datas, name='PirateUserSearcherGUI', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, console=False, )
coll = COLLECTblock and setexclude_binaries=False. - Fallback Theme: If
harle.jsoncauses issues, editPirateUserSearcherGUI.py:Then rebuild.# Replace: ctk.set_default_color_theme(resource_path("Resources/harle.json")) # With: ctk.set_default_color_theme("blue")
- FileNotFoundError: Ensure all resources are in
Resources/and listed indataswith destination'Resources'. Check paths in.spec, including thePmwpath. - Pmw/Tkinter Errors: Verify the
Pmw,tcl8.6, andtk8.6paths in the.specmatch your Python installation. - Console Output: Keep
console=Truein.specto see errors. Checkdist/PirateUserSearcherGUI/for logs. - Logging: Add to
PirateUserSearcherGUI.pyfor debugging:Checkimport logging logging.basicConfig(filename='app.log', level=logging.DEBUG)
app.login the executable directory. - Build Fails: Verify dependencies (
pip install -r requirements.txt) and.specpaths, especially thePmwpath indatas.
- Launch the application or executable.
- On the landing page:
- Start a fresh search or load a previous dataset (CSV).
- In the search form:
- Enter a Pirate Bay URL or proxy.
- Input usernames and search terms (comma-separated).
- Click "Check" to verify the URL, then "Search" to find torrents.
- View results:
- Sort by newest, oldest, largest, smallest, seeded, or random.
- Click magnet links or URLs to open in your browser.
- Refine results by filtering titles.
- Save data:
- Click "New Save" for a new CSV or "Overwrite" to update an existing one.
- Report issues or submit pull requests on GitHub.
- When adding resources, update
PirateUserSearcherGUI.specand document changes. - Test builds on your system and include your
.specin issue reports.
This project is licensed under the MIT License. See LICENSE for details.
Having searched for such a tool online and being unable to find one I decided to make it my next project.
This application interacts with The Pirate Bay. Use it responsibly and in compliance with applicable laws. The developers are not responsible for misuse.
Ray Pitcher - mass.automation.solutions@gmail.com
Aspiring Automation Engineer | Open to feedback and collaboration!