apastel/ytmusic-deleter

I keep having SyntaxError in the setup step

MisesEnForce opened this issue · 3 comments

I am logged in youtube music, did the shift+ctrl+I step, filtered "/browse" and clicked on library in the webpage.
Using you code

from ytmusicapi import YTMusic YTMusic.setup(filepath="headers_auth.json", headers_raw="<headers copied above>")

from [https://ytmusicapi.readthedocs.io/en/latest/setup.html](your doc), whatever I replaced <headers copied above> with, I keep having errors like :

C:\Users\boreduser\Downloads\test>python test.py File "C:\Users\boreduser\Downloads\test\test.py", line 2 "},{""key"":""ca_type"",""value"":""image""}],""bid"":""ANyPxKopeuyS5v6ZDSDFhjlo7JbB7Wc3as5UrpSvQT-PJik3u3xyEdj7b_1ttfzPZKSkpryaOsW1HL90izQgJmT4VdG_2vW3nQ""}}}""") ^ SyntaxError: invalid syntax

Could you please give and exemple of correctly filled code so that I could see what to do ?Thx

I'm not sure what you're trying to do here. I am not the author of ytmusicapi. I am the author of this repo that you're commenting on, ytmusic-deleter. If you need help with ytmusic-deleter, I can help you with that. If you need help writing your own python code with ytmusicapi, I would open an issue on that repository instead: https://github.com/sigma67/ytmusicapi

I am trying to use ytmusic-deleter. I can't figure out which bit of the post request I should post when the command line requires it. I tried a lot of bits, without success. In your https://github.com/apastel/ytmusic-deleter, 4., you point to the "authenticated request" part of the [https://ytmusicapi.readthedocs.io/en/latest/setup.html](ytmusicapi doc) ; there I tried what has to be done for chrome and for firefox, without success (for instance their "copy everything starting from “accept: /” to the end of the section"). As your command line requires that bit from the post request, and as you point to their doc I followed without success, and I you can make work your own command, I would like an example of the post request bit your comand requires. I hope it is cleear now.

The easiest way to copy the request headers is to use Firefox. As the ytmusicapi docs state, there is a button you can click that will automatically copy the part of the request headers that you need. You don't need to figure out which part of the request to copy if you just use that button.

  • Copy the request headers (right click > copy > copy request headers)

Again, if you click that copy request headers button in the right-click context menu, that will automatically copy the request headers to your clipboard. From there, just paste that into the command window. Then (if you're on Windows), press Enter to add a line break, then Ctrl+Z, then Enter again.

In your first message I saw you were creating a Python file called test.py. You do not need to write any Python code to use ytmusic-deleter. Maybe you were reading too far in the ytmusicapi docs and you started following the "Using the headers in your project" section. You do not need to follow that section. ytmusic-deleter IS the project and I have already written the code :)