• If you need help or want to discuss things, you now can also join us on our Discord Server!

could not decode downloader output: json: cannot unmarshal number 127.37 into Go struct field YTDLFormat.abr of type int

olokos

Insider
Insider
Flyth has prepared version beta-14 and it has fixed youtube-dl and now it works with the 2021.04.01 youtube-dl once again!

I'm not sure if I'm allowed to share it with you guys, so you'd have to wait for flyth to make an official release. :)
 

DokGrej

Member
The issue is caused by a slight change in youtube-dl's metadata output.
After a refactoring, it stores the 'adr' value as a floating -point number, but sinusbot expects an integer.
I patched youtube-dl and restored the old behaviour.
You can find a patched executable on github: https://github.com/Clubfan22/youtube-dl/releases/tag/2021.04.01-sinusbot
However, if you don't trust me (and really, you shouldn't just execute any code found on the internet!), you can build youtube-dl by yourself from my patched version: https://github.com/Clubfan22/youtube-dl

I don't plan on filing an upstream issue for youtube-dl because it really is a problem caused by sinusbot and should be fixed with a sinusbot update.
chmod o+x /usr/local/bin/youtube-dl-patch-new
I uploaded everything according to this, set the path as it was given and unfortunately a few minutes fine and after a while it did not work anymore.
The same problem all the time.
fdgggfg.png
 
if someone is interested i made a update script for youtube dl to work with sinusbot, as it is only one line of code in one file to change, this is very easy to automate. My version is executed inside the root folder, you might want to change that:

#!/bin/bash

cd /root/ytdl/
rm -R *
git clone https://github.com/ytdl-org/youtube-dl
cd /root/ytdl/youtube-dl/youtube_dl/extractor/
perl -i -pe 's/.*/ dct["abr"] = int(tbr) / if $.==1617' youtube.py #you could also use awk or sed if no perl installed
cd /root/ytdl/youtube-dl/
make youtube-dl
cp youtube-dl /usr/local/bin/


keep in mind this is not reliable, if the youtube-dl code changes and the code to change is not longer in line 1617 then it does not work anymore. but for now this should work for some time :D Hopefully by then we have a sinusbot fix. Make shure you have installed, Python, Perl, ZIP and Git for this to work. Sorry for my bad english.
 
Last edited:

Bigsby

Member
if someone is interested i made a update script for youtube dl to work with sinusbot, as it is only one line of code in one file to change, this is very easy to automate. My version is executed inside the root folder, you might want to change that:

#!/bin/bash

cd /root/ytdl/
rm -R *
git clone https://github.com/ytdl-org/youtube-dl
cd /root/ytdl/youtube-dl/youtube_dl/extractor/
perl -i -pe 's/.*/ dct["abr"] = int(tbr) / if $.==1617' youtube.py #you could also use awk or sed if no perl installed
cd /root/ytdl/youtube-dl/
make youtube-dl
cp youtube-dl /usr/local/bin/


keep in mind this is not reliable, if the youtube-dl code changes and the code to change is not longer in line 1617 then it does not work anymore. but for now this should work for some time :D Hopefully by then we have a sinusbot fix. Sorry for my bad english.

Not sure if this is my bad as I've not used make before but I get this:

mkdir -p zip
for d in youtube_dl youtube_dl/downloader youtube_dl/extractor youtube_dl/postprocessor ; do \
mkdir -p zip/$d ;\
cp -pPR $d/*.py zip/$d/ ;\
done
touch -t 200001010101 zip/youtube_dl/*.py zip/youtube_dl/*/*.py
mv zip/youtube_dl/__main__.py zip/
cd zip ; zip -q ../youtube-dl youtube_dl/*.py youtube_dl/*/*.py __main__.py
/bin/sh: 1: zip: not found
make: *** [Makefile:65: youtube-dl] Error 127
 
Not sure if this is my bad as I've not used make before but I get this:

mkdir -p zip
for d in youtube_dl youtube_dl/downloader youtube_dl/extractor youtube_dl/postprocessor ; do \
mkdir -p zip/$d ;\
cp -pPR $d/*.py zip/$d/ ;\
done
touch -t 200001010101 zip/youtube_dl/*.py zip/youtube_dl/*/*.py
mv zip/youtube_dl/__main__.py zip/
cd zip ; zip -q ../youtube-dl youtube_dl/*.py youtube_dl/*/*.py __main__.py
/bin/sh: 1: zip: not found
make: *** [Makefile:65: youtube-dl] Error 127
"Zip : not found" you need to sudo apt install zip. :D Make sure you have installed, Python, Perl, ZIP and Git for this to work. Sorry i'am very bad in writing tutorials or writing in general XD
 
Last edited:

Bigsby

Member
"Zip : not found" you need to sudo apt install zip. :D Make sure you have installed, Python, Perl, ZIP and Git for this to work. Sorry i'am very bad in writing tutorials or writing in general XD
Thanks for your help, I had presumed zip meant .zip and not a program called ZIP 😂
This compiled now hoever when I copy it in and go to Sinusbot it says youtube-dl not found 1617663433542.png
I have edited the config.ini to: YoutubeDLPath = "/usr/local/bin/youtube-dl" and restarted the docker image but still no good.

Any ideas what to try next?
 

MauriceR

Donor
is awesome!
Contributor
Thanks for your help, I had presumed zip meant .zip and not a program called ZIP 😂
This compiled now hoever when I copy it in and go to Sinusbot it says youtube-dl not found View attachment 4321
I have edited the config.ini to: YoutubeDLPath = "/usr/local/bin/youtube-dl" and restarted the docker image but still no good.

Any ideas what to try next?
Are you sure that your youtube-dl file is stored in "/usr/local/bin/youtube-dl"
 

Bigsby

Member
Are you sure that your youtube-dl file is stored in "/usr/local/bin/youtube-dl"
yes I can see it here:
[email protected]:/home/bigsby/docker/sinusbot/youtube-dl# ls
youtube-dl youtube-dl-2021.01.16 youtube-dl-2021.04.01


And my docker image has a volume to map this to the /usr/local/bin
1617663802537.png

unless I am missing something (and that is very possible) it should be all correct
 
Thanks for your help, I had presumed zip meant .zip and not a program called ZIP 😂
This compiled now hoever when I copy it in and go to Sinusbot it says youtube-dl not found View attachment 4321
I have edited the config.ini to: YoutubeDLPath = "/usr/local/bin/youtube-dl" and restarted the docker image but still no good.

Any ideas what to try next?

yes I can see it here:
[email protected]:/home/bigsby/docker/sinusbot/youtube-dl# ls
youtube-dl youtube-dl-2021.01.16 youtube-dl-2021.04.01


And my docker image has a volume to map this to the /usr/local/bin
View attachment 4322

unless I am missing something (and that is very possible) it should be all correct
Not sure about this docker stuff, i've never used docker images. Have you restarted sinusbot by "sudo service sinusbot restart"? The reason is that i really don't know what this docker stuff is doing. maybe restarting the images only keeps the state in memory....
 

Bigsby

Member
Not sure about this docker stuff, i've never used docker images. Have you restarted sinusbot by "sudo service sinusbot restart"? The reason is that i really don't know what this docker stuff is doing. maybe restarting the images only keeps the state in memory....
No probs, I know not everyone uses the docker file.
I can't run the restart due to it being containerised but I can switch the youtube-dl version back to: YoutubeDLPath = "/usr/local/bin/youtube-dl-2021.01.16" & restart the container and the error changes back to 1617668027638.pngso my guess is it is reloading the config but for some reason not working. I will try the file MauriceR put in the thread and see if that works.

Edit: just realised that is an exe so not going to help me here. Can anyone be so kind as to upload there compiled youtube-dl file for me to try?
 
No probs, I know not everyone uses the docker file.
I can't run the restart due to it being containerised but I can switch the youtube-dl version back to: YoutubeDLPath = "/usr/local/bin/youtube-dl-2021.01.16" & restart the container and the error changes back to View attachment 4323so my guess is it is reloading the config but for some reason not working. I will try the file MauriceR put in the thread and see if that works.

Edit: just realised that is an exe so not going to help me here. Can anyone be so kind as to upload there compiled youtube-dl file for me to try?
have you already try the file in: this post? Anyways, i attached my youtube-dl, it compiled yesterday with my script :D
 

Attachments

  • youtube-dl.zip
    1.6 MB · Views: 53
sadly it wont work for my setup, official linux docker (image: sinusbot/docker) i changed the youtube-dl file and set "chmod a+rx youtube-dl"
but it gives the same error on every version of youtube-dl, tried latest, patch from this thread and older.

1617705570342.png

SInusbot version: SinusBot 1.0.0-beta.10-202ee4d
 

Bigsby

Member
sadly it wont work for my setup, official linux docker (image: sinusbot/docker) i changed the youtube-dl file and set "chmod a+rx youtube-dl"
but it gives the same error on every version of youtube-dl, tried latest, patch from this thread and older.

View attachment 4326

SInusbot version: SinusBot 1.0.0-beta.10-202ee4d
Just to check, are you changing the config.ini file to point to the new Youtube-DL file
 
Just to check, are you changing the config.ini file to point to the new Youtube-DL file
im using a folder setup something like this:
in folder "main"
volumes:
- ./sinusbot/scripts:/opt/sinusbot/scripts
- ./sinusbot/data:/opt/sinusbot/data

main/youtube-dl

config: YoutubeDLPath = "youtube-dl"

also the log seems ok:

2021/04/06 10:44:11 [GENERAL/YTDL ] INFO youtube-dl checking...
2021/04/06 10:44:12 [GENERAL/YTDL ] INFO youtube-dl version compatible, support enabled

maybe it does auto update?

Updating youtube-dl...
Updating to version 2021.04.01 ...
Updated youtube-dl. Restart youtube-dl to use the new version.
2021.04.01

but the filesize and date does not change
 

Bigsby

Member
So for me these are my volumes:
1617709279149.png
my config.ini file located in /home/bigsby/docker/sinusbot/data is set to YoutubeDLPath = "/usr/local/bin/youtube-dl" and this way the Youtube-dl version can be swapped out with the compiled version from this forum.
I think you will need to change your connfig.ini file to point to wherever your custom youtube-dl file is otherwise it will just use the one baked into the container.

Hope that helps
 
So for me these are my volumes:
View attachment 4328
my config.ini file located in /home/bigsby/docker/sinusbot/data is set to YoutubeDLPath = "/usr/local/bin/youtube-dl" and this way the Youtube-dl version can be swapped out with the compiled version from this forum.
I think you will need to change your connfig.ini file to point to wherever your custom youtube-dl file is otherwise it will just use the one baked into the container.

Hope that helps
it was just as you wrote, it used the baked in version.

It works now, thanks to your help and the volume path, thank you very much, was my own fault after all :D
 

Bigsby

Member
it was just as you wrote, it used the baked in version.

It works now, thanks to your help and the volume path, thank you very much, was my own fault after all :D
No probs & thanks to the rest of the guys in this thread as they helped me fix mine
 
Top