Plex - 429 Too Many Requests

I wasn't aware before this that I needed to install this separate package, too. Once I did so, I was able to make connections using the normal localhost (and set my port to 7900 to keep it away from everything else).

I was just looking in /tmp because I saw that it was updating files there. Once I realized the directory structure under /config, I was able to find the files you were thinking:

This was actually different than what I saw in the OliveTin thread, so now I have the correct mount, too:

image

Seems to be updating regularly and correctly so far, so thanks for the clarifications! FYI, this was my first attempt at using OliveTin for Channels and learning curve was steep!

Ah OK, I figured you were a wily OliveTin veteran by now. :slight_smile: The project has grown substantially from the early days, now with more than two dozen Actions available -- so I can see where you'd say that. Hopefully this Plex tool will work well for you, and you'll find other Actions of value, as that's where the real payoff lies.

1 Like

Hmmm....seems like data-raw and quoted inputs weren't enough to prevent problems on the token generation. I updated the gist to have curl do the urlencode on the passed parms (no added function definition needed). You will still need to single quote the values on the command line.

Thanks @jsmart138 and @bnhf for letting me know.

1 Like

Here's a How-To get the above Bash Shell Scripts (PlexIPTV.sh and plextoken.sh) up and running for Channels-dvr running in an existing fancybits/channels-dvr Docker Container. I already have a long Docker to-do list with all my other HomeLab Containers, so I was keen to get this up and running in the bare minimum number of steps just using the current channels-dvr Docker Container. Basic steps are:

  1. Figure out what Host folder has already been mapped to your Channels-dvr Container from the Container's script (or alternatively use your own location BUT then you pick up add'l steps for mapping it to the Container). For the fancybits Container, that location is: /mnt/disk/dvr/

  2. Manually (as root) create the ../iptv subfolders that the Bash Scripts intended to create in your (default Linux install) Home folder but do so in said (default Container install) Host subfolder location already accessible to the fancybits Container. (Or alternatively, as mentioned above, pick your own location, including the Home location in the Script, but then you pick up the work of setting up and maintaining the mapping of that location to the Container.) Set appropriate Permissions for those specific newly created subfolders (i.e., so the Scripts can be run as non-root, and the Results can be read by the Channels-dvr Container).

For example, whereas the plextoken.sh Script wants to create a certain additional folders in the (default Linux install) ~/channels-dvr folder:

$ mkdir -p ~/channels-dvr/iptv/plex

Instead, create these in a location where the fancybits Container already thinks its /channels-dvr folder is located:

$ sudo mkdir -p /mnt/disk/dvr/config/iptv/plex
  1. Patch the Bash Scripts to use the New Host Container folder location (above, or one you created/mapped) instead of the Home folder location that the Container cannot access.

For example, Replace the string:

~/channels-dvr/iptv/plex

With:

/mnt/disk/dvr/config/iptv/plex

Obviously some of the Code can now instead simply be commented out (e.g, mkdir call).

  1. Run (+/- further debug/edit, as necessary) plextoken.sh Script to obtain Plex token. Unfortunately for me, 90% of my time here was spent on this step so I will elaborate to help others avoid my particular problem. The plextoken.sh Script (at the time of this posting) bombs on a '%' char in the password (regardless of how you Quote it). I therefore had to feed that Script a URL Encoded version of my password so that the Script could correctly use it as part of a URL that it ultimately sends (cleartext btw) to the Plex token server. Prior comments above elaborate on this issue. Simple non-techie solution is to just have a Password with only URL-friendly chars (e.g., Mixed-case alphanumeric). Once the correct token file is generated, you are good to go running the PlexIPTV.sh Script.

  2. Create your “Plex” Source in Channels-dvr WebUI (as previously shown above). The Container can access the .m3u8 and .xml files directly from the Host File System simply using File syntax.

File | Source:

/channels-dvr/iptv/plex/us.m3u8

XMLTV Guide Data:

file:///channels-dvr/iptv/plex/us.xml

Edit: To the extent channels-dvr needs to access the XML file via HTTP protocol, I run the (built-in) Python HTTP.Server at an arbitrary Port (e.g., 8095) and feed the XMLTV Guide Data text field the URL of the Host IP (e.g., 192.168.1.99) and XML:

python3 -m http.server 8095 &

XMLTV Guide Data:

http://192.168.1.99:8095:/us.xml

BTW, any old pre-existing broken Plex Source must be either deleted or de-prioritized before you can access the individual Channels from your new working Plex Source.

  1. Create a user Cron job to periodically run PlexIPTV.sh, for refreshing .m3mu and .xml files.

Enjoy. The Bash Scripts nicely remove a nagging thorn from using Plex Live TV feeds. !!!BIG THANKS!!! to John9527 for creating them.

Plex is just fully un-useable to watch.

Recordings on some of the channels i have enabled seem to be ok, but i see in logs every couple min it drops connection, and re-establishes.

But live watching, some times it fails to tune immediately, sometimes, works for a few min.

I have painfully compared the channels enabled in the plex m3u,. and managed to find some of them in Pluto and Samsung m3us i also have. A few outliers though... but seems there is no easy solution for this issues of too many requests. See some Docker based solutions, and some sort of scripts., but nothing super easy for Windows... i won't waste my time tinkering with things for the few channels i rarely even watch... so, proably just gonna delete plex as a source.

I am using the https://i.mjh.nz/Plex/us.m3u8 link that was recommend on this form.

Is there any other ulr for Plex that does not have this issue?

1 Like

I had this working with @john9527 scripts for a couple of months and it was awesome. Then I started getting token errors. Tried to login to plex.tv with the creds manually and it gave me a wrong password error. Odd, I didn't change it and it is strong and unique, but whatever. Changed it, updated my plextoken.sh script, and I get an unspecified error generating a token every time.
My username and password were already in single quotes. My special character is a exclamation in this case (random via password-gen tool), so shouldn't need special encoding but....it fails. I tried manually escaping with \ just in case, still fails so I set it back. Any ideas on how to workaround getting a plextoken and plexdata set up?

curl was still being picky about doing a data-urlencode.
Grab the latest version of plextoken.sh from the gist.

Also....Plex really doesn't document how they expire tokens. After not accessing a plex channel for a couple of days, I also had to generate a new token after it had been working for a month.

Appreciate the info. I realized I could go into the "failed" plextoken file and it would show me the specific error the log wasn't showing. It says "password is missing". No idea what the issue is. I've tried (with the updated script) USERID and PASSWD on the same line and on separate lines, single quotes as before, just doesn't process the password.

I got the 'password is missing' error as well, and the change I just made fixed it for me. I'll take another look.

EDIT: Changed my password to mimic yours with a single exclamation point and the updated script is still working. Not sure what to try next.

1 Like

Well.....I saw you updated the script so I used that and it just worked. Go figure, LOL. Thanks for your efforts.

Well, I should say that it said it worked and I should get an email from Plex, which is of course a good sign. But the script log (user scripts on Unraid) still shows the failure. So not out of the woods just yet.

UPDATE: Haven't seen a message from Plex, but it did regen the plexdata file with all 4 fields.

UPDATE 2 - Confirmed we're back in business.

2 Likes

The wonders of computing :grinning:

If you got a new token file gen'd it should be OK. I got the Plex email on all my attempts, so maybe it's just being a bit slow getting delivered.

1 Like

This method and the OliveTin version of it can still work, but in case you haven't seen it, there's a Docker now that resolves all the issues:

2 Likes

Thanks much. I'll see if I can get that going on my Unraid server the next time my token has issues.

Not sure how and how often @jgomez177 or OliveTin are generating the tokens....haven't had the opportunity to dig through their code. But, I was conservative and only generated it once (or when needed) since there really isn't any info on what will trip Plex's 'too many requests' or when the token will expire. I'm probably going to set up a scheduled job to generate a new token maybe once a week and see what happens.

EDIT: Added a new optional environment setting, NEWTOKEN='Y', to force the generation of a new token without having to manually delete the old data.
Link to the gist....

Anybody else no longer able to use Plex? The updated scripts have been working perfectly for some time, and still appear to be (I can still acquire a token and update the m3u appropriately), but I'm now getting 401 Unauthorized when trying to play any Plex channels:

I just tested streaming Plex channels remotely, and it’s working fine for me.

I set Plex up anew as a source for CDVR most recently via Project One-Click in OliveTin. I’m not entirely sure how that method differs from the two separate scripts listed in the main panel of Olive Tin, but I can confirm it is working fine, as of a minute ago.

The two Actions on the OliveTin main panel are the scripts featured here, where one first gets a token -- and then that token is used to generate an M3U (which is then hosted on a URL by OliveTin). This work was done before the Plex-for-Channels docker container was available. This method still works, but the docker approach is more straightforward, and cross-platform.

1 Like

Check out the end of this thread....one of the scripts needed an update due to a change in the source.

3 Likes

Check out the end of this thread....one of the scripts needed an update due to a change in the source.

Thank you, that was it!