(回到頂部)
+ ## 設定 Lava 提供了一些簡單的設定讓你能夠輕鬆地自定義你的音樂機器人,像是: diff --git a/configs/application.yml b/configs/application.yml index 73b02cf4..69200410 100644 --- a/configs/application.yml +++ b/configs/application.yml @@ -1,74 +1,65 @@ -server: # REST and WS server - port: 2333 - address: 0.0.0.0 lavalink: - server: - password: "youshallnotpass" - sources: - youtube: false - bandcamp: true - soundcloud: true - twitch: true - vimeo: true - http: true - local: false - filters: - volume: true - equalizer: true - karaoke: true - timescale: true - tremolo: true - vibrato: true - distortion: true - rotation: true - channelMix: true - lowPass: true - bufferDurationMs: 400 - frameBufferDurationMs: 5000 - opusEncodingQuality: 10 - resamplingQuality: HIGH - trackStuckThresholdMs: 10000 - useSeekGhosting: true - youtubePlaylistLoadLimit: 6 - playerUpdateInterval: 5 - youtubeSearchEnabled: true - soundcloudSearchEnabled: true - gc-warnings: true - plugins: - - dependency: "dev.lavalink.youtube:youtube-plugin:1.5.2" - snapshot: false - -plugins: - youtube: - enabled: true - allowSearch: true - allowDirectVideoIds: true - allowDirectPlaylistIds: true - clients: [ "MUSIC", "ANDROID", "WEB" ] - -metrics: - prometheus: - enabled: false - endpoint: /metrics - + plugins: + - dependency: dev.lavalink.youtube:youtube-plugin:1.7.2 + snapshot: false + server: + bufferDurationMs: 400 + filters: + channelMix: true + distortion: true + equalizer: true + karaoke: true + lowPass: true + rotation: true + timescale: true + tremolo: true + vibrato: true + volume: true + frameBufferDurationMs: 5000 + gc-warnings: true + opusEncodingQuality: 10 + password: youshallnotpass + playerUpdateInterval: 5 + resamplingQuality: HIGH + soundcloudSearchEnabled: true + sources: + bandcamp: true + http: true + local: false + soundcloud: true + twitch: true + vimeo: true + youtube: false + trackStuckThresholdMs: 10000 + useSeekGhosting: true + youtubePlaylistLoadLimit: 6 + youtubeSearchEnabled: true logging: - file: - path: ./logs/ - - level: - root: INFO - lavalink: INFO - - request: - enabled: true - includeClientInfo: true - includeHeaders: false - includeQueryString: true - includePayload: true - maxPayloadLength: 10000 - - - logback: - rollingpolicy: - max-file-size: 1GB - max-history: 30 + file: + path: ./logs/ + level: + lavalink: INFO + root: INFO + logback: + rollingpolicy: + max-file-size: 1GB + max-history: 30 + request: + enabled: true + includeClientInfo: true + includeHeaders: false + includePayload: true + includeQueryString: true + maxPayloadLength: 10000 +metrics: + prometheus: + enabled: false + endpoint: /metrics +plugins: + youtube: + pot: + token: "Paste your po_token here" + visitorData: "paste your visitor_data here" +server: + address: 0.0.0.0 + port: 2333 diff --git a/img/player-en.png b/img/player-en.png index 8b1f3f55..cca0990d 100644 Binary files a/img/player-en.png and b/img/player-en.png differ diff --git a/img/player.png b/img/player.png index 0106dda0..bfa9cd5b 100644 Binary files a/img/player.png and b/img/player.png differ diff --git a/poToken_generator.py b/poToken_generator.py new file mode 100644 index 00000000..d266effa --- /dev/null +++ b/poToken_generator.py @@ -0,0 +1,31 @@ +from nodriver import start, cdp, loop +import json +import sys + + +async def main(): # pylint: disable=W0613 + browser = await start(headless=False) + print("[INFO] launching browser.") + tab = browser.main_tab + tab.add_handler(cdp.network.RequestWillBeSent, send_handler) + await browser.get('https://www.youtube.com/embed/jNQXAC9IVRw') + await tab.wait(cdp.network.RequestWillBeSent) + button_play = await tab.select("#movie_player") + await button_play.click() + await tab.wait(cdp.network.RequestWillBeSent) + print("[INFO] waiting additional 30 seconds for slower connections.") + await tab.sleep(30) + + +async def send_handler(event: cdp.network.RequestWillBeSent): # pylint: disable=W0613 + if "/youtubei/v1/player" in event.request.url: + post_data = event.request.post_data + post_data_json = json.loads(post_data) + print("visitor_data: " + post_data_json["context"]["client"]["visitorData"]) + print("po_token: " + post_data_json["serviceIntegrityDimensions"]["poToken"]) + sys.exit(0) + return + + +if __name__ == '__main__': + loop().run_until_complete(main()) diff --git a/requirements.txt b/requirements.txt index ba598e11..65031b10 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,8 +8,10 @@ python-dotenv==1.0.1 yt-dlp==2024.7.9 aiohttp==3.9.5 imageio==2.35.0 -syncedlyrics==1.0.0 pylrc==0.1.2 +syncedlyrics==1.0.0 +nodriver==0.32 +undetected-chromedriver==3.5.5 colorlog git+https://github.com/Nat1anWasTaken/Lavalink.py.git git+https://github.com/Snipy7374/disnake-ext-paginator.git \ No newline at end of file