456 lines
26 KiB
Python
456 lines
26 KiB
Python
import logging
|
|
import os
|
|
import xml.etree.ElementTree as ET
|
|
from datetime import datetime, timezone, timedelta
|
|
from enum import Enum
|
|
|
|
logger = logging.getLogger("uvicorn")
|
|
|
|
LOG_REQUESTS = os.getenv("WRITE_REQUESTS") == "1"
|
|
LOG_FILE = "requests.log"
|
|
|
|
|
|
class Hosts(str, Enum):
|
|
PLEX = "plex.tv"
|
|
CLIENTS = "clients.plex.tv"
|
|
APP = "app.plex.tv"
|
|
COMMUNITY = "community.plex.tv"
|
|
TOGETHER = "together.plex.tv"
|
|
FEATURES = "features.plex.tv"
|
|
EPGPROVIDER = "epg.provider.plex.tv"
|
|
DISCOVERPROVIDER = "discover.provider.plex.tv"
|
|
VODPROVIDER = "vod.provider.plex.tv"
|
|
METADATAPROVIDER = "metadata.provider.plex.tv"
|
|
ANALYTICS = "analytics.plex.tv"
|
|
|
|
|
|
# Hop-by-hop headers we must strip
|
|
HOP_BY_HOP_HEADERS = {
|
|
"connection",
|
|
"keep-alive",
|
|
"proxy-authenticate",
|
|
"proxy-authorization",
|
|
"te",
|
|
"trailer",
|
|
"transfer-encoding",
|
|
"upgrade",
|
|
"content-length", # let httpx calculate
|
|
"host", # must be rewritten
|
|
}
|
|
|
|
FEATURES_DICT = [{"id": "guided-upgrade", "uuid": "c9d9b7ee-fdd9-474e-b143-5039c04e9b9b"},
|
|
{"id": "increase-password-complexity", "uuid": "9e93f8a8-7ccd-4d15-99fa-76a158027660"},
|
|
{"id": "upgrade-3ds2", "uuid": "547514ab-3284-46e5-af77-bbaff247e3fc"},
|
|
{"id": "ad-countdown-timer", "uuid": "3ae06d3a-a76b-435e-8cef-2d2008610ba2"},
|
|
{"id": "adaptive_bitrate", "uuid": "abd37b14-706c-461f-8255-fa9563882af3"},
|
|
{"id": "amazon-loop-debug", "uuid": "d1477307-4dac-4e57-9258-252e5b908693"},
|
|
{"id": "Android - Dolby Vision", "uuid": "b227c158-e062-4ff1-95d8-8ed11cecafb1"},
|
|
{"id": "Android - PiP", "uuid": "86da2200-58db-4d78-ba46-f146ba25906b"},
|
|
{"id": "artist-tv", "uuid": "2797e341-b062-46ed-862f-0acbba5dd522"},
|
|
{"id": "auto-sub-offsets", "uuid": "d4b4e08a-9201-4c99-9a52-8f2de8ff25cd"},
|
|
{"id": "avod-ad-analysis", "uuid": "c987122a-a796-432f-af00-953821c127bb"},
|
|
{"id": "avod-new-media", "uuid": "e703655b-ee05-4e24-97e3-a138da62c425"},
|
|
{"id": "blacklist_get_signin", "uuid": "bec2ba97-4b25-472b-9cfc-674f5c68c2ae"},
|
|
{"id": "blacklist-subnets", "uuid": "b3b87f19-5ccd-4b14-bb62-b9d7b982392e"},
|
|
{"id": "bypass-web-navbar-upsell-modal", "uuid": "6aaaf4fc-c55f-4042-92c8-b35f7886d249"},
|
|
{"id": "camera_upload", "uuid": "fb34e64d-cd89-47b8-8bae-a6d20c542bae"},
|
|
{"id": "CU Sunset", "uuid": "567033ef-ffee-44fb-8f90-f678077445f9"},
|
|
{"id": "chromecast-music-mp", "uuid": "58829fc9-26b8-41f4-a6c0-90ea7a11ae24"},
|
|
{"id": "client-non-destructive-comskip", "uuid": "6ab6677b-ad9b-444f-9ca1-b8027d05b3e1"},
|
|
{"id": "client-radio-stations", "uuid": "5b6190a9-77a4-477e-9fbc-c8118e35a4c1"},
|
|
{"id": "cloudsync", "uuid": "65152b75-13a9-408a-bd30-dbd23a259183"},
|
|
{"id": "cloudflare-turnstile-required", "uuid": "b25b878c-4f60-4337-9f6b-2d97ef41d036"},
|
|
{"id": "common-sense-media-ratings-premium", "uuid": "f702522e-2445-461e-a83f-fc16c1259035"},
|
|
{"id": "community-new-user-onboarding", "uuid": "c4704b28-4e26-460a-bf2e-2576d0c2cb77"},
|
|
{"id": "community-friendships-management", "uuid": "7bb1ed71-a0a3-4362-aa08-7c3fa7241578"},
|
|
{"id": "community-p2r5-onboarding", "uuid": "92c11c50-efed-4eb1-b3fb-0b249fbfc845"},
|
|
{"id": "community-phase0", "uuid": "fc3e8322-5e6e-4f4a-9d71-728c6d5656bd"},
|
|
{"id": "community-phase0-web", "uuid": "a852775a-2b74-4624-aaa3-3d624471a537"},
|
|
{"id": "community-p1", "uuid": "6272ad55-9fc0-43c6-8e1a-3f0df7a3630e"},
|
|
{"id": "community-p2-r1", "uuid": "31fcbe1f-0459-42cb-a15f-5084f62374d9"},
|
|
{"id": "community-p2-r2", "uuid": "06798ab7-4fa5-4416-9db3-f313c4292f01"},
|
|
{"id": "community-p2-r3", "uuid": "626004b8-a8b8-4fb1-9adc-8a6277f98597"},
|
|
{"id": "community-p2-r4", "uuid": "8f47a689-aa84-408f-bf6b-00015e9413e1"},
|
|
{"id": "community-p2-r5", "uuid": "36fdfb7c-f0c7-4da8-a167-4775e23cab7e"},
|
|
{"id": "community-p3r1-profiles", "uuid": "52a31c3c-c8d4-49c8-9f47-18158e5528d8"},
|
|
{"id": "community-p3r1-reactions", "uuid": "ad57040a-0b38-4862-bfcf-3fe116e9767b"},
|
|
{"id": "community-p3r1-reviews-comments-final", "uuid": "81f9b923-039c-4828-8455-14de4ffa2059"},
|
|
{"id": "community-p3r1-reviews-creation", "uuid": "6f4f6325-7d66-405f-96f7-b89b9685473e"},
|
|
{"id": "community-p3r1-reviews", "uuid": "e73456a8-8962-4151-8e57-3e61c78ed9d3"},
|
|
{"id": "comments_and_replies_push_notifications", "uuid": "7f46bf17-fabf-4f96-99a2-cf374f6eed71"},
|
|
{"id": "friend_request_push_notifications", "uuid": "c36a6985-eee3-4400-a394-c5787fad15b5"},
|
|
{"id": "community_access_plex_tv", "uuid": "3f6baa76-7488-479a-9e4f-49ff2c0d3711"},
|
|
{"id": "community_friends_group_notifications", "uuid": "dd69b465-7eb3-4c18-a1c0-7bc0015969e8"},
|
|
{"id": "companions_sonos", "uuid": "24b4cf36-b296-4002-86b7-f1adb657e76a"},
|
|
{"id": "content_filter", "uuid": "32cc8bf5-b425-4582-a52d-71b4f1cf436b"},
|
|
{"id": "create_anonymous_users", "uuid": "f6a0e423-1a83-418c-8448-a1c7105fd71a"},
|
|
{"id": "credits-markers", "uuid": "926bc176-58ca-47da-b8e3-080ed14ea6ba"},
|
|
{"id": "custom-home-removal", "uuid": "849433b0-ef60-4a71-9dd9-939bc01f5362"},
|
|
{"id": "grandfather-sync", "uuid": "7ee1495c-2798-4288-94e2-9cd98e67d441"},
|
|
{"id": "community-p3r1-reviews-comments", "uuid": "47c8dede-c75d-4015-8631-8fe5665638c8"},
|
|
{"id": "disable-facebook-auth", "uuid": "00077925-6031-401b-8679-f6617ed0cec6"},
|
|
{"id": "disable_home_user_friendships", "uuid": "d29f0ee0-3d3a-46c3-b582-4bc69bc17c29"},
|
|
{"id": "disable_sharing_friendships", "uuid": "ce8f644e-87ce-4ba5-b165-fadd69778019"},
|
|
{"id": "disco-native-ads-support", "uuid": "61ace69e-8397-432e-9d46-352a00263a7a"},
|
|
{"id": "disco-reported-issues", "uuid": "6225c337-cd26-4ff0-b864-6c6dd84c9e0d"},
|
|
{"id": "disco-director-cast-crew-updates", "uuid": "d865f64a-ca06-472d-ae01-7a444aba6251"},
|
|
{"id": "disco-epg-airings-on-detail-pages", "uuid": "e9cc7ec1-be5a-4727-af7b-0f107af1a07c"},
|
|
{"id": "discover-genre-browsing", "uuid": "2131d3dc-56c8-45d0-acec-c4683fd9a027"},
|
|
{"id": "discover-managed-related-vod", "uuid": "cb0e4c75-b1cb-43e9-97ea-6b9bc66c717b"},
|
|
{"id": "discover-managed-user-test", "uuid": "807d9881-a846-40c3-8d54-84fc490b7ba9"},
|
|
{"id": "discover-services-hub", "uuid": "ba7c4a4f-a13b-4ec0-8eb2-cd0ba2fe77f8"},
|
|
{"id": "Sync v3", "uuid": "67c80530-eae3-4500-a9fa-9b6947d0f6d1"},
|
|
{"id": "downloads-gating", "uuid": "3bfd3ccf-8c63-4dbb-8f87-9b21b402c82b"},
|
|
{"id": "drm_support", "uuid": "34e182bd-2f62-4678-a9e9-d13b3e25019d"},
|
|
{"id": "dvr", "uuid": "e8230c74-0940-4b91-9e20-6571eb068086"},
|
|
{"id": "dvr-block-unsupported-countries", "uuid": "c92d4903-bc06-4715-8ce4-4a22674abac8"},
|
|
{"id": "le_isrg_root_x1", "uuid": "af291e9e-813f-4467-8779-5d215abc3b5f"},
|
|
{"id": "epg-recent-channels", "uuid": "9c982beb-c676-4d6f-a777-ff5d37ec3081"},
|
|
{"id": "federated-auth", "uuid": "5d819d02-5d04-4116-8eec-f49def4e2d6f"},
|
|
{"id": "global-continue-watching", "uuid": "4742780c-af9d-4b44-bf5b-7b27e3369aa8"},
|
|
{"id": "hwtranscode", "uuid": "84a754b0-d1ca-4433-af2d-c949bf4b4936"},
|
|
{"id": "hardware_transcoding", "uuid": "bc8d1fca-deb0-4d0a-a6f4-12cfd681002d"},
|
|
{"id": "home", "uuid": "b2403ac6-4885-4971-8b96-59353fd87c72"},
|
|
{"id": "HRK_enable_EUR", "uuid": "f1ac7a53-c524-4311-9a27-713562fc24fa"},
|
|
{"id": "hybrid-guide", "uuid": "c6ce2260-a19d-4fea-9f74-a52231f03924"},
|
|
{"id": "imagga-v2", "uuid": "55b9f6ed-5d26-4d2d-a436-68882a9901b5"},
|
|
{"id": "intro-markers", "uuid": "b83c8dc9-5a01-4b7a-a7c9-5870c8a6e21b"},
|
|
{"id": "ios14-privacy-banner", "uuid": "39dbdd84-8339-4736-96a1-0eb105cc2e08"},
|
|
{"id": "item_clusters", "uuid": "b58d7f28-7b4a-49bb-97a7-152645505f28"},
|
|
{"id": "iterable-notification-tokens", "uuid": "81c8d5fa-8d90-4833-aa10-a31a51310e2f"},
|
|
{"id": "keep-payment-method", "uuid": "e4a9fd6f-4105-476b-bc57-adccd009323b"},
|
|
{"id": "kevin-bacon", "uuid": "c7ae6f8f-05e6-48bb-9024-c05c1dc3c43e"},
|
|
{"id": "lets_encrypt", "uuid": "8536058d-e1dd-4ae7-b30f-e8b059b7cc17"},
|
|
{"id": "lightning-dvr-pivot", "uuid": "6b85840c-d79d-40c2-8d8f-dfc0b7d26776"},
|
|
{"id": "livetv", "uuid": "65685ff8-4375-4e4c-a806-ec1f0b4a8b7f"},
|
|
{"id": "livetv-platform-specific", "uuid": "de789b83-9c5e-4472-bccf-791c69e67500"},
|
|
{"id": "allow_dvr", "uuid": "d8810b38-ec9b-494c-8555-3df6e365dfbd"},
|
|
{"id": "live-tv-channels-grid", "uuid": "9eaa5152-320b-48e6-9d47-9492ba5e5b54"},
|
|
{"id": "live-tv-grid-pagination", "uuid": "d1b1e233-a891-45e5-935c-6114e905dbe8"},
|
|
{"id": "live-tv-support-incomplete-segments", "uuid": "dab501df-5d99-48ef-afc2-3e839e4ddc9a"},
|
|
{"id": "tuner-sharing", "uuid": "4b522f91-ae89-4f62-af9c-76f44d8ef61c"},
|
|
{"id": "live-tv-on-plex-subtitles", "uuid": "0b8bf267-1acf-4f89-99eb-4afbb9d250e5"},
|
|
{"id": "lyrics", "uuid": "002c9f1a-2fc0-4812-b85b-0e6140f21a0f"},
|
|
{"id": "media-access-split-2", "uuid": "7ab197ee-1bd6-4335-8f55-db827f0110ba"},
|
|
{"id": "discover", "uuid": "4a933f24-464d-4a6b-b372-9e4497abd361"},
|
|
{"id": "metadata_search", "uuid": "22b27e12-472e-4383-92ea-2ec3976d8e72"},
|
|
{"id": "metadata", "uuid": "f8ea4f37-c554-476a-8852-1cbd2912f3f6"},
|
|
{"id": "podcasts", "uuid": "1841971c-6be5-40e6-a211-7e189d767a78"},
|
|
{"id": "vod_cloudflare", "uuid": "68747f3a-ce13-46ce-9274-1e0544c9f500"},
|
|
{"id": "vod_subtitles", "uuid": "ed374ad1-1d36-4396-8794-f710011e4fed"},
|
|
{"id": "tunefind-vod", "uuid": "50a1cfe9-dac1-4722-aee8-cc22e9758dd6"},
|
|
{"id": "vod", "uuid": "cc9bea3b-11ab-4402-a222-4958bb129cab"},
|
|
{"id": "webshows", "uuid": "55e1398c-930f-41c1-bead-f5c2e471bb25"},
|
|
{"id": "music_videos", "uuid": "1844737f-1a87-45c3-ab20-01435959e63c"},
|
|
{"id": "new_plex_pass_prices", "uuid": "de65add8-2782-4bb8-b156-e0b57a844479"},
|
|
{"id": "news-provider-sunset-modal", "uuid": "b77e6744-c18d-415a-8e7c-7aac5d7a7750"},
|
|
{"id": "nominatim", "uuid": "0de6151c-e0dd-47c8-a81e-1acb977c7f0f"},
|
|
{"id": "nonAnonymousAccount", "uuid": "3dd35df0-3e4a-4e74-9ba8-2baeda83a733"},
|
|
{"id": "onboarding-community", "uuid": "5dc82bc9-6038-4c21-b752-bc3454773eda"},
|
|
{"id": "parental-controls", "uuid": "73d0bba4-a6ba-4114-bac3-3039c12e08fb"},
|
|
{"id": "pass", "uuid": "82999dd3-a2be-482e-9f44-357879b4f603"},
|
|
{"id": "people-pages", "uuid": "f4fe27db-7292-4e13-98b6-f3ff9b5ed5fe"},
|
|
{"id": "people-pages-pms", "uuid": "652968f4-d474-4e04-a1cf-2dd1eaeb488a"},
|
|
{"id": "photos-favorites", "uuid": "96cac76e-c5bc-4596-87eb-4fdfef9aaa11"},
|
|
{"id": "photos-metadata-edition", "uuid": "2ea0e464-ea4f-4be2-97c1-ce6ed4b377dd"},
|
|
{"id": "photosV6-edit", "uuid": "850f3d1e-3f38-44c1-9c0c-e3c9127b8b5a"},
|
|
{"id": "photosV6-tv-albums", "uuid": "3a2b0cb6-1519-4431-98e2-823c248c70eb"},
|
|
{"id": "playback-speed", "uuid": "068f4adf-43e5-4cc6-b5a1-1243e1be4c53"},
|
|
{"id": "played_badges", "uuid": "02da2909-ddfd-46be-9e42-65008a79fc05"},
|
|
{"id": "PMS HEVC Encoding", "uuid": "0e2acda2-d70d-4df6-96e0-f63cf264d217"},
|
|
{"id": "pms_health", "uuid": "9aea4ca5-2095-4619-9339-88c1e662fde6"},
|
|
{"id": "premium-dashboard", "uuid": "222020fb-1504-492d-af33-a0b80a49558a"},
|
|
{"id": "premium_music_metadata", "uuid": "d413fb56-de7b-40e4-acd0-f3dbb7c9e104"},
|
|
{"id": "promoted-grid-channel-filters", "uuid": "a0a78867-6b26-446f-9c3f-df4edf831259"},
|
|
{"id": "rate-limit-client-token", "uuid": "3eb2789b-200c-4a15-91d2-dedfe560953c"},
|
|
{"id": "reactions_push_notifications_settings", "uuid": "34ddfac9-3a76-459a-974d-591520b809dd"},
|
|
{"id": "shared_server_notification", "uuid": "64adaa4e-aa7e-457d-b385-51438216d7fe"},
|
|
{"id": "shared_source_notification", "uuid": "6c4d66d9-729d-49dc-b70d-ab2652abf15a"},
|
|
{"id": "redirect-subscription-to-account-page", "uuid": "b8298a04-46a0-4f9c-ba1b-3b85a7d9f3b9"},
|
|
{"id": "remote-watch-pass", "uuid": "76ddd91e-8321-4916-94b6-ded8e3727a64"},
|
|
{"id": "save-to-library", "uuid": "644c4466-05fa-45e0-a478-c594cf81778f"},
|
|
{"id": "scrobbling-service", "uuid": "ccef9d3a-537a-43d9-8161-4c7113c6e2bb"},
|
|
{"id": "scrobbling-service-plex-tv", "uuid": "7b392594-6949-4736-9894-e57a9dfe4037"},
|
|
{"id": "album-types", "uuid": "1df3cd16-faf2-4d37-8349-1fcf3713bf1d"},
|
|
{"id": "collections", "uuid": "1417df52-986e-4e4b-8dcd-3997fbc5c976"},
|
|
{"id": "music-analysis", "uuid": "8fd37970-6e4e-4f00-a64a-e70b52f18e94"},
|
|
{"id": "radio", "uuid": "300231e0-69aa-4dce-97f4-52d8c00e3e8c"},
|
|
{"id": "session_bandwidth_restrictions", "uuid": "05690239-443e-43fb-bc1a-95b5d916ca63"},
|
|
{"id": "session_kick", "uuid": "4ca03b04-54c1-4f9f-aea2-f813ae48f317"},
|
|
{"id": "exclude restrictions", "uuid": "6d7be725-9a96-42c7-8af4-01e735138822"},
|
|
{"id": "signin_notification", "uuid": "1b3a63e4-c2f4-4011-a181-2343d3a97ef7"},
|
|
{"id": "signin_with_apple", "uuid": "b5874ecb-6610-47b2-8906-1b5a897acb02"},
|
|
{"id": "singleitemsharing", "uuid": "62b1e357-5450-41d8-9b60-c7705f750849"},
|
|
{"id": "skip-data-licensing-consent", "uuid": "e5fe743c-af51-468a-b7e2-aabf0e79030c"},
|
|
{"id": "sleep-timer", "uuid": "c5adf9dc-af13-4a85-a24b-98de6fa2f595"},
|
|
{"id": "sonos-client-feature", "uuid": "8a9471c4-13bd-435a-b5b8-4ca6e423f355"},
|
|
{"id": "spotlight-style-hub", "uuid": "579156cf-0664-45b4-8b7b-dda400ac3e26"},
|
|
{"id": "spring_serve_ad_provider", "uuid": "fec722a0-a6d4-4fbd-96dc-4ffb02b072c5"},
|
|
{"id": "Subtitles on Demand", "uuid": "bb50c92f-b412-44fe-8d8a-b1684f212a44"},
|
|
{"id": "sync", "uuid": "9dc1df45-fb45-4be1-9ab2-eb23eb57f082"},
|
|
{"id": "trailers", "uuid": "6380e085-02fe-43b5-8bff-380fa4f2423c"},
|
|
{"id": "transcoder_cache", "uuid": "a3d2d5c4-46a0-436e-a2d6-80d26f32b369"},
|
|
{"id": "boost-voices", "uuid": "c2409baa-d044-45c7-b1f4-e9e7ccd2d128"},
|
|
{"id": "TREBLE-show-features", "uuid": "85ebfb7b-77fb-4afd-bb1a-2fe2fefdddbe"},
|
|
{"id": "silence-removal", "uuid": "a6e0a154-4735-4cbb-a6ec-7a0a146c8216"},
|
|
{"id": "sweet-fades", "uuid": "95149521-f64b-46ea-825c-9114e56afd2c"},
|
|
{"id": "visualizers", "uuid": "1dd846ed-7cde-4dc5-8ef6-53d3ce8c4e9d"},
|
|
{"id": "volume-leveling", "uuid": "bbf73498-4912-4d80-9560-47c4fe212cec"},
|
|
{"id": "tvod_playback", "uuid": "5d80b92d-4ecf-4b0b-935f-5efc907bb2c1"},
|
|
{"id": "tvod-rentals", "uuid": "362c5ba7-41e8-400d-8354-18d53868e2d3"},
|
|
{"id": "tvod-wtw", "uuid": "e25d0e25-109e-4d6d-9a54-db0931af31c3"},
|
|
{"id": "two-factor-authentication", "uuid": "06d14b9e-2af8-4c2b-a4a1-ea9d5c515824"},
|
|
{"id": "two-factor-authentication-clients", "uuid": "20824f5c-6dd9-4655-9970-e7701a73c02a"},
|
|
{"id": "type-first", "uuid": "d14556be-ae6d-4407-89d0-b83953f4789a"},
|
|
{"id": "ultrablur", "uuid": "cec2152f-321a-4c24-8c6d-c2b35a624389"},
|
|
{"id": "universal-search", "uuid": "8b46de05-1f96-4278-87b3-010ba5b1e386"},
|
|
{"id": "universal-search-live-tv", "uuid": "cce9af5d-7b44-4119-a6b1-108fd0db725c"},
|
|
{"id": "universal-search-new-quick-search", "uuid": "b6b68f84-5127-4dc9-8a7e-3a04419b5cd4"},
|
|
{"id": "universal-watchlist", "uuid": "d9528436-ee7c-42e3-ab7b-814f85ef74b4"},
|
|
{"id": "unsupportedtuners", "uuid": "b46d16ae-cbd6-4226-8ee9-ab2b27e5dd42"},
|
|
{"id": "plexpass_from_billing_context", "uuid": "007fb90d-2224-4d24-bd42-e87ffde13558"},
|
|
{"id": "users-and-sharing", "uuid": "096ab4b8-04d2-41f4-9602-f1d5b9e8c7cc"},
|
|
{"id": "vod-schema", "uuid": "1b870b8e-f1a7-497c-80b2-857d45f3123f"},
|
|
{"id": "watch-together-20200520", "uuid": "65faa2d0-f57e-4c63-a6b6-f1baa48951b1"},
|
|
{"id": "watch-together-invite", "uuid": "f83450e2-759a-4de4-8b31-e4a163896d43"},
|
|
{"id": "watched-badges-v3", "uuid": "236de47b-a757-4ed7-9003-507b296057b5"},
|
|
{"id": "watchlist", "uuid": "f0c452ce-11e7-465f-be04-5fb0bf4bec48"},
|
|
{"id": "watchlist-source", "uuid": "edd6039a-137c-4ace-b5d5-4e111ce9690b"},
|
|
{"id": "watchlist-rss", "uuid": "f0f40559-a43a-4b8f-85ef-bdb1de1a912a"},
|
|
{"id": "web-desktop-live-tv-chromecast-remote-player", "uuid": "b737075d-a6c5-4e8a-8ee9-7dc72d984062"},
|
|
{"id": "web-desktop-gracenote-banner", "uuid": "13056a62-9bd2-47cf-aba9-bab00095fd08"},
|
|
{"id": "web-desktop-v4-dvr-setup", "uuid": "f8484f94-92a8-4ca4-9f43-e83ab3f586c7"},
|
|
{"id": "web-desktop-v4-home", "uuid": "29bca3b8-e40b-4c69-b71c-f88047240f9b"},
|
|
{"id": "web-desktop-v4-pre-plays", "uuid": "591895c1-8c60-4eab-8096-3594bb190257"},
|
|
{"id": "web-log-viewer", "uuid": "740a75d2-6dba-4317-ba68-ed3d619d4c7a"},
|
|
{"id": "web_server_dashboard", "uuid": "5e2a89ec-fb26-4234-b66e-14d37f35dff2"},
|
|
{"id": "web-share-v2", "uuid": "73c73f05-7131-41cd-86d7-b91301684bfe"},
|
|
{"id": "webhooks", "uuid": "6f82ca43-6117-4e55-ae0e-5ea3b3e99a96"},
|
|
{"id": "where-to-watch-clients", "uuid": "e4f02866-841f-4ceb-a30c-0a0e68fb874d"}]
|
|
|
|
FEATURES = [feature["id"] for feature in FEATURES_DICT]
|
|
|
|
PLEXAMP_FEATURES = [
|
|
"guided-upgrade",
|
|
"increase-password-complexity",
|
|
"upgrade-3ds2",
|
|
"ad-countdown-timer",
|
|
"adaptive_bitrate",
|
|
"amazon-loop-debug",
|
|
"Android - Dolby Vision",
|
|
"Android - PiP",
|
|
"avod-ad-analysis",
|
|
"avod-new-media",
|
|
"blacklist_get_signin",
|
|
"camera_upload",
|
|
"CU Sunset",
|
|
"client-radio-stations",
|
|
"cloudsync",
|
|
"cloudflare-turnstile-required",
|
|
"common-sense-media-ratings-premium",
|
|
"comments_and_replies_push_notifications",
|
|
"friend_request_push_notifications",
|
|
"community_access_plex_tv",
|
|
"community_friends_group_notifications",
|
|
"companions_sonos",
|
|
"content_filter",
|
|
"custom-home-removal",
|
|
"grandfather-sync",
|
|
"disable-facebook-auth",
|
|
"disable_home_user_friendships",
|
|
"disable_sharing_friendships",
|
|
"downloads-gating",
|
|
"drm_support",
|
|
"dvr",
|
|
"dvr-block-unsupported-countries",
|
|
"le_isrg_root_x1",
|
|
"epg-recent-channels",
|
|
"federated-auth",
|
|
"global-continue-watching",
|
|
"hwtranscode",
|
|
"hardware_transcoding",
|
|
"home",
|
|
"HRK_enable_EUR",
|
|
"imagga-v2",
|
|
"ios14-privacy-banner",
|
|
"item_clusters",
|
|
"iterable-notification-tokens",
|
|
"keep-payment-method",
|
|
"kevin-bacon",
|
|
"lets_encrypt",
|
|
"lightning-dvr-pivot",
|
|
"livetv",
|
|
"allow_dvr",
|
|
"live-tv-support-incomplete-segments",
|
|
"tuner-sharing",
|
|
"lyrics",
|
|
"metadata_search",
|
|
"vod_cloudflare",
|
|
"music_videos",
|
|
"new_plex_pass_prices",
|
|
"news-provider-sunset-modal",
|
|
"nominatim",
|
|
"pass",
|
|
"photos-favorites",
|
|
"photos-metadata-edition",
|
|
"photosV6-edit",
|
|
"photosV6-tv-albums",
|
|
"pms_health",
|
|
"premium-dashboard",
|
|
"premium_music_metadata",
|
|
"rate-limit-client-token",
|
|
"reactions_push_notifications_settings",
|
|
"shared_server_notification",
|
|
"shared_source_notification",
|
|
"redirect-subscription-to-account-page",
|
|
"scrobbling-service-plex-tv",
|
|
"album-types",
|
|
"collections",
|
|
"music-analysis",
|
|
"radio",
|
|
"session_bandwidth_restrictions",
|
|
"session_kick",
|
|
"exclude restrictions",
|
|
"signin_notification",
|
|
"signin_with_apple",
|
|
"skip-data-licensing-consent",
|
|
"sleep-timer",
|
|
"spring_serve_ad_provider",
|
|
"sync",
|
|
"trailers",
|
|
"transcoder_cache",
|
|
"boost-voices",
|
|
"TREBLE-show-features",
|
|
"silence-removal",
|
|
"sweet-fades",
|
|
"visualizers",
|
|
"volume-leveling",
|
|
"two-factor-authentication",
|
|
"unsupportedtuners",
|
|
"plexpass_from_billing_context",
|
|
"vod-schema",
|
|
"watch-together-invite",
|
|
"watchlist-rss",
|
|
"web_server_dashboard",
|
|
"webhooks"
|
|
]
|
|
|
|
PLEXAMP_SUBSCRIPTION_XML = ET.fromstring("""
|
|
<subscription active="1" status="Active" plan="">
|
|
<feature id="guided-upgrade" />
|
|
<feature id="increase-password-complexity" />
|
|
<feature id="upgrade-3ds2" />
|
|
<feature id="ad-countdown-timer" />
|
|
<feature id="adaptive_bitrate" />
|
|
<feature id="amazon-loop-debug" />
|
|
<feature id="Android - Dolby Vision" />
|
|
<feature id="Android - PiP" />
|
|
<feature id="avod-ad-analysis" />
|
|
<feature id="avod-new-media" />
|
|
<feature id="blacklist_get_signin" />
|
|
<feature id="camera_upload" />
|
|
<feature id="CU Sunset" />
|
|
<feature id="client-radio-stations" />
|
|
<feature id="cloudsync" />
|
|
<feature id="cloudflare-turnstile-required" />
|
|
<feature id="common-sense-media-ratings-premium" />
|
|
<feature id="comments_and_replies_push_notifications" />
|
|
<feature id="friend_request_push_notifications" />
|
|
<feature id="community_access_plex_tv" />
|
|
<feature id="community_friends_group_notifications" />
|
|
<feature id="companions_sonos" />
|
|
<feature id="content_filter" />
|
|
<feature id="custom-home-removal" />
|
|
<feature id="grandfather-sync" />
|
|
<feature id="disable-facebook-auth" />
|
|
<feature id="disable_home_user_friendships" />
|
|
<feature id="disable_sharing_friendships" />
|
|
<feature id="downloads-gating" />
|
|
<feature id="drm_support" />
|
|
<feature id="dvr" />
|
|
<feature id="dvr-block-unsupported-countries" />
|
|
<feature id="le_isrg_root_x1" />
|
|
<feature id="epg-recent-channels" />
|
|
<feature id="federated-auth" />
|
|
<feature id="global-continue-watching" />
|
|
<feature id="hwtranscode" />
|
|
<feature id="hardware_transcoding" />
|
|
<feature id="home" />
|
|
<feature id="HRK_enable_EUR" />
|
|
<feature id="imagga-v2" />
|
|
<feature id="ios14-privacy-banner" />
|
|
<feature id="item_clusters" />
|
|
<feature id="iterable-notification-tokens" />
|
|
<feature id="keep-payment-method" />
|
|
<feature id="kevin-bacon" />
|
|
<feature id="lets_encrypt" />
|
|
<feature id="lightning-dvr-pivot" />
|
|
<feature id="livetv" />
|
|
<feature id="allow_dvr" />
|
|
<feature id="live-tv-support-incomplete-segments" />
|
|
<feature id="tuner-sharing" />
|
|
<feature id="lyrics" />
|
|
<feature id="metadata_search" />
|
|
<feature id="vod_cloudflare" />
|
|
<feature id="music_videos" />
|
|
<feature id="new_plex_pass_prices" />
|
|
<feature id="news-provider-sunset-modal" />
|
|
<feature id="nominatim" />
|
|
<feature id="pass" />
|
|
<feature id="photos-favorites" />
|
|
<feature id="photos-metadata-edition" />
|
|
<feature id="photosV6-edit" />
|
|
<feature id="photosV6-tv-albums" />
|
|
<feature id="pms_health" />
|
|
<feature id="premium-dashboard" />
|
|
<feature id="premium_music_metadata" />
|
|
<feature id="rate-limit-client-token" />
|
|
<feature id="reactions_push_notifications_settings" />
|
|
<feature id="shared_server_notification" />
|
|
<feature id="shared_source_notification" />
|
|
<feature id="redirect-subscription-to-account-page" />
|
|
<feature id="scrobbling-service-plex-tv" />
|
|
<feature id="album-types" />
|
|
<feature id="collections" />
|
|
<feature id="music-analysis" />
|
|
<feature id="radio" />
|
|
<feature id="session_bandwidth_restrictions" />
|
|
<feature id="session_kick" />
|
|
<feature id="exclude restrictions" />
|
|
<feature id="signin_notification" />
|
|
<feature id="signin_with_apple" />
|
|
<feature id="skip-data-licensing-consent" />
|
|
<feature id="sleep-timer" />
|
|
<feature id="spring_serve_ad_provider" />
|
|
<feature id="sync" />
|
|
<feature id="trailers" />
|
|
<feature id="transcoder_cache" />
|
|
<feature id="boost-voices" />
|
|
<feature id="TREBLE-show-features" />
|
|
<feature id="silence-removal" />
|
|
<feature id="sweet-fades" />
|
|
<feature id="visualizers" />
|
|
<feature id="volume-leveling" />
|
|
<feature id="two-factor-authentication" />
|
|
<feature id="unsupportedtuners" />
|
|
<feature id="plexpass_from_billing_context" />
|
|
<feature id="vod-schema" />
|
|
<feature id="watch-together-invite" />
|
|
<feature id="watchlist-rss" />
|
|
<feature id="web_server_dashboard" />
|
|
<feature id="webhooks" />
|
|
</subscription>
|
|
""")
|
|
|
|
ENTITLEMENTS = ["deprecated_google_iap_activation", "all", "roku", "android", "xbox_one", "xbox_360", "windows",
|
|
"windows_phone", "ios"]
|
|
|
|
CURRENT_DATE_MINUS_ONE_DAY = (datetime.now(timezone.utc) - timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S UTC")
|
|
CURRENT_DATE_MINUS_ONE_DAY_Z = (datetime.now(timezone.utc) - timedelta(days=1)).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
NEXT_MONTH_DATE_Z = (datetime.now(timezone.utc) + timedelta(days=30)).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
CURRENT_DATE_Z = (datetime.now(timezone.utc)).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
CURRENT_DATE_PLUS_30MIN_Z = (datetime.now(timezone.utc) + timedelta(minutes=30)).strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
TIMESTAMP_CURRENT = int(datetime.now().timestamp())
|
|
TIMESTAMP_CURRENT_MINUS_30MIN = int((datetime.now() - timedelta(minutes=30)).timestamp())
|
|
TIMESTAMP_CURRENT_PLUS_30DAYS = int((datetime.now() + timedelta(days=30)).timestamp())
|