Official-Husko / mul-tor

Your tool for easy file uploading and sharing.
Mozilla Public License 2.0
15 stars 5 forks source link

[REQUEST] Remove expire date when uploading to Buzzheavier. #41

Closed M4RCK5 closed 4 days ago

M4RCK5 commented 4 weeks ago

Is your feature request related to a problem? Please describe. When uploading to Buzzheavier the files expire in 4 months, what about changing it to unlimited with torrent support??

Describe the solution you'd like In the devs section of their site says how to upload files without expire date and with torrent support: curl -#o - -T "sample.mp4" "https://w.buzzheavier.com/t/sample.mp4" | cat

Describe alternatives you've considered Making a little batch script just for this, i know isnt hard at all but i think it could be a good thing for Mul-Tor

M4RCK5 commented 3 weeks ago

Came up with this little batch script:

-supports the progress metter/bar of curl -drag and drop files inside the script window -stores the link in a txt file next to the script -checks if the file its already uploaded using md5 hash -retries failed uploads -supports accounts/folders (full url or just id)

made some "not so usefull changes" just to make it easier to read lines starting with colons are to add support for burner files & expiry .

@echo off
title Buzzheavier Uploader
color 09

rem To prevent changing the workdir when running as admin.
cd /d "%~dp0"

rem To support UTF-8.
>nul chcp 65001

:: set "expiry=0"
:: set "burner=False"
set "torrent=False"
set "api_key="
set "folder_id="
:: for /f "tokens=2 delims= " %%a in ('if exist BZH-Config.txt findstr Expiry BZH-Config.txt') do set expiry=%%a
:: for /f "tokens=2 delims= " %%a in ('if exist BZH-Config.txt findstr Burner BZH-Config.txt') do set burner=%%a
for /f "tokens=2 delims= " %%a in ('if exist BZH-Config.txt findstr Torrent BZH-Config.txt') do set torrent=%%a
for /f "tokens=2 delims= " %%a in ('if exist BZH-Config.txt findstr API-Key BZH-Config.txt') do set api_key=%%a
for /f "tokens=2 delims= " %%a in ('if exist BZH-Config.txt findstr Folder-ID BZH-Config.txt') do set folder_id=%%a

:start
call :title
echo 1-Upload.
:: echo 2-Expiry:  [%expiry%]
:: echo 3-Burner:  [%burner%]
echo 2-Torrent: [%torrent%]
echo 3-API Key: [%api_key%]
echo 4-Folder:  [%folder_id%]

echo.
choice /c 1234 /n /m "Choose an option: "

call :title
if %errorlevel% equ 1 goto :files
:: if %errorlevel% equ 2 set /p "expiry=Expiry: "
:: if %errorlevel% equ 2 if "%burner%"=="False" (set "burner=True") else (set "burner=False")
if %errorlevel% equ 2 if "%torrent%"=="False" (set "torrent=True") else (set "torrent=False")
if %errorlevel% equ 3 set /p "api_key=API Key: "
if %errorlevel% equ 4 set /p "folder_id=Folder: "

:: set "expiry= %expiry%"
:: set expiry=%expiry: =%
:: if not defined expiry set expiry=0
set "api_key= %api_key%"
set api_key=%api_key: =%
for /f "tokens=4 delims=/" %%a in ("%folder_id%") do set folder_id=%%a
set "folder_id= %folder_id%"
set "folder_id=%folder_id: =%"

:: >BZH-Config.txt echo Expiry= %expiry%
:: >>BZH-Config.txt echo Burner= %burner%
>BZH-Config.txt echo Torrent= %torrent%
>>BZH-Config.txt echo API-Key= %api_key%
>>BZH-Config.txt echo Folder-ID= %folder_id%

if %errorlevel% gtr 1 goto :start

:files
call :title

if defined folder_id if not defined api_key (
    echo API-Key not defined.
    echo.
    pause
    goto :start
)

if "%torrent%"=="True" (set "torrent_url=/t") else (set "torrent_url=")
if defined folder_id (set "folder_url=https://buzzheavier.com/fl/%folder_id%") else (set "folder_url=None")

rem Blame CMD (https://www.robvanderwoude.com/escapechars.php).
echo *Avoid using special characters.
echo.

set "files="
set /p "files=Files: "

set "empty_input_test= %files%"
set empty_input_test=%empty_input_test: =%
if not defined empty_input_test goto start

:upload
call :title
setlocal enabledelayedexpansion

for %%a in (%files%) do (
    rem URL encoding changes spaces to "%20", variable expansion escaped using "%%".
    set filename_url_encoded=%%~nxa
    set filename_url_encoded=!filename_url_encoded: =%%20!

    if not exist "%%~fa" (
        rem Using some special sings in filenames could lead to unexpected behaviour, trying to escape all of them using string substitution its a pain in the ass and not always reliable.
        echo File "%%~nxa" not found.
        echo.
    ) else if %%~za equ 0 (
        echo File "%%~nxa" empty.
        echo.
    )

    if exist "%%~fa" if %%~za gtr 0 (
        echo Verifing "%%~nxa" MD5 hash...
        echo.

        for /f "delims=" %%b in ('certutil -hashfile ^"%%~fa^" MD5 ^| findstr /v :') do set md5_hash=%%b

        findstr "!md5_hash!" "BZH-Links.txt" >nul 2>&1 && (
            set "already_uploaded=1"
            echo File "%%~nxa" already uploaded.
            echo.
        ) || set "already_uploaded=0"
    )

    rem Seems that when u chain IF statements that use comparision operators u need to enclose the values in double quotes otherwise they will not work.
    if exist "%%~fa" if "%%~za" gtr "0" if "!already_uploaded!" equ "0" (
        echo Uploading "%%~nxa", please wait...
        echo.

        :: expiry=%expiry%&burner=%burner%&
        for /f "tokens=2 delims=:" %%b in ('call curl.exe -H "Authorization: Bearer %api_key%" -T "%%~fa" "https://w.buzzheavier.com%torrent_url%/!filename_url_encoded!?folderId=%folder_id%"') do (
            set output=%%b
            set output=!output:"=!
            set output=!output:}=!
            set output=https://buzzheavier.com/f/!output!
            echo.
            echo !output!
            echo.
            echo.
            :: Expiry: %expiry% - Burner: %burner%
            >>BZH-Links.txt echo !date! - !time! - [%%~nxa](!output!^) - Folder: %folder_url% - Torrent: %torrent% - MD5 Hash: !md5_hash!
        )

        if not defined output (
            endlocal
            timeout /t 7
            goto :upload
        )
    )
)

endlocal
pause
goto :start

:title
cls
echo.
echo ----Buzzheavier Uploader----
echo.
goto :eof
Official-Husko commented 3 weeks ago

Is your feature request related to a problem? Please describe. When uploading to Buzzheavier the files expire in 4 months, what about changing it to unlimited with torrent support??

Describe the solution you'd like In the devs section of their site says how to upload files without expire date and with torrent support: curl -#o - -T "sample.mp4" "https://w.buzzheavier.com/t/sample.mp4" | cat

Describe alternatives you've considered Making a little batch script just for this, i know isnt hard at all but i think it could be a good thing for Mul-Tor

While reverse engineering some sites i found that either they didn't check the entered data with which i was able to abuse by entering any time i please regarding file lifetime or which had infinite time like this but i decided to not abuse these loopholes or things so i went with multiple months for all of the scripts that had some time option. What i can offer is instead of hardcoding this i could add an option for certain hosts so the user can enable it. If there is no specific need for long file lifetimes then its better if they are by default expiring after some time in my opinion.

Regarding the torrent support one. I was looking into that and while making the site script for it the feature was broken from what i have seen. The torrent file i got from it was not working it was actually an invalid file so i skipped it for the time being but since it seems to be working i can definitely add it now.

M4RCK5 commented 3 weeks ago

Is your feature request related to a problem? Please describe. When uploading to Buzzheavier the files expire in 4 months, what about changing it to unlimited with torrent support?? Describe the solution you'd like In the devs section of their site says how to upload files without expire date and with torrent support: curl -#o - -T "sample.mp4" "https://w.buzzheavier.com/t/sample.mp4" | cat Describe alternatives you've considered Making a little batch script just for this, i know isnt hard at all but i think it could be a good thing for Mul-Tor

While reverse engineering some sites i found that either they didn't check the entered data with which i was able to abuse by entering any time i please regarding file lifetime or which had infinite time like this but i decided to not abuse these loopholes or things so i went with multiple months for all of the scripts that had some time option. What i can offer is instead of hardcoding this i could add an option for certain hosts so the user can enable it. If there is no specific need for long file lifetimes then its better if they are by default expiring after some time in my opinion.

Regarding the torrent support one. I was looking into that and while making the site script for it the feature was broken from what i have seen. The torrent file i got from it was not working it was actually an invalid file so i skipped it for the time being but since it seems to be working i can definitely add it now.

Having the option for the sites that "officialy support it" could be great (i dont recommend adding the option to the ones that dont have it without reverse enginering them, it could be abused and patched later, its up to you of course)

Official-Husko commented 3 weeks ago

Is your feature request related to a problem? Please describe. When uploading to Buzzheavier the files expire in 4 months, what about changing it to unlimited with torrent support?? Describe the solution you'd like In the devs section of their site says how to upload files without expire date and with torrent support: curl -#o - -T "sample.mp4" "https://w.buzzheavier.com/t/sample.mp4" | cat Describe alternatives you've considered Making a little batch script just for this, i know isnt hard at all but i think it could be a good thing for Mul-Tor

While reverse engineering some sites i found that either they didn't check the entered data with which i was able to abuse by entering any time i please regarding file lifetime or which had infinite time like this but i decided to not abuse these loopholes or things so i went with multiple months for all of the scripts that had some time option. What i can offer is instead of hardcoding this i could add an option for certain hosts so the user can enable it. If there is no specific need for long file lifetimes then its better if they are by default expiring after some time in my opinion. Regarding the torrent support one. I was looking into that and while making the site script for it the feature was broken from what i have seen. The torrent file i got from it was not working it was actually an invalid file so i skipped it for the time being but since it seems to be working i can definitely add it now.

Having the option for the sites that "officiali support it" could be great (i dont recommend adding the option to the ones that dont have it without reverse enginering them, it could be abused and patched later, its up to you of course)

Sounds like the perfect compromise to me: handshake gif

I will add it to the todo list to make sure its present in the next major 2.0 release.

M4RCK5 commented 3 weeks ago

@Official-Husko sorry for bringing this up again but made some changes to the script that ive wrote before, could be a temporary solution for buzzheavier users untill Mul-Tor 2.0 comes, anyways thanks for ur great work

Official-Husko commented 5 days ago

@M4RCK5 From what i saw torrents are now created right out of the box for uploaded files. Can you confirm this?

M4RCK5 commented 4 days ago

@M4RCK5 From what i saw torrents are now created right out of the box for uploaded files. Can you confirm this?

Yeah they are, i reported some bugs related to the torrents so they should work fine now, also they added an mirror domain called flashbang.sh to bypass isp protections

Official-Husko commented 4 days ago

@M4RCK5 From what i saw torrents are now created right out of the box for uploaded files. Can you confirm this?

Yeah they are, i reported some bugs related to the torrents so they should work fine now, also they added an mirror domain called flashbang.sh to bypass isp protections

I think there are even more mirrors if I'm not wrong. Either way i have made a commit that removes the expiry date for buzzheavier. I will try to push the update today. It includes a few fixes and the pixeldrain update to get it working again.

M4RCK5 commented 4 days ago

@M4RCK5 From what i saw torrents are now created right out of the box for uploaded files. Can you confirm this?

Yeah they are, i reported some bugs related to the torrents so they should work fine now, also they added an mirror domain called flashbang.sh to bypass isp protections

I think there are even more mirrors if I'm not wrong. Either way i have made a commit that removes the expiry date for buzzheavier. I will try to push the update today. It includes a few fixes and the pixeldrain update to get it working again.

Yeah they added trashbytes.net yesterday. Also about the update, ill test it whenever u release it so no rush, if i find any bug ill let u know.