Plex 接口文档
认证
若无特殊说明,下文所有请求均需携带以下请求头。
参数名 | 备注 |
---|---|
X-Plex-Client-Identifier | 设备 ID |
X-Plex-Platform | 操作系统,可选值:Web , Android , iOS , MacOSX , Windows , Linux |
X-Plex-Provides | 应用类型,可选值:player |
X-Plex-Product | 应用名称 |
X-Plex-Version | 应用版本号 |
X-Plex-Device | 设备型号 |
X-Plex-Device-Name | 设备名 |
X-Plex-Token | 访问令牌,登录成功后必填 |
signin 登录
POST: https://plex.tv/api/v2/users/signin
body(application/json
):
参数名 | 备注 |
---|---|
login | 用户名 |
password | 密码 |
verificationCode | OTP 验 证码,可选 |
rememberMe | 记住登录状态,可选值:true , false |
401 response:
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error code="1029" message="Please enter the verification code" status="401"/>
</errors>
response:
<?xml version="1.0" encoding="UTF-8"?>
<user id="xxx" uuid="xxx" username="xxx" title="xxx" email="xxx@xxx.com" friendlyName="" locale="" confirmed="1" joinedAt="1701051277" emailOnlyAuth="0" hasPassword="1" protected="0" thumb="https://plex.tv/users/xxx/avatar?c=xxx" authToken="xxx" mailingListStatus="active" mailingListActive="1" scrobbleTypes="" country="CN" subscriptionDescription="Lifetime Plex Pass" restricted="0" anonymous="0" home="0" guest="0" homeSize="1" homeAdmin="0" maxHomeSize="15" rememberExpiresAt="1714812929" adsConsent="" adsConsentSetAt="" adsConsentReminderAt="" experimentalFeatures="1" twoFactorEnabled="1" backupCodesCreated="1">
<subscription active="1" subscribedAt="2024-03-24 05:13:37 UTC" status="Active" paymentService="braintree" plan="lifetime">
<features>
<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="comments_and_replies_push_notifications"/>
<feature id="friend_request_push_notifications"/>
<feature id="community_access_plex_tv"/>
<feature id="companions_sonos"/>
<feature id="content_filter"/>
<feature id="custom-home-removal"/>
<feature id="grandfather-sync"/>
<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="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="korea-consent"/>
<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="shared_server_notification"/>
<feature id="shared_source_notification"/>
<feature id="require-plex-nonce"/>
<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="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="vod-schema"/>
<feature id="watch-together-invite"/>
<feature id="watchlist-rss"/>
<feature id="web_server_dashboard"/>
<feature id="webhooks"/>
</features>
</subscription>
<profile autoSelectAudio="0" defaultAudioLanguage="zh" defaultSubtitleLanguage="zh" autoSelectSubtitle="0" defaultSubtitleAccessibility="0" defaultSubtitleForced="0" watchedIndicator="1"/>
<entitlements>
<entitlement id="all"/>
<entitlement id="roku"/>
<entitlement id="android"/>
<entitlement id="xbox_one"/>
<entitlement id="xbox_360"/>
<entitlement id="windows"/>
<entitlement id="windows_phone"/>
<entitlement id="ios"/>
</entitlements>
<roles>
<role id="plexpass"/>
</roles>
<subscriptions>
<subscription id="" mode="lifetime" renewsAt="" endsAt="" canceled="0" gracePeriod="0" onHold="0" canReactivate="0" canUpgrade="0" canDowngrade="0" canConvert="0" type="plexpass" transfer="0" state="active">
<billing paymentMethodId="">
<internalPaymentMethod/>
</billing>
</subscription>
</subscriptions>
<pastSubscriptions></pastSubscriptions>
<trials></trials>
<services>
<service identifier="epg" endpoint="https://epg.provider.plex.tv" token="xxx=" secret="" status="online"/>
<service identifier="epg-staging" endpoint="https://epg-staging.provider.plex.tv" token="xxx=" secret="" status="online"/>
<service identifier="epg-dev" endpoint="https://epg-dev.provider.plex.tv" token="xxx=" secret="" status="online"/>
<service identifier="eyeq" endpoint="https://c4412416.ipg.web.cddbp.net/webapi/xml/1.0/" token="6iUU7xxxVrBzA/xxx+xxx" secret="" status="online"/>
<service identifier="eyeq-channel-icons" endpoint="http://akamai-b.cdn.cddbp.net/cds/2.0/image" token="" secret="" status="online"/>
<service identifier="graph-dev" endpoint="https://community-dev.plex.tv" token="" secret="" status="online"/>
<service identifier="graph-staging" endpoint="https://community-staging.plex.tv" token="" secret="" status="online"/>
<service identifier="community-dev" endpoint="https://community-dev.plex.tv" token="" secret="" status="online"/>
<service identifier="community-staging" endpoint="https://community-staging.plex.tv" token="" secret="" status="online"/>
<service identifier="community" endpoint="https://community.plex.tv" token="" secret="" status="online"/>
<service identifier="metadata" endpoint="https://metadata.provider.plex.tv" token="xxx=" secret="" status="online"/>
<service identifier="scrobbling" endpoint="https://scrobbles.plex.tv" token="xxx.xxx.ukvm_-xxx-xxx-xxx-3Vamxi7eNG-xxx-xxx-d7z-xxx" secret="" status="online"/>
<service identifier="metadata-dev" endpoint="https://metadata-dev.provider.plex.tv" token="xxx=" secret="" status="online"/>
<service identifier="metadata-provider" endpoint="https://mpm.plex.tv/" token="" secret="" status="online"/>
<service identifier="tmsapi" endpoint="https://tmsapi.plex.tv/v1.1/" token="xxx+OQ=" secret="" status="online"/>
<service identifier="subtitles-search" endpoint="https://metadata.provider.plex.tv/library/streams/matches" token="xxx=" secret="" status="online"/>
<service identifier="acoustid" endpoint="https://acoustid.plex.tv/" token="xxx==" secret="" status="online"/>
<service identifier="lyricfind" endpoint="https://lyricfind.plex.tv/" token="xxx+/xxx/zqV1" secret="H8q1AfgeOcf8+xxx+teyIOw" status="online"/>
<service identifier="lyricfind-search" endpoint="https://lyricfind.plex.tv/" token="4HRR+YgScsy+xxx+xxx" secret="" status="online"/>
<service identifier="tvdb" endpoint="https://api4.thetvdb.com/" token="xxx+9EAH+xxx/xxx" secret="" status="online"/>
</services>
</user>
resources 获取资源列表
GET: https://plex.tv/api/v2/resources?includeHttps=1&includeRelay=1
response:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<resource name="xxx" product="Plex Media Server" productVersion="1.29.2" platform="Linux" platformVersion="DSM" device="DS+" clientIdentifier="xxx" createdAt="2024-03-17T11:34:53Z" lastSeenAt="2024-04-19T19:09:52Z" provides="server" ownerId="" sourceTitle="" publicAddress="22.22.22.22" accessToken="xxx" owned="1" home="0" synced="0" relay="1" presence="1" httpsRequired="0" publicAddressMatches="1" dnsRebindingProtection="0" natLoopbackSupported="0">
<connections>
<connection protocol="https" address="192.168.22.22" port="32400" uri="https://192-168-22-22.xxx.plex.direct:32400" local="1" relay="0" IPv6="0"/>
<connection protocol="https" address="139.162.22.22" port="8443" uri="https://139-162-22-22.xxx.plex.direct:8443" local="0" relay="1" IPv6="0"/>
</connections>
</resource>
</resources>
测试服务器连通性
GET: [host]
response:
<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="25" allowCameraUpload="1" allowChannelAccess="1" allowMediaDeletion="1" allowSharing="1" allowSync="1" allowTuners="1" backgroundProcessing="1" certificate="1" companionProxy="1" countryCode="chn" diagnostics="logs,databases,streaminglogs" eventStream="1" friendlyName="xxx" hubSearch="1" itemClusters="1" livetv="7" machineIdentifier="xxx" mediaProviders="1" multiuser="1" musicAnalysis="2" myPlex="1" myPlexMappingState="mapped" myPlexSigninState="ok" myPlexSubscription="1" myPlexUsername="xxx" offlineTranscode="1" ownerFeatures="fec722a0-a6d4-4fbd-96dc-4ffb02b072c5,federated-auth,hardware_transcoding,home,hwtranscode,item_clusters,kevin-bacon,livetv,loudness,lyrics,music-analysis,music_videos,pass,photosV6-edit,photosV6-tv-albums,premium_music_metadata,radio,server-manager,session_bandwidth_restrictions,session_kick,shared-radio,sync,trailers,tuner-sharing,type-first,unsupportedtuners,webhooks" photoAutoTag="1" platform="Linux" platformVersion="DSM" pluginHost="1" pushNotifications="0" readOnlyLibraries="0" streamingBrainABRVersion="3" streamingBrainVersion="2" sync="1" transcoderActiveVideoSessions="0" transcoderAudio="1" transcoderLyrics="1" transcoderPhoto="1" transcoderSubtitles="1" transcoderVideo="1" transcoderVideoBitrates="64,96,208,320,720,1500,2000,3000,4000,8000,10000,12000,20000" transcoderVideoQualities="0,1,2,3,4,5,6,7,8,9,10,11,12" transcoderVideoRemuxOnly="1" transcoderVideoResolutions="128,128,160,240,320,480,768,720,720,1080,1080,1080,1080" updatedAt="1712973038" updater="1" version="1.29.2" voiceSearch="1">
<Directory count="1" key="actions" title="actions" />
<Directory count="1" key="activities" title="activities" />
<Directory count="1" key="butler" title="butler" />
<Directory count="1" key="channels" title="channels" />
<Directory count="1" key="clients" title="clients" />
<Directory count="1" key="devices" title="devices" />
<Directory count="1" key="diagnostics" title="diagnostics" />
<Directory count="1" key="hubs" title="hubs" />
<Directory count="3" key="library" title="library" />
<Directory count="3" key="livetv" title="livetv" />
<Directory count="3" key="media" title="media" />
<Directory count="3" key="metadata" title="metadata" />
<Directory count="1" key="neighborhood" title="neighborhood" />
<Directory count="1" key="playQueues" title="playQueues" />
<Directory count="1" key="player" title="player" />
<Directory count="1" key="playlists" title="playlists" />
<Directory count="1" key="resources" title="resources" />
<Directory count="1" key="search" title="search" />
<Directory count="1" key="server" title="server" />
<Directory count="1" key="servers" title="servers" />
<Directory count="1" key="statistics" title="statistics" />
<Directory count="1" key="system" title="system" />
<Directory count="1" key="transcode" title="transcode" />
<Directory count="1" key="updater" title="updater" />
<Directory count="1" key="user" title="user" />
</MediaContainer>