faissaloo / SponSkrub

Strip advertisements from downloaded YouTube videos
GNU General Public License v3.0
177 stars 7 forks source link

Segments not retrieved: "Couldn't connect to the Sponsorblock API. Nothing to be done." #28

Closed andrewjmetzger closed 3 years ago

andrewjmetzger commented 3 years ago

Running SponSkrub v3.7.0, I cannot get the program to download any segment information for videos. However, manually making a request to the API URL works as expected.

Example commands with error:

$ sponskrub 'U_JlkXTdFD4' ./sponsor-original.mp4 ./sponsor-scrubbed.mp4
Downloading video sponsor data
Couldn't connect to the Sponsorblock API
Nothing to be done.

$ ls -l  ./sponsor-*.mp4
-rw-r--r-- 1 andrewjmetzger 197121 27076869 Mar  3 14:41 ./sponsor-original.mp4

Successful GET request via browser, API responds with all submitted sponsor segments:

# Valid request to API

https://sponsor.ajay.app/api/skipSegments
  ?videoID=U_JlkXTdFD4
  &categories=["sponsor", "intro", "outro", "interaction", "selfpromo", "music_offtopic"]

# produces the following response

[
    {
        "category": "intro",
        "segment": [
            0,
            22.457329
        ],
        "UUID": "461ef04c222a25e8a76e5bf045cf0d8d7e5a75e57087080d22b75c1a5d6906c1"
    },
    {
        "category": "selfpromo",
        "segment": [
            0,
            10.800239
        ],
        "UUID": "a9a2eae2bc5be674df72a18954cc93588d8530852f1f30e2232c633f30838deb"
    },
    {
        "category": "sponsor",
        "segment": [
            0,
            11.223306
        ],
        "UUID": "1e8fddf56e2eba66c75ace4c4c08f6b430fc7d130fe9193ae35a6d1b8f11f89c"
    },
    {
        "category": "outro",
        "segment": [
            317.529572,
            348.541
        ],
        "UUID": "100757dc9a0636eddb40e7788d603afc5991dfb6511cfdc5efb9e021594c1d41"
    }
]

But, no scrubbed video is generated. Please advise, thank you!

faissaloo commented 3 years ago

I cannot reproduce this, it looks to me like you have some sort of firewall or something preventing Sponskrub from connecting to the internet. You might be able to get around this by either correcting your firewall settings or routing Sponskrub through a proxy.

andrewjmetzger commented 3 years ago

Hmm. Nothing in my firewall is blocking access, and after explicitly allowing sponskrub through, I still get the same result. The SponsorBlock browser extensions all work as expected. Is there a debug option or build I could run to give us more information to troubleshoot this?

faissaloo commented 3 years ago

I probably should add a debug option at some point but for now try this custom build and let me know what it spits out: https://files.catbox.moe/8jiw44

andrewjmetzger commented 3 years ago
$ ./sponskrub-debug 'U_JlkXTdFD4' input.webm output.webm
Downloading video sponsor data
Surgically removing the shilling...
[libopus @ 0x5572763c90c0] No bit rate set. Defaulting to 96000 bps.
frame=10108 fps= 17 q=0.0 Lsize=   12677kB time=00:05:37.31 bitrate= 307.9kbits/s speed=0.562x
Done!

Thanks, it worked! What's different about this build? Usually I just:

# install dlang

$ sudo wget https://netcologne.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list
$ sudo apt-get update --allow-insecure-repositories
$ sudo apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring
$ sudo apt-get update
$ sudo apt-get install dmd-compiler dub -y --allow-unauthenticated

# Update and build SponSkrub

$ git clone git@github.com:faissaloo/SponSkrub.git # Initial clone command
$ git pull
Already up to date.
$ dub build :sponskrub
Performing "debug" build using /usr/bin/dmd for x86_64.
sponskrub:sponskrub ~master: building configuration "application"...
Linking...
$ sponskrub 'foo' input.video output.video
...
andrewjmetzger commented 3 years ago

Odd, this seems to be an issue with my build of Ubuntu 20.04, but it also occurs on Windows. I had to install libcurl4 to get the master branch to work. Windows requres libcurl.dll, which can be added as follows:

  1. Get curl from https://curl.haxx.se/windows/
  2. Extract the archive and browse into ./bin
  3. On 64-bit systems, copy libcurl_x64.dll and name the second copy libcurl.dll. 32-bit systems can skip this step
  4. Copy and paste (or symlink) libcurl.dll into the same directory as sponsorblock.exe
faissaloo commented 3 years ago

I'll add libcurl4 as dependency, thanks for looking into this