feat: embedded own sponsorblock in youtube
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
c0ef24a28e
commit
14f1fe4b16
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -25,6 +25,7 @@
|
||||
"musify",
|
||||
"OKBLUE",
|
||||
"Referer",
|
||||
"sponsorblock",
|
||||
"tracksort",
|
||||
"unmap",
|
||||
"youtube"
|
||||
|
@ -2,8 +2,7 @@ from typing import List, Optional, Type, Tuple
|
||||
from urllib.parse import urlparse, urlunparse, parse_qs
|
||||
from enum import Enum
|
||||
|
||||
import sponsorblock
|
||||
from sponsorblock.errors import HTTPException, NotFoundException
|
||||
import python_sponsorblock
|
||||
|
||||
from ..objects import Source, DatabaseObject, Song, Target
|
||||
from .abstract import Page
|
||||
@ -63,8 +62,9 @@ class YouTube(SuperYouTube):
|
||||
)
|
||||
|
||||
# the stuff with the connection is, to ensure sponsorblock uses the proxies, my programm does
|
||||
_sponsorblock_connection: Connection = Connection(host="https://sponsor.ajay.app/")
|
||||
self.sponsorblock_client = sponsorblock.Client(session=_sponsorblock_connection.session)
|
||||
_sponsorblock_connection: Connection = Connection()
|
||||
self.sponsorblock = python_sponsorblock.SponsorBlock(silent=True, session=_sponsorblock_connection.session)
|
||||
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@ -344,10 +344,10 @@ class YouTube(SuperYouTube):
|
||||
|
||||
segments = []
|
||||
try:
|
||||
segments = self.sponsorblock_client.get_skip_segments(parsed.id)
|
||||
segments = self.sponsorblock.get_segments(parsed.id)
|
||||
except NotFoundException:
|
||||
self.LOGGER.debug(f"No sponsor found for the video {parsed.id}.")
|
||||
except HTTPException as e:
|
||||
self.LOGGER.warning(f"{e}")
|
||||
|
||||
return [(segment.start, segment.end) for segment in segments]
|
||||
return [(segment.segment[0], segment.segment[1]) for segment in segments]
|
||||
|
@ -3,8 +3,7 @@ from urllib.parse import urlparse, urlunparse, parse_qs
|
||||
from enum import Enum
|
||||
import requests
|
||||
|
||||
import sponsorblock
|
||||
from sponsorblock.errors import HTTPException, NotFoundException
|
||||
import python_sponsorblock
|
||||
|
||||
from ...objects import Source, DatabaseObject, Song, Target
|
||||
from ..abstract import Page
|
||||
@ -143,9 +142,8 @@ class SuperYouTube(Page):
|
||||
)
|
||||
|
||||
# the stuff with the connection is, to ensure sponsorblock uses the proxies, my programm does
|
||||
_sponsorblock_connection: Connection = Connection(host="https://sponsor.ajay.app/")
|
||||
self.sponsorblock_client = sponsorblock.Client(session=_sponsorblock_connection.session)
|
||||
|
||||
_sponsorblock_connection: Connection = Connection()
|
||||
self.sponsorblock = python_sponsorblock.SponsorBlock(silent=True, session=_sponsorblock_connection.session)
|
||||
|
||||
def get_source_type(self, source: Source) -> Optional[Type[DatabaseObject]]:
|
||||
_url_type = {
|
||||
@ -213,10 +211,10 @@ class SuperYouTube(Page):
|
||||
|
||||
segments = []
|
||||
try:
|
||||
segments = self.sponsorblock_client.get_skip_segments(parsed.id)
|
||||
segments = self.sponsorblock.get_segments(parsed.id)
|
||||
except NotFoundException:
|
||||
self.LOGGER.debug(f"No sponsor found for the video {parsed.id}.")
|
||||
except HTTPException as e:
|
||||
self.LOGGER.warning(f"{e}")
|
||||
|
||||
return [(segment.start, segment.end) for segment in segments]
|
||||
return [(segment.segment[0], segment.segment[1]) for segment in segments]
|
||||
|
@ -69,7 +69,7 @@ dependencies = [
|
||||
"toml~=0.10.2",
|
||||
"typing_extensions~=4.7.1",
|
||||
|
||||
"sponsorblock~=0.1.3",
|
||||
"python-sponsorblock~=0.0.0",
|
||||
"youtube_dl",
|
||||
]
|
||||
dynamic = [
|
||||
|
@ -1,25 +0,0 @@
|
||||
requests~=2.31.0
|
||||
mutagen~=1.46.0
|
||||
musicbrainzngs~=0.7.1
|
||||
jellyfish~=0.9.0
|
||||
beautifulsoup4~=4.11.1
|
||||
pycountry~=24.0.1
|
||||
python-dateutil~=2.8.2
|
||||
pandoc~=2.3
|
||||
SQLAlchemy~=2.0.7
|
||||
setuptools~=68.2.0
|
||||
tqdm~=4.65.0
|
||||
ffmpeg-python~=0.2.0
|
||||
platformdirs~=4.2.0
|
||||
transliterate~=1.10.2
|
||||
sponsorblock~=0.1.3
|
||||
regex~=2022.9.13
|
||||
pyffmpeg~=2.4.2.18
|
||||
ffmpeg-progress-yield~=0.7.8
|
||||
pathvalidate~=2.5.2
|
||||
guppy3~=3.1.3
|
||||
toml~=0.10.2
|
||||
typing_extensions~=4.7.1
|
||||
responses~=0.24.1
|
||||
youtube_dl
|
||||
merge_args~=0.1.5
|
Loading…
Reference in New Issue
Block a user