mirror of
https://github.com/tubearchivist/tubearchivist-plex.git
synced 2026-03-23 20:37:11 +00:00
[GH-ISSUE #26] [Installation Help]: Most videos don't show in Plex, Metadata sync errors #9
Labels
No labels
bug
bug
documentation
duplicate
enhancement
good first issue
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tubearchivist/archived-tubearchivist-plex#9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @micaharies on GitHub (Oct 28, 2023).
Original GitHub issue: https://github.com/tubearchivist/tubearchivist-plex/issues/26
Installation instructions
Operating System
Ubuntu Server, docker
Your installation or setup question
Hi! I'm having issues getting Plex and TA to play nice. I have around 1500~ videos archived right now, but only 4 channels show up with less than 20 videos for each. The plugin is throwing an error as well. I'm assuming I did something wrong during setup of either TA or this plugin but I haven't been able to track down exactly what is wrong. When I use the docker internal IP for the ta_config.json file and plex library, it throws the 111 error. when I use the reverse proxy URL it 403s. When I use the host IP, it 400s. Maybe a docker network issue?
Any help would be massively appreciated!
Thanks!!
Relevant log output
@lamusmaser commented on GitHub (Nov 9, 2023):
There is currently an issue where the Agent cannot handle IP addresses as part of the request. Beyond this, we would have expected that the reverse proxy should have gone through, so I would ask if you can reach out to that same URL in a browser what kind of response you get.
Docker internal IP would only work if they are on the same Docker network, but also see issue 1, where IP addresses are currently not able to be handled.
@micaharies commented on GitHub (Nov 9, 2023):
from what I can tell it still seems to be broken even with the proper URL
@lamusmaser commented on GitHub (Nov 9, 2023):
Looks like the log snippet is not showing the full set. Can you include a more complete log response, at the very least from the "Attempting to connecting to TubeArchivist..." statement forward? I think there are details that are being missed based on that section of code.
Just as a quick check, as well, can you also provide the permissions of the
ta_config.jsonfile?@micaharies commented on GitHub (Nov 9, 2023):
Not seeing the "Attempting to connecting to TubeArchivist..." part in Plex logs at all.

Perms for the ta_config file are the same as Plex
@lamusmaser commented on GitHub (Nov 9, 2023):
OK, can we review the full logs, then? There is definitely something still missing that isn't allowing me to troubleshoot this fully.
@micaharies commented on GitHub (Nov 9, 2023):
this is what shows after a reboot and scanning the folder

@lamusmaser commented on GitHub (Nov 9, 2023):
Gotcha. Can we get the logs from
/config/Library/Application Support/Plex Media Server/Logs/TubeArchivist Scanner/_root_.scanner.logfrom within the container? This should be the location of the Scanner's logs based on the details presented.@micaharies commented on GitHub (Nov 9, 2023):
just repeats those few lines over and over
@lamusmaser commented on GitHub (Nov 9, 2023):
Just running through that section again manually, it does look like it instantiates the Request object, which is then passed on to the
read_urlfunction, and that should be able to make the request using the header that supplies the Authorization Token. So, what we need to determine is why it is running differently for you and passing back a Forbidden response. Additionally, I need to look into why it isn't handling that response.Based on the earlier images, it looks like the API key is expected to be the same between the two, but please just validate that all of the characters are the same, again.
Next steps would be attempting to make the same connection attempt from within the Plex container and see if it is getting stuck from there.
If you want to try that, I would attempt to make a curl request from the Plex container to the reverse proxy URL you are trying to reach. Let me know if you need help formatting a full request.
@micaharies commented on GitHub (Nov 9, 2023):
I just double checked that those are the correct API keys and they are. I probably do need help with the curl request, honestly not super familiar with all that
@lamusmaser commented on GitHub (Nov 10, 2023):
You can utilize it following the following format:
curl -L -H "Authorization: Token XXXXXXXXXXXXXXXXXXXXXXXXXXX" https://subdomain.example.com/api/pingLet's just walk through each of these flags, more details found here.
-Lis forLocation, which follows a redirection. Many reverse proxies enforce a redirection of some kind. This follows their recommendation for where to go with that request.-His forHeaders, which allows custom headers to be included. We are only providing theAuthorizationheader, along with the token. You only need to replace theXXXXXXXXXXXXXXXXXXXXXXXXXXXsection with your API key.Finally, the end is the full URL that you are pointing to. We are, as you know from your request earlier, pointing to the
/api/pingendpoint.This should allow it to request the JSON response. If curl does not exist on the Plex container, let me know and I'll get a copy of the container to determine next steps.
@micaharies commented on GitHub (Nov 10, 2023):
thanks for the explanation! this is what it returned with
@lamusmaser commented on GitHub (Nov 10, 2023):
In terms of what we were expecting, that's great! It means that the connection is working as expected and the Plex container can reach out to the TubeArchivist endpoint successfully. What it also means is that there is some other reason why it is getting a 403 error, and I'm not sure why that is occurring, but it could be several things. Let me look into it more and I'll get back to you about what we can do for a next step.
In the meantime, could you follow these instructions and let's rule out an issue from the Plex Token? I might need to add those instructions back in if this does work:
Setup the
X-Plex-Tokenfile. This should be a file in thePlex Media Serverdirectory, so the file would be/config/Library/Application Support/Plex Media Server/X-Plex-Tokenfor your configuration.@micaharies commented on GitHub (Nov 10, 2023):
I am aware of how to find the token with the XML file but I don't see a file anywhere in that folder. Is it just supposed to be a text file with the token or something like that?
@lamusmaser commented on GitHub (Nov 13, 2023):
You have to create the file if it doesn't exist.
Let me know if generating that and restarting Plex starts working. If not, I'll finish my code review and figure out what else might be potentially causing this issue.
@micaharies commented on GitHub (Nov 13, 2023):
sorry, is this supposed to be a text file with the X-Plex-Token in it? There is no file in the directory. How do I generate this? That Plex article didnt really say anything about generating a file.
@lamusmaser commented on GitHub (Nov 13, 2023):
Correct. So, the easiest way would be to create the file and add the token inside.
Something like:
In order, that would open the file in the text editor,
vi, then sends it toInsert Mode. Paste in the token value by itself, no changes, then hit theescapekey to exitInsert Mode. Finally, the last set of characters will save and exitvi. I can provide instructions for other Linux text editors if you feel more comfortable in another one orviis not available on your system.@micaharies commented on GitHub (Nov 13, 2023):
went ahead and generated that and restarted the container and I'm still getting this error in the scanner logs
@lamusmaser commented on GitHub (Nov 13, 2023):
OK, thank you for testing that. Just wanted to see if that was causing it.
I'll draft up a next step for troubleshooting, which will probably be Python-based, to see what is causing it. Give me some time - I'm focused on another task at the moment and I will probably run out of time today to get to drafting that here.
@micaharies commented on GitHub (Nov 13, 2023):
No worries, thank you so much!! I really appreciate the help so far
@lamusmaser commented on GitHub (Nov 13, 2023):
Alright, on the system that is hosting Plex, start a python2.7 console. Running
python2should get you into the IDE (confirm it is running the Python 2 version in the preamble). Once there, run through the following steps, one line at a time. I will only need the response at the end and any associated errors. I went through these exact steps on my Plex hosting system, so they should be similar.I would expect it to be similar to mine:
@micaharies commented on GitHub (Nov 14, 2023):
I keep getting this when I run the
url_contentpart, is it supposed to include the https part of the URL?@lamusmaser commented on GitHub (Nov 14, 2023):
Ah, yes, I should have specified. Try it again as
https://tube.mhaire.net.@micaharies commented on GitHub (Nov 14, 2023):
still seems to be doing it
@lamusmaser commented on GitHub (Nov 14, 2023):
Oh, I see it. Remove the
<and>around the URL. That will help it out.@micaharies commented on GitHub (Nov 14, 2023):
sorry about that, this is where I'm at now
@lamusmaser commented on GitHub (Nov 14, 2023):
The only time that I am getting the Error 403 on my side is when I remove the headers, so that tells me that the issue probably stemming from the header section. There is only one thing in the header, so can you provide the screenshot that includes:
TA_CONFIG['ta_api_key'], showing the first three characters and last three characters of the key (you can blur the rest, just want to make sure there isn't something extraneous).request_urlwith the full line (contains no details, just string-format replacements for earlier variables).url_contentrequest viaurlopen.If an error does occur, provide the following, as well:
request_url.get_host()request_url.get_method()request_url.get_type()request_url.header_items()[showing the first three characters and last three characters of the key (you can blur the rest, just want to make sure there isn't something extraneous)]@micaharies commented on GitHub (Nov 14, 2023):
This is what I got, same error I believe
@lamusmaser commented on GitHub (Nov 14, 2023):
Which reverse proxy do you have in front of this? I am able to fully replicate those steps and it comes back with a 200 Response, so it would either have to be the application rejecting it (which we can verify from the TubeArchivist logs) or the proxy rejecting it or some aspect of the response (in which I need more details to understand which details I need to look for).
@micaharies commented on GitHub (Nov 14, 2023):
I'm using Apache, would there be logs somewhere I could check to see if that's the problem?
@lamusmaser commented on GitHub (Nov 14, 2023):
There might be some in the Apache logs, but results for
mod_proxyare limited when discussing logs. By default, it seems they would be in either/var/log/apache2or/var/log/httpd. Alternatively, do you haveOrderoperator? If so, do you have it set toOrder allow, denyorOrder deny, allow? Additionally, do you have anAllowoperator, and is the Plex host configured to be allowed access?@micaharies commented on GitHub (Nov 14, 2023):
Looking through logs in the
/var/log/apache2folder there doesn't seem to be anything. I checked theerror.log,error.log.1, andaccess.logthere wasn't anything regarding the TA proxy. The httpd folder doesn't seem to exist at all. I don't have the Order operator used afaik, that was never anything I personally setup@lamusmaser commented on GitHub (Nov 14, 2023):
Can I review the configuration that you have for the TA proxy?
@micaharies commented on GitHub (Nov 14, 2023):
this is what i've got, basically everything I use that's reverse proxied is effectively the same thing with ports and URL changed
@lamusmaser commented on GitHub (Nov 14, 2023):
This does look like it is a good configuration that shouldn't be overzealous. Do you have a
mod_securitymodule that is in use somewhere? That's the only thing that I can see.Beyond this, I would say that we should do some testing from the TA side and see if that is where the 403 is being thrown from.
@micaharies commented on GitHub (Nov 14, 2023):
I don't have mod security, though now that I think about it I do run everything proxied behind CloudFlare. Any chance that would be an issue?
@lamusmaser commented on GitHub (Nov 14, 2023):
Oh, that could be it. Does CloudFlare have any restrictions on hosts that can access the site?
@micaharies commented on GitHub (Nov 14, 2023):
I don't believe so? Honestly I haven't had a problem like this before, even with 40+ docker containers currently installed with tons of internet facing websites and systems. I can turn proxy off and try again and see what happens
@micaharies commented on GitHub (Nov 15, 2023):
I opened Plex this morning and it appears it's working! I guess the CloudFlare proxy did break it. Never would've guessed that was the problem. Thank you so much for your help, it's super appreciated!!
ta-config.jsonto beta_config.json, rename sample file. #54