Giter Site home page Giter Site logo

dmunozv04 / isponsorblocktv Goto Github PK

View Code? Open in Web Editor NEW
2.2K 11.0 92.0 265 KB

SponsorBlock client for all YouTube TV clients.

License: GNU General Public License v3.0

Python 98.86% Dockerfile 1.14%
python appletv youtube sponsorblock chromecast roku tizen-tv

isponsorblocktv's Introduction

iSponsorBlockTV

Skip sponsor segments in YouTube videos playing on a YouTube TV device (see below for compatibility details).

This project is written in asynchronous python and should be pretty quick.

Installation

Check the wiki

Warning: docker armv7 builds have been deprecated. Amd64 and arm64 builds are still available.

Compatibility

Legend: ✅ = Working, ❌ = Not working, ❔ = Not tested

Open an issue/pull request if you have tested a device that isn't listed here.

Device Status
Apple TV
Samsung TV (Tizen)
LG TV (WebOS)
Android TV
Chromecast
Google TV
Roku
Fire TV
CCwGTV
Nintendo Switch
Xbox One/Series
Playstation 4/5

Usage

Run iSponsorBlockTV on a computer that has network access. Auto discovery will require the computer to be on the same network as the device during setup. The device can also be manually added to iSponsorBlockTV with a YouTube TV code. This code can be found in the settings page of your YouTube application.

It connects to the device, watches its activity and skips any sponsor segment using the SponsorBlock API. It can also skip/mute YouTube ads.

Libraries used

Projects using this project

Contributing

  1. Fork it (https://github.com/dmunozv04/iSponsorBlockTV/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • dmunozv04 - creator and maintainer
  • HaltCatchFire - updated dependencies and improved skip logic
  • Oxixes - added support for channel whitelist and minor improvements

License

GNU GPLv3

isponsorblocktv's People

Contributors

adripo avatar an1matek avatar bertybuttface avatar boltgolt avatar cryingcavecat avatar deepsource-autofix[bot] avatar deepsourcebot avatar dependabot[bot] avatar dmunozv04 avatar haltcatchfire avatar joshcooley avatar jtokoph avatar kot0dama avatar nickgal avatar outadoc avatar oxixes avatar petkovasilev avatar pre-commit-ci[bot] avatar ravioli8235 avatar ryankupk avatar shraymonks avatar sshah7433 avatar themagic314 avatar tsia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

isponsorblocktv's Issues

SSL

Hi!

Docker run in NAS:

DEBUG:pyatv.core.protocol:Dispatching message with type 4 to <bound method PlayerStateManager._handle_set_state of <pyatv.protocols.mrp.player_state.PlayerStateManager object at 0x7f4bb4936d10>>
DEBUG:pyatv.auth.hap_channel:Sending data (Encrypted=200072c79fc370115f795734f7e04b797d6aced895e865da4a74a432df46d781564d0c90e737a5f8039fa300229ef94d86ac)
DEBUG:root:App playing is:com.google.ios.youtube
DEBUG:pyatv.core.protocol:Dispatching message with type UpdatedState.Playing to <bound method FacadePower._playing_changed of <pyatv.core.facade.FacadePower object at 0x7f4bb4936980>>
DEBUG:root:Playstatus update Media type: Unknown
Device state: Playing
Repeat: Off
Shuffle: Off
DEBUG:root:App playing is:com.google.ios.youtube
DEBUG:asyncio:<asyncio.sslproto.SSLProtocol object at 0x7f4bb4937fa0>: SSL error in data received
Traceback (most recent call last):
File "/usr/local/lib/python3.10/asyncio/sslproto.py", line 534, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "/usr/local/lib/python3.10/asyncio/sslproto.py", line 206, in feed_ssldata
self._sslobj.unwrap()
File "/usr/local/lib/python3.10/ssl.py", line 979, in unwrap
return self._sslobj.shutdown()
ssl.SSLError: [SSL: APPLICATION_DATA_AFTER_CLOSE_NOTIFY] application data after close notify (_ssl.c:2672)

Doesn't appear to work on Onn TV bare metal

I'm testing on an Onn Android TV device and it doesn't seem to be working, but I'm not quite sure if I have everything set up correctly.

I am running your app on my PC, have linked with a code (your app shows a device screen id for the Android TV device) and have gotten a YouTube Data API v3 key to associate. Is this correct? I couldn't find any step by steps for making sure I config this correctly

I tried a SponsorBlock video id that is in their database and it is still playing sponsored ads at the beginning, etc.

Add Youtube Data API to requirement

Hello,
For people that are not familiar with the Google Cloud Platform I think it could be helpful to specify the necessity to add "Youtube Data API" with the project created to get API keys.

During the setup, the installer redirects to a Google Page explaining how to get an API key but nothing about the YT API.
Maybe an extra line saying "Don't forget to add Youtube Data API to your project" ?

It may appear silly but it was the first time I used the google platform and I stupidly lost an hour searching why iSponsorBlockTV didn't worked on my Apple TV x)

Otherwise everything works perfectly, thank you for the project !

"Could not load config file"

docker run --rm -it \

-v /isponsorblocktv/app/data
--net=host
-e TERM=$TERM -e COLORTERM=$COLORTERM
ghcr.io/dmunozv04/isponsorblocktv
--setup

Running this on my raspberry pi through SSL (using root) keeps bringing me the error "Could not load config file"

SSL error in data received

Hi, great work, just super excited to see this in action. It seems my setup is detecting sponsor segments, but I'm getting an error. Hopefully this is helpful:

SSL error in data received
protocol: <asyncio.sslproto.SSLProtocol object at 0x10e95eac8>
transport: <_SelectorSocketTransport fd=11 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
File "/Users/username/.pyenv/versions/3.7.3/lib/python3.7/asyncio/sslproto.py", line 526, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "/Users/username/.pyenv/versions/3.7.3/lib/python3.7/asyncio/sslproto.py", line 207, in feed_ssldata
self._sslobj.unwrap()
File "/Users/username/.pyenv/versions/3.7.3/lib/python3.7/ssl.py", line 767, in unwrap
return self._sslobj.shutdown()
ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2609)

For what it's worth, from my searching around, I found "SSL error in data received" popping up for others in a separate project here matrix-org/pantalaimon#10 (comment). Not sure if what they're saying there about python 3.8 is helpful, but thought I might share that.

To Reproduce
Steps to reproduce the behavior:

  1. Run main.py after ensuring dependencies are available and adding credentials, yt api key, and atv identifier to config.json
  2. Pick some new L*nus tech tips video as that youtuber seems to be pretty much all sponsor (matter of fact, SponsorBlock has a new feature that labels the latest video of his as "entirely [sponsor] category"
  3. See error (any time a sponsor segment is reached on the ATV)

Expected behavior
Segment skipped

Screenshots
N/A

iSponsorBlockTV server (please complete the following information):

  • OS: macOS 11.4
  • Python version 3.7

Apple TV (please complete the following information):

  • Device: Apple TV 4k 2nd gen
  • OS: tvOS 15.3

Additional context
N/A

Container error after setup

Describe the bug
Getting the following errors in my docker container. I used the run command with net-host to do the initial setup (which there really wasn't anything to configure), saw a "Youtube on TV" device which I assume is my CCwGTV, entered my YT API key, confirmed the generated config.json file. Ads are not muted or skipped on this device, however.

Traceback (most recent call last):
  File "main.py", line 3, in <module>
    helpers.app_start()
  File "/app/iSponsorBlockTV/helpers.py", line 120, in app_start
    config.validate()
  File "/app/iSponsorBlockTV/helpers.py", line 56, in validate
    self.devices = [Device(i) for i in self.devices]
  File "/app/iSponsorBlockTV/helpers.py", line 56, in <listcomp>
    self.devices = [Device(i) for i in self.devices]
  File "/app/iSponsorBlockTV/helpers.py", line 16, in __init__
    self.__validate()
  File "/app/iSponsorBlockTV/helpers.py", line 26, in __validate
    raise ValueError("No screen id found")
ValueError: No screen id found

To Reproduce
run command for initial container:

docker run --rm -it \
-v /home/docker/isponsorblocktv:/app/data \
--net=host \
-e TERM=$TERM -e COLORTERM=$COLORTERM \
ghcr.io/dmunozv04/isponsorblocktv \
--setup

compose for permanent container:

  iSponsorBlockTV:
    image: ghcr.io/dmunozv04/isponsorblocktv
    container_name: iSponsorBlockTV
    restart: unless-stopped
    volumes:
      - /home/docker/isponsorblocktv:/app/data

Expected behavior
Ads muted and skipped on my CCwGTV.

Screenshots
image

iSponsorBlockTV server (please complete the following information):

  • OS: Docker on linux

Segments too close together, only skips one

Before opening an issue make sure that there are no duplicates and that you are on the latest version.
Describe the bug
A clear and concise description of what the bug is.
When there are two segments too close together only the first one is skipped
To Reproduce
Steps to reproduce the behavior:

  1. Video: -fEjoJO4lEM
  2. Use skip_categories: sponsor and intro

Sponsor segment not skipped after manually seeking

As the title says, the sponsor segment is not currently being skipped if you fast-forward or rewind a video.

Steps to reproduce:

  1. Play a video on YouTube
  2. Skip forward or rewind the video.
  3. Ad will not be skipped

GUI setup terminal colors

Steps to reproduce the behavior:

  1. Go to terminal.app in macOS

  2. Run the recommended docker command to use the GUI install

    docker run --rm -it \
    -v {my_path}:/app/data \
    ghcr.io/dmunozv04/isponsorblocktv \
    --setup
  3. See difficult to read text due to lack of 256 color support

Expected behavior
GUI is visible in the default terminal in the OS without needing to enable additional colors. It looked normal when launching with iTerm2

Screenshots
Screenshot 2023-10-13 at 10 02 32 PM

iSponsorBlockTV server (please complete the following information):
Docker instance running on M1 Mac Mini. Version 2.0.1

Apple TV (please complete the following information):
Apple TV 4k (2018ish)

Additional context
I also encountered the issue with not being able to exit the setup after entering the API key. The hotkey "S" doesn't seem to work. I was able to use the config file to that it created to run the app though.

Hmm doesnt seem to work here

Hey,

it doesn't seem to skip anything i tested it with 10+ videos from LTT

{"atvs": [{"identifier": "58:D3:49:CC:0E:25", "airplay_credentials": "63ab822772c306fd1623811ac0a3a99a1c....."}, {"identifier": "EC:A9:07:14:61:60", "airplay_credentials": "d641c673b0c2021b36933b7c0357e7d....."}, {"identifier": "40:CB:C0:B2:DE:D1", "airplay_credentials": "0b0117987330c8ac69c2047b679cd71...."}], "apikey": "AIzaSyAkexkdL....", "skip_categories": ["sponsor,", "selfpromo,", "exclusive_access,", "interaction,", "poi_highlight,", "intro,", "outro,", "preview,", "filler,", "music_offtopic"]}

Anything i could do to help?

Docker setup, can't find Apple TV 2022 on iOS 16.2

Describe the bug
During the setup the prompt returns 0 Apple TV's found.

iSponsorBlockTV server (please complete the following information):
Docker on UNRAID

Apple TV (please complete the following information):
Apple TV 2022, OS 16.2

New Apple Tv not found when running setup

I got a new apple tv and when I run the setup it isn't found, no identifier or airplay credentials are added to config.json. I deleted all and tried a fresh install but that also didnt work.

I run this
docker run --rm -it
--network=host
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json
-e PUID=0
-e PGID=0
-e iSPBTV_docker=
ghcr.io/dmunozv04/isponsorblocktv
--setup

in terminal I see
Found 0 Apple TV(s) in config.json. Add more? (y/n) y
I hit y but it just asks for my API key next.

output looks like this:

{"apikey": "6...", "skip_categories": ["sponsor", "selfpromo", "exclusive_access", "interaction"]}

with none of the

"atvs": [{"identifier": "D261...", "airplay_credentials"

I also tried installing docker on my mac but get the same output. On the Apple TV settings Airplay is on and Allow Access is set to Same Network. All devices are on the same network.

Must be missing something here but I am out of ideas.

If there is another way to get the identifier and airplay credentials I am happy to update the config file manually. Open to options here.

Add support for whitelistedChannels configuration

Sponsorblock itself has a "whitelistedChannels" configuration that allows certain channels to not have skipped ads. From what I can tell, this project doesn't support this at the time. As a handful of channels surprisingly have entertaining ads, I'd love to have this feature. Any plans, or am I just attempting to configure it the wrong way? For example, I tried adding just below skip_categories, as some of the browser extensions allow:

"skip_categories": ["sponsor"],
"whitelistedChannels":["agingwheels","3Dbotmaker"]

why? what happend?

my docker system support host mode

docker run -d \ 
--name=iSponsorBlockTV \ 
--restart=unless-stopped \
 --network=host \ 
 -v /opt/iSponsorBlockTV/config.json:/app/config.json \ 
-e PUID=0
-e PGID=0
ghcr.io/dmunozv04/isponsorblocktv 
--setup

get error
stderr: EOFError: EOF when reading a line
image

"Could not find video id" Using a 2022 Apple TV 4k

I am running an Apple 2022 4k now and was able to get past the issues with it not detecting during setup.

But once I have the API key added, it will pull the video ID up but not load any of the sponsorblock data to skip segments. Please see attached for the debug log and screenshot of console.

Screenshot 2023-04-16 at 10 41 46 AM

Jailbroken Apple TV?

Hi,

Do you think it would be possible to run this directly on the Apple TV if it were jailbroken?

Given that a jailbroken ATV can be attached to via SSH, and the filesystem is open to modification, could iSponsorBlockTV be installed and run directly on the device, without the need for another device?

If so, what changes would need to be made, and what requirements would be needed of the ATV in terms of available commands installed for it to work?

Thanks for a great tool!

Docker image no longer recognize my config.json

Hello,
I realized that since several days ads were not skipped anymore. I checked the container and saw that it crashed. When I try to launch I now got the message "invalid config file, please run with --setup"

Maybe it is related to a recent commit ?

Anyway, I tried to reconfigure it, with --setup but got

Found 1 Apple TV(s) in config.json. Add more? (y/n) Traceback (most recent call last): File "/app/main.py", line 3, in <module> helpers.app_start() File "/app/iSponsorBlockTV/helpers.py", line 43, in app_start config_setup.main(config, args.file, args.debug) File "/app/iSponsorBlockTV/config_setup.py", line 67, in main input("Found {} Apple TV(s) in config.json. Add more? (y/n) ".format(num_atvs)) EOFError: EOF when reading a line

Docker Installation Newb Issue

Hi, I am new to this world and just got a synology NAS with basically everything setup in docker. This sounds like a dream come true but I can't get past the installation steps.

I create the empty config.json file on my NAS. SSH in and run this:

docker run --rm -it \
--network=host \
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json \
ghcr.io/dmunozv04/isponsorblocktv \
--setup

Which gives me this error:

You are running in docker, you have to mount the config file.
Please check the README.md for more information.
Traceback (most recent call last):
  File "/app/main.py", line 3, in <module>
    helpers.app_start()
  File "/app/iSponsorBlockTV/helpers.py", line 29, in app_start
    config = load_config(args.file)
  File "/app/iSponsorBlockTV/helpers.py", line 18, in load_config
    return config
UnboundLocalError: local variable 'config' referenced before assignment

Any help/suggestions would be appreciated here. thanks.

MacOS Install Error

Following the installl instructions in the wiki, I'm getting the no such file or directory error

ScreenShot 2022-10-08 at 17 00 16

Docker Container fails after working briefly

Hey, so everything has been working perfectly for awhile and all of a sudden it gives me this error in the logs. It also will say "cant find video id" at first, then pull the skip content. After a few hours of uptime I get this:

Reconnecting to Apple TV

Discovering devices on network...

Connecting to 192.168.1.7

ERROR:asyncio:Task exception was never retrieved

future: <Task finished name='Task-8916' coro=<process_playstatus() done, defined at /app/iSponsorBlockTV/main.py:58> exception=AttributeError("'NoneType' object has no attribute 'identifier'")>

Traceback (most recent call last):

File "/app/iSponsorBlockTV/main.py", line 61, in process_playstatus

logging.debug("App playing is:" + str(atv.metadata.app.identifier))

AttributeError: 'NoneType' object has no attribute 'identifier'

Push updater started

Reconnecting to Apple TV

Discovering devices on network...

Connecting to 192.168.1.7

ERROR:asyncio:Task exception was never retrieved

future: <Task finished name='Task-8965' coro=<process_playstatus() done, defined at /app/iSponsorBlockTV/main.py:58> exception=AttributeError("'NoneType' object has no attribute 'identifier'")>

Traceback (most recent call last):

File "/app/iSponsorBlockTV/main.py", line 61, in process_playstatus

logging.debug("App playing is:" + str(atv.metadata.app.identifier))

AttributeError: 'NoneType' object has no attribute 'identifier'

Push updater started

Reconnecting to Apple TV

Discovering devices on network...

Connecting to 192.168.1.7

ERROR:asyncio:Task exception was never retrieved

future: <Task finished name='Task-9014' coro=<process_playstatus() done, defined at /app/iSponsorBlockTV/main.py:58> exception=AttributeError("'NoneType' object has no attribute 'identifier'")>

Traceback (most recent call last):

File "/app/iSponsorBlockTV/main.py", line 61, in process_playstatus

logging.debug("App playing is:" + str(atv.metadata.app.identifier))

AttributeError: 'NoneType' object has no attribute 'identifier'

Push updater started

Reconnecting to Apple TV

Discovering devices on network...

Connecting to 192.168.1.7

ERROR:asyncio:Task exception was never retrieved

future: <Task finished name='Task-9069' coro=<process_playstatus() done, defined at /app/iSponsorBlockTV/main.py:58> exception=AttributeError("'NoneType' object has no attribute 'identifier'")>

Push updater started

Traceback (most recent call last):

File "/app/iSponsorBlockTV/main.py", line 61, in process_playstatus

logging.debug("App playing is:" + str(atv.metadata.app.identifier))

AttributeError: 'NoneType' object has no attribute 'identifier'

Reconnecting to Apple TV

Discovering devices on network...

No device found, will retry

Reconnecting to Apple TV

Discovering devices on network...

Connecting to 192.168.1.7

ERROR:asyncio:Task exception was never retrieved

future: <Task finished name='Task-9134' coro=<process_playstatus() done, defined at /app/iSponsorBlockTV/main.py:58> exception=AttributeError("'NoneType' object has no attribute 'identifier'")>

Traceback (most recent call last):

File "/app/iSponsorBlockTV/main.py", line 61, in process_playstatus

logging.debug("App playing is:" + str(atv.metadata.app.identifier))

AttributeError: 'NoneType' object has no attribute 'identifier'

Push updater started

Reconnecting to Apple TV

Discovering devices on network...

Connecting to 192.168.1.56

ERROR:asyncio:Task exception was never retrieved

future: <Task finished name='Task-1' coro=<loop_atv() done, defined at /app/iSponsorBlockTV/main.py:117> exception=TimeoutError()>

Traceback (most recent call last):

File "/usr/local/lib/python3.10/asyncio/locks.py", line 390, in acquire

await fut

asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for

return fut.result()

asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/app/iSponsorBlockTV/main.py", line 134, in loop_atv

atv = await connect_atv(event_loop, identifier, airplay_credentials)

File "/app/iSponsorBlockTV/main.py", line 114, in connect_atv

return await pyatv.connect(config, loop)

File "/opt/venv/lib/python3.10/site-packages/pyatv/init.py", line 135, in connect

await atv.connect()

File "/opt/venv/lib/python3.10/site-packages/pyatv/core/facade.py", line 575, in connect

if await setup_data.connect():

File "/opt/venv/lib/python3.10/site-packages/pyatv/protocols/airplay/init.py", line 269, in _connect_rc

await mrp_connect()

File "/opt/venv/lib/python3.10/site-packages/pyatv/protocols/mrp/init.py", line 934, in _connect

await protocol.start()

File "/opt/venv/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 161, in start

await self.send_and_receive(messages.get_keyboard_session())

File "/opt/venv/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 259, in send_and_receive

return await self._receive(identifier, timeout)

File "/opt/venv/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 271, in _receive

await asyncio.wait_for(semaphore.acquire(), timeout)

File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for

raise exceptions.TimeoutError() from exc

asyncio.exceptions.TimeoutError

ERROR:asyncio:Task exception was never retrieved

future: <Task finished name='Task-9222' coro=<process_playstatus() done, defined at /app/iSponsorBlockTV/main.py:58> exception=AttributeError("'NoneType' object has no attribute 'identifier'")>

Traceback (most recent call last):

File "/app/iSponsorBlockTV/main.py", line 61, in process_playstatus

logging.debug("App playing is:" + str(atv.metadata.app.identifier))

AttributeError: 'NoneType' object has no attribute 'identifier'

"Invalid variable type" error w/ some videos

To Reproduce
Steps to reproduce the behavior:

  1. Start app
  2. Go to any video with skip segment less than 1 second apart (e.g. https://youtu.be/fXb02MQ78yQ)
  3. Jump right before ads (e.g. https://youtu.be/fXb02MQ78yQ?t=593)
  4. See error:
future: <Task finished name='Task-52' coro=<ApiHelper.mark_viewed_segments() done, defined at /Users/joombaga/projects/iSponsorBlockTV/iSponsorBlockTV/api_helpers.py:148> exception=TypeError("Invalid variable type: value should be str, int or float, got ['9e7cdc02c4495f7480f0792e005d29374e47d1fc99d7e3a57b16b53d958a8d166', ['9e1217491467df90bc592be7133dc2549b7cd55d4d280c4241c86dcd7e3e36cb6']] of type <class 'list'>")>
Traceback (most recent call last):
  File "/Users/joombaga/projects/iSponsorBlockTV/iSponsorBlockTV/api_helpers.py", line 155, in mark_viewed_segments
    await self.web_session.post(url, params=params)
  File "/Users/joombaga/projects/iSponsorBlockTV/venv/lib/python3.11/site-packages/aiohttp/client.py", line 534, in _request
    req = self._request_class(
          ^^^^^^^^^^^^^^^^^^^^
  File "/Users/joombaga/projects/iSponsorBlockTV/venv/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 280, in __init__
    url2 = url.with_query(params)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/joombaga/projects/iSponsorBlockTV/venv/lib/python3.11/site-packages/yarl/_url.py", line 1007, in with_query
    new_query = self._get_str_query(*args, **kwargs) or ""
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/joombaga/projects/iSponsorBlockTV/venv/lib/python3.11/site-packages/yarl/_url.py", line 968, in _get_str_query
    query = "&".join(self._query_seq_pairs(quoter, query.items()))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/joombaga/projects/iSponsorBlockTV/venv/lib/python3.11/site-packages/yarl/_url.py", line 929, in _query_seq_pairs
    yield quoter(key) + "=" + quoter(cls._query_var(v))
                                     ^^^^^^^^^^^^^^^^^
  File "/Users/joombaga/projects/iSponsorBlockTV/venv/lib/python3.11/site-packages/yarl/_url.py", line 946, in _query_var
    raise TypeError(
TypeError: Invalid variable type: value should be str, int or float, got ['9e7cdc02c4495f7480f0792e005d29374e47d1fc99d7e3a57b16b53d958a8d166', ['9e1217491467df90bc592be7133dc2549b7cd55d4d280c4241c86dcd7e3e36cb6']] of type <class 'list'>

Expected behavior
App should skip ad without error.

iSponsorBlockTV server (please complete the following information):

  • OS: macOS/Docker macOS arm64
  • Python 3.11, Docker

Not skipping ads

Hello,

I'm running the docker version and python version of Isponsor on a debian 10 but it's not working on my apple TV.

Peering is ok with my apple TV on TVOS 15.0, Isponsor seems ok:
starting
Discovering devices on network...
Connecting to X.X.X.X
Push updater started

When I start a youtube video, I have adds but on my computer with Isponsor I can see codes like that appear 8F2s8ivKXNY and on my API interface I can see the requests:
image

Am I wrong somewhere?

Or can I get more logs to debug this issue?

Thanks in advance,

Regards.

mute unskippable ads not working

during unskippable ads, the volume level box on top of the screen shows 0, but real volume does not change.

apple tv 4k 2022
tvos 17.1 beta
running through docker on ubuntu server 23.10

Set up on LG TV works on YouTube but blocks all other streaming services

I've got this running as a container on an Ubuntu 20 VM and it works great for automatically skipping sponsored content in YouTube on my LG G3 TV. I noticed after setting it up that I was then no longer able to stream any content from multiple streaming providers, including Netflix, Max, and Disney+. I could bring up the UI and select something to stream but the result was the same on all of them - they tried to start streaming and eventually failed. After I stopped the iSponsorBlockTV container I was immediately able to stream from these services.

The Docker container runs on an Ubuntu 20 VM running on ESXi (x86). The device is an LG G3 OLED TV running the latest version of webOS.

I am not sure why this is interfering with other streaming services on the webOS TV but it clearly seems to be. Any idea why this is happening?

Docker Container Continuously Crashing

Tried recreating config file and recreating the docker container:

  File "/app/main.py", line 3, in <module>
    helpers.app_start()
  File "/app/iSponsorBlockTV/helpers.py", line 43, in app_start
    config_setup.main(config, args.file, args.debug)
  File "/app/iSponsorBlockTV/config_setup.py", line 163, in main
    loop.run_until_complete(web_session.close())
                            ^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'web_session' where it is not associated with a value

JSONDecodeError when running main.py

Hello, I have followed all setup instructions; Installed dependencies, grabbed Identifier and credentials and filled in config.json.
When running "python3 main.py" I get the following error.
I have checked for issues in config.json and all looks ok. My knowledge of python is very limited so I am hoping you have an easy answer.

Thank You. Cool project, looking forward to the Docker deployment!

Traceback (most recent call last):
File "main.py", line 134, in
atv_config, apikey, categories = load_config()
File "main.py", line 130, in load_config
config = json.load(f)
File "/usr/lib/python3.8/json/init.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid control character at: line 4 column 347 (char 363)

Error with cache import

Traceback (most recent call last):
File "/Users/test/Downloads/iSponsorBlockTV-main/main.py", line 5, in
from cache import AsyncTTL
ModuleNotFoundError: No module named 'cache'

Any ideas? I think dependencies are installed correctly from requirements.txt and API key is saved in .json file.

EDIT: requirements.txt still lists async_lru as dependency instead of async-ttl. I installed async-ttl manually with "pip install async-ttl", but I get the same error still. All other dependencies seem to be installed. No idea what the module cache error is. Thanks

stale app identifier, skips not restricted to app.identifier == "com.google.ios.youtube"

I get attempted ad skips when using the non-YouTube apps on the Apple TV.

For instance, when watching FBI S04E14 Pride and Prejudice in the Apple TV's "Computers" app, the script searched YouTube and found 4jwUXV4QaTw (which is a YouTube video on FBI body language analysis,) and executed both of the skips despite not watching YouTube.

I see in the source:
playstatus.device_state == playstatus.device_state.Playing and app.identifier == "com.google.ios.youtube"
which seems like it should prevent that, so now I'm wondering if the app identifier is stale.

When I originally launched the script, I was in the YouTube app, but later switched to other apps. I haven't tested to verify, but I have noticed behavior possibly consistent with the identifier being cached at launch, and not updated. For instance, I think I've noticed the script continues to not work if the Apple TV isn't in the YouTube app at script launch.

Cannot find apple tv and invalid config

I'm running scripts from #36 (comment) without luck.

docker run --rm -it 
--network=host 
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json 
-e PUID=0 
-e PGID=0 
-e iSPBTV_docker= 
ghcr.io/dmunozv04/isponsorblocktv:pr-37
--setup 

it shows 0 atv found:

Found 0 Apple TV(s) in config.json. Add more? (y/n) y
done adding

when done with the setup then I run with the following script:

docker pull ghcr.io/dmunozv04/isponsorblocktv
docker run -d \
--name iSponsorBlockTV \
--restart=unless-stopped \
--network=host \
-v /root/xxx/config.json:/app/config.json \
ghcr.io/dmunozv04/isponsorblocktv \
--debug

here's the output:

Using default tag: latest
latest: Pulling from dmunozv04/isponsorblocktv
Digest: sha256:0d02ef2e6ff32eed2...d5f751c858b3acf44e225e7b7389
Status: Image is up to date for ghcr.io/dmunozv04/isponsorblocktv:latest
ghcr.io/dmunozv04/isponsorblocktv:latest
1bcadd9cddf7eececed...e2ff2dda2b882ce0de50667b87792

and here's the log:

$ docker logs xxx
invalid config file, please run with --setup
invalid config file, please run with --setup
invalid config file, please run with --setup
invalid config file, please run with --setup
invalid config file, please run with --setup
invalid config file, please run with --setup
invalid config file, please run with --setup
invalid config file, please run with --setup
invalid config file, please run with --setup

but the atvremote scan does show my atv device:

/app # atvremote scan
Scan Results
========================================
       Name: atv
   Model/SW: AppleTV14,1, Unknown OS 16.4.1
    Address: 192.xx.115
        MAC: A8:51:xx:02:CB
 Deep Sleep: False
Identifiers:
 - A8:51:xx:02:CB
 - A851xx02CB
Services:
 - Protocol: AirPlay, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
 - Protocol: Companion, Port: 49165, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
 - Protocol: RAOP, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory

       Name: my macbook pro
   Model/SW: MacBookPro16,1, Unknown OS
    Address: 192.xx.204
        MAC: 14:7D:xx:CA:3A
 Deep Sleep: False
Identifiers:
 - 14:7D:xx:CA:3A
 - 147DDxxA3A
Services:
 - Protocol: AirPlay, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory
 - Protocol: Companion, Port: 54280, Credentials: None, Requires Password: False, Password: None, Pairing: Unsupported
 - Protocol: RAOP, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: Mandatory

       Name: Living Room HomePod
   Model/SW: AudioAccessory6,1, Unknown OS 16.4.1
    Address: 192.xx.127
        MAC: AC:BC:xx:3B:7D
 Deep Sleep: False
Identifiers:
 - AC:BC:xx:3B:7D
 - ACBCxxD3B7D
Services:
 - Protocol: AirPlay, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: NotNeeded
 - Protocol: Companion, Port: 49154, Credentials: None, Requires Password: False, Password: None, Pairing: Unsupported
 - Protocol: RAOP, Port: 7000, Credentials: None, Requires Password: False, Password: None, Pairing: NotNeeded

Identifying ATV on network fails

Installed via Docker on MacOS.
Using pyatv, I found my ATV identifier:
04:4B:ED:99:FB:XX

I then used pyatv to find the airplay_credentials:
d6683fd0d2bdfca0926bfd5366b4f07191a9566fb8da04f3c03e90e76f544fc3:3a870e73c4621966cb3dadada32cc8d7e5c777f38efb9fe523118b79f699c413:36323839413335382d343336312d343945392d414442332d454241333046303144424239:39386336373835632d666330332d343463352d386561362d3337626639306637656162XX

I've updated the config.json file with these two inputs, but after restarting the docker, this is the logs I see:

Discovering devices on network...
No device found, will retry
Reconnecting to Apple TV
Discovering devices on network...

Seems to work fine on Roku

Saw that Roku was listed as untested, so tried this out with a couple of mine. Linked up fine with the codes and Just Works like magic. Completely fantastic.

Failure to Launch - not sure if it is a bug

Hi there - I see this error while attempting to launch the plist:

launchctl load ~/Library/LaunchAgents/com.dmunozv04.iSponsorBlockTV.plist

Error:

Load failed: 5: Input/output error
Try running launchctl bootstrap as root for richer errors.

Has anyone else run into this error?

Thanks!

"Please move the program to the correct path"

Installing on MacOS.

The wget produces the wrong file name, but after renaming it to iSponsorBlockTV, following the rest of the script I get to

./iSponsorBlockTV --macos_install

This gives me:

Please move the program to the correct path: /Users/<me>/iSponsorBlockTVopeing now on finder...

Note the typo and lack of space.

The instruction seems to be to move the file to where it already is.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the instructions provided, except after the wget step, rename the file.

Note also that the Mac doesn't by default have wget installed. Suggest instructions for using say curl.

Expected behavior
The installer should run.

Docker Installation error

Before opening an issue make sure that there are no duplicates and that you are on the latest version.
When I run the Docker command to install I get this error when trying to add my Apple TV to the config.json in the new docker setup procedure.

Found Living Room. Do you want to add it? (y/n) y
Traceback (most recent call last):
File "/opt/venv/lib/python3.10/site-packages/pyatv/support/init.py", line 33, in error_handler
return await func(*args, **kwargs)
File "/opt/venv/lib/python3.10/site-packages/pyatv/protocols/airplay/auth/hap.py", line 43, in start_pairing
await self.http.post("/pair-pin-start", headers=_AIRPLAY_HEADERS)
File "/opt/venv/lib/python3.10/site-packages/pyatv/support/http.py", line 359, in post
return await self.send_and_receive(
File "/opt/venv/lib/python3.10/site-packages/pyatv/support/http.py", line 412, in send_and_receive
raise exceptions.HttpError(
pyatv.exceptions.HttpError: HTTP/1.1 method POST failed with code 400: Bad Request

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/app/create_config.py", line 105, in
main()
File "/app/create_config.py", line 64, in main
loop.run_until_complete(task)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/app/create_config.py", line 42, in find_atvs
await pairing.begin()
File "/opt/venv/lib/python3.10/site-packages/pyatv/protocols/airplay/pairing.py", line 62, in begin
return await error_handler(
File "/opt/venv/lib/python3.10/site-packages/pyatv/support/init.py", line 41, in error_handler
raise fallback(str(ex)) from ex
pyatv.exceptions.PairingError: HTTP/1.1 method POST failed with code 400: Bad Request
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7fb37a81f0>

--

To Reproduce
Docker command that I ran:
docker run --rm -it
--network=host
--entrypoint /opt/venv/bin/python3
-v /home/pi/config.json:/app/config.json
ghcr.io/dmunozv04/isponsorblocktv
/app/create_config.py

Expected behavior
Adding the Apple TV correctly to the config.json file.

Screenshots
If applicable, add screenshots to help explain your problem.

iSponsorBlockTV server (please complete the following information):

  • OS: Docker on Pi 64 headless
  • Python version [e.g. 3.7] (no need to fill if running on docker

Apple TV (please complete the following information):

  • Device: Latest Apple TV 4K
  • OS: 15.4

Additional context
Add any other context about the problem here.

[Troubleshooting] Runs but doesn't skip sponsor segments.


name: Troubleshooting Request
about: Create a report to help us improve.
labels: Bug vs User Error


iSponsorBlockTV Latest Version?:
Confirmed, I am on the latest version as of typing this.

Describe the bug
This is my first install. I used pyatv and the first time setup to complete the config.json. The script runs and looks like its working in windows. But no sponsor segments are skipped. I tried rebooting the computer its installed on, rebooting the apple tv, and trying multiple newer and older videos on youtube.

iSponsorBlockTV server (please complete the following information):

  • OS: [Windows 10]
  • Python version [3.11]

Apple TV (please complete the following information):

  • Device: [Apple TV 4K 3rd generation 128 GB (2022)]
  • OS: [e.g. tvOS 16.4.1]

Additional context
--debug logs (some info obfuscated):
https://pastebin.com/XHDHCGGz

Docker full support

Docker currently works but it isn't perfect. List of issues (saving this here for future me)

  • Armv7 isn't supported

  • #8

  • Docker doesn't print any logs

Docker container restarts over and over

I attempted using the MacOS installer, but since I'm on an M1 it didn't work and I'm using Docker.

I entered the first docker command, and it didn't find my ATV:

Found 0 Apple TV(s) in config.json. Add more? (y/n) y
No devices found
Rewriting atvs (don't worry if none were saved before)

I tried running the container using the command provided anyway, and it restarts every second or so. Here's an example of what shows up in the logs:

Traceback (most recent call last):
2023-07-15 11:22:44   File "/app/main.py", line 3, in <module>
2023-07-15 11:22:44     helpers.app_start()
2023-07-15 11:22:44   File "/app/iSponsorBlockTV/helpers.py", line 53, in app_start
2023-07-15 11:22:44     main.main(
2023-07-15 11:22:44   File "/app/iSponsorBlockTV/main.py", line 146, in main
2023-07-15 11:22:44     for i in atv_configs:
2023-07-15 11:22:44 TypeError: 'NoneType' object is not iterable
2023-07-15 11:22:44 Unclosed client session
2023-07-15 11:22:44 client_session: <aiohttp.client.ClientSession object at 0xffff88ce5110>

Crash when trying to generate a config using the new tool

Describe the bug
When trying to enter the TV Code the app crashes with the following error:

╭──────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ /app/iSponsorBlockTV/setup_wizard.py:229 in changed_pairing_code                                                                                                                                                                          │
│                                                                                                                                                                                                                                           │
│   226 │                                                                                        ╭────── locals ───────╮                                                                                                                    │
│   227 │   @on(Input.Changed, "#pairing-code-input")                                            │ event = Changed()   │                                                                                                                    │
│   228 │   def changed_pairing_code(self, event: Input.Changed):                                │  self = AddDevice() │                                                                                                                    │
│ ❱ 229 │   │   self.query_one("#add-device-button").disabled = not event.validation_result.is_v ╰─────────────────────╯                                                                                                                    │
│   230 │                                                                                                                                                                                                                                   │
│   231 │   @on(Input.Submitted, "#pairing-code-input")                                                                                                                                                                                     │
│   232 │   @on(Button.Pressed, "#add-device-pin-add-button")                                                                                                                                                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
NoMatches: No nodes match <DOMQuery query='#add-device-button'>

To Reproduce

  1. docker run --rm -it -v ./data:/app/data ghcr.io/dmunozv04/isponsorblocktv --setup
  2. Add Device
  3. Add with pairing code
  4. tab down to the "Pairing Code" input
  5. type a number

Expected behavior
The number should appear.

iSponsorBlockTV server (please complete the following information):

  • OS: [e.g. Docker on linux x64]

Apple TV (please complete the following information):

  • 17.1 beta

Does not mute or skip ads on Samsung TV

Describe the bug
YouTube ads are not muted and skipped.

To Reproduce
Steps to reproduce the behavior:

  1. Play any video with ads

Expected behavior
YouTube ads should be muted and skipped.

iSponsorBlockTV server (please complete the following information):

  • OS: Docker on linux Amd64 v2.0.1

Apple TV (please complete the following information):

  • Device: Samsung Q80T
  • OS: Tizen

Additional context
Skips sponsorblock segments correctly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.