Plex 如何使用 CLI 获取声明令牌
Plex how to get the claim token with CLI
当我尝试通过 cli 获取令牌时遇到问题。以正常方式访问 https://www.plex.tv/claim/ 并获取令牌,如果未登录,则需要使用您的帐户登录。我想知道是否有可能获得提供 username
和 password
.
的声明令牌
首先,我需要登录并获取授权令牌。我在 cURL 中做了这个命令:
curl -X "POST" "https://plex.tv/users/sign_in.json" -H "X-Plex-Version: 1.0.0" -H "X-Plex-Product: WHATEVER" -H "X-Plex-Client-Identifier: YOUR-PRODUCT-ID" -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" --data-urlencode "user[password]=PASSWORD" --data-urlencode "user[login]=LOGIN-OR-EMAIL"
它输出类似:
{
"user":{
"id":234612345,
"uuid":"c59ae6a4785ea41",
"email":"mail@domain",
"joined_at":"2019-01-13T14:20:05.000Z",
"username":"userA",
"title":"userA",
"thumb":"https://plex.tv/users/c19ae7c44546aa41/avatar?c=1557225551",
"hasPassword":true,
"authToken":"ysdfzerk47qnCSm7zYqzEAZIds4VF3b",
"authentication_token":"ysdfzerk47qnCSm7zYqzEAZIds4VF3b",
"subscription":{
"active":false,
"status":"Inactive",
"plan":null,
"features":[
"adaptive_bitrate",
"collections",
"photos-metadata-edition",
"radio",
"photos-favorites",
"federated-auth",
"Android - PiP",
"publishing_platform",
"news",
"kevin-bacon",
"client-radio-stations",
"TREBLE-show-features",
"web_server_dashboard",
"conan_redirect_qa",
"conan_redirect_alpha",
"conan_redirect_beta",
"conan_redirect_public",
"news_local_now",
"transcoder_cache",
"artist-tv"
]
},
"roles":{
"roles":[
]
},
"entitlements":[
],
"confirmedAt":null,
"forumId":null,
"rememberMe":false
}
}
我现在如何领取令牌?我没有找到任何 api 来获取该令牌。我们只能从网站上获取https://www.plex.tv/claim/
令牌类似于:claim-XXXXXXXXXXXXXXXXXXXX
我在源页面找不到令牌
我在查看 plex 的源代码时发现了它。这是一个示例脚本:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<span>Token: <span id="token"></span></span>
<script>
var TokenIdentifier = ""
var ClientIdentifier = ""
var i = {
"X-Plex-Product": "Plex SSO",
"X-Plex-Token": TokenIdentifier,
"X-Plex-Client-Identifier": ClientIdentifier
};
$.ajax({
dataType: "json",
type: "GET",
headers: i,
url: "https://plex.tv/api/claim/token.json",
crossDomain: !0,
success: function(e) {
$.each(e, function(index, element) {
document.getElementById("token").innerHTML = element;
});
}
})
</script>
当我尝试通过 cli 获取令牌时遇到问题。以正常方式访问 https://www.plex.tv/claim/ 并获取令牌,如果未登录,则需要使用您的帐户登录。我想知道是否有可能获得提供 username
和 password
.
首先,我需要登录并获取授权令牌。我在 cURL 中做了这个命令:
curl -X "POST" "https://plex.tv/users/sign_in.json" -H "X-Plex-Version: 1.0.0" -H "X-Plex-Product: WHATEVER" -H "X-Plex-Client-Identifier: YOUR-PRODUCT-ID" -H "Content-Type: application/x-www-form-urlencoded; charset=utf-8" --data-urlencode "user[password]=PASSWORD" --data-urlencode "user[login]=LOGIN-OR-EMAIL"
它输出类似:
{
"user":{
"id":234612345,
"uuid":"c59ae6a4785ea41",
"email":"mail@domain",
"joined_at":"2019-01-13T14:20:05.000Z",
"username":"userA",
"title":"userA",
"thumb":"https://plex.tv/users/c19ae7c44546aa41/avatar?c=1557225551",
"hasPassword":true,
"authToken":"ysdfzerk47qnCSm7zYqzEAZIds4VF3b",
"authentication_token":"ysdfzerk47qnCSm7zYqzEAZIds4VF3b",
"subscription":{
"active":false,
"status":"Inactive",
"plan":null,
"features":[
"adaptive_bitrate",
"collections",
"photos-metadata-edition",
"radio",
"photos-favorites",
"federated-auth",
"Android - PiP",
"publishing_platform",
"news",
"kevin-bacon",
"client-radio-stations",
"TREBLE-show-features",
"web_server_dashboard",
"conan_redirect_qa",
"conan_redirect_alpha",
"conan_redirect_beta",
"conan_redirect_public",
"news_local_now",
"transcoder_cache",
"artist-tv"
]
},
"roles":{
"roles":[
]
},
"entitlements":[
],
"confirmedAt":null,
"forumId":null,
"rememberMe":false
}
}
我现在如何领取令牌?我没有找到任何 api 来获取该令牌。我们只能从网站上获取https://www.plex.tv/claim/
令牌类似于:claim-XXXXXXXXXXXXXXXXXXXX
我在源页面找不到令牌
我在查看 plex 的源代码时发现了它。这是一个示例脚本:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<span>Token: <span id="token"></span></span>
<script>
var TokenIdentifier = ""
var ClientIdentifier = ""
var i = {
"X-Plex-Product": "Plex SSO",
"X-Plex-Token": TokenIdentifier,
"X-Plex-Client-Identifier": ClientIdentifier
};
$.ajax({
dataType: "json",
type: "GET",
headers: i,
url: "https://plex.tv/api/claim/token.json",
crossDomain: !0,
success: function(e) {
$.each(e, function(index, element) {
document.getElementById("token").innerHTML = element;
});
}
})
</script>