Extract direct download links from various URL formats
Project description
TrueLink
A Python library for resolving media URLs to direct download links from various file hosting services.
Features
- Asynchronous: Built with async/await for efficient handling of multiple requests
- Easy to use: Simple API with intuitive method names
- Extensible: Support for multiple file hosting platforms
- Error handling: Robust error handling for various edge cases
- URL validation: Built-in URL validation before processing
Installation
pip install truelink
Quick Start
import asyncio
from truelink import TrueLinkResolver
async def main():
resolver = TrueLinkResolver()
url = "https://buzzheavier.com/rnk4ut0lci9y"
try:
if resolver.is_supported(url):
result = await resolver.resolve(url)
print(type(result))
print(result)
else:
print(f"URL not supported: {url}")
except Exception as e:
print(f"Error processing {url}: {e}")
asyncio.run(main())
Advanced Usage
Batch Processing
import asyncio
from truelink import TrueLinkResolver
async def process_multiple_urls():
resolver = TrueLinkResolver()
urls = [
"https://buzzheavier.com/rnk4ut0lci9y",
"https://mediafire.com/file/example",
"https://gofile.io/d/example"
]
tasks = []
for url in urls:
if resolver.is_supported(url):
tasks.append(resolver.resolve(url))
results = await asyncio.gather(*tasks, return_exceptions=True)
return results
# Run batch processing
results = asyncio.run(process_multiple_urls())
API Reference
TrueLinkResolver
Methods
is_supported(url: str) -> bool: Check if a URL is supportedresolve(url: str) -> dict: Resolve URL to direct download linkget_supported_domains() -> list: Get list of supported domains
Return Format
The resolve() method returns one of two result types:
LinkResult (for single files):
{
"url": "direct_download_url",
"filename": "original_filename",
"size": 1234567, # Size in bytes (optional)
"headers": {"Authorization": "Bearer token"} # Custom headers if needed (optional)
}
FolderResult (for folders/multi-file links):
{
"title": "Folder Name",
"contents": [
{
"filename": "file1.pdf",
"url": "direct_download_url_1",
"size": 1234567,
"path": "subfolder/file1.pdf"
},
{
"filename": "file2.jpg",
"url": "direct_download_url_2",
"size": 987654,
"path": "file2.jpg"
}
],
"total_size": 2222221, # Total size of all files
"headers": {"Authorization": "Bearer token"} # Custom headers if needed (optional)
}
Supported Sites
✅ Working
- buzzheavier
- 1fichier
- fuckingfast
- gofile
- linkbox
- lulacloud
- mediafile (size parsing left)
- mediafire
- pixeldrain
- streamtape
- terabox
- tmpsend
- uploadee
- yandexlink
- wetransfer
- swisstransfer
- qiwi
- onedrive
- pcloud
⏳ Not Working
- devuploads (todo)
- doodstream
- filepress (todo)
- hxfile (server maintenance)
- krakenfiles
- uploadhaven (different)
Error Handling
The library provides comprehensive error handling:
from truelink import TrueLinkResolver, TrueLinkException
async def handle_errors():
resolver = TrueLinkResolver()
try:
result = await resolver.resolve(url)
except TrueLinkException as e:
print(f"TrueLink specific error: {e}")
except Exception as e:
print(f"General error: {e}")
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Adding Support for New Sites
- Fork the repository
- Create a new resolver module for your site
- Add the site to the supported sites list
- Submit a pull request
Requirements
- Python 3.7+
- aiohttp
- beautifulsoup4
- requests
License
This project is licensed under the MIT License - see the LICENSE file for details.
Disclaimer
This project is intended for educational and personal use only.
Downloading content using this tool must comply with the terms of service of the respective websites. The developer is not responsible for any misuse or illegal activity involving this software.
Use at your own risk.
Support
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include error messages and the URL you're trying to process
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file truelink-1.0.0.tar.gz.
File metadata
- Download URL: truelink-1.0.0.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01ddbd5b65ffe21c61d0b8b1c1d55a8f52bb06dec0068d5b3c36c7e720b0042b
|
|
| MD5 |
dc635a69050342fc5fe356897571ba76
|
|
| BLAKE2b-256 |
950407bdca74ee8610b54622a86352ae471722534a75d86363a5125d117d1bdc
|
File details
Details for the file truelink-1.0.0-py3-none-any.whl.
File metadata
- Download URL: truelink-1.0.0-py3-none-any.whl
- Upload date:
- Size: 44.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d33c003e46c302d8855fc03e86e5fc9a9fa7552e0f2ec48b9d728d6f21c52a3f
|
|
| MD5 |
e412dcdbe524a2674e89b1646e94b271
|
|
| BLAKE2b-256 |
48bfd51ab30ef24cdb8127bbee238f64111c19ddb5243f709347f361e3bc05c4
|