Hello,
I’m trying to access the transcoder using perl and LWP but I run into “ERROR - Client ‘KQMIY6GATPC63AIMC4R2’ access code is incorrect.” in server log and 401 return code. I’m sure it’s something I’ve misunderstood with the url since when I input the same parameters in the test.htm code I get the same access code generated. So, what am I doing wrong?
Library entry for the video I’, trying to decode:
<Video ratingKey="40641" key="/library/metadata/40641" studio="20th Century Fox" type="movie" title="Abraham Lincoln: Vampire Hunter" contentRating="R" summary="Visionary filmmakers Tim Burton and Timur Bekmambetov reinvent the time-honored genre and present the terrifying creatures of the night as they were meant to be experienced -- as fierce, visceral, intense and bloodthristy. Abraham Lincoln: Vampire Hunter brings to the screen the secret life of our nation's favorite president...as history's greatest hunter of the undead. -- (C) Official Site" rating="5.5" viewOffset="92160" year="2012" thumb="/library/metadata/40641/thumb?t=1350376147" art="/library/metadata/40641/art?t=1350376147" duration="6300000" originallyAvailableAt="2012-06-19" addedAt="1350135392" updatedAt="1350376147"><br />
<Media id="37817" duration="6300555" bitrate="5945" width="1280" height="536" aspectRatio="2.35" audioChannels="6" audioCodec="dca" videoCodec="h264" videoResolution="720" container="mkv" videoFrameRate="24p"><br />
<Part id="37817" key="/library/parts/37817/file.mkv" duration="6300555" file="/mnt/movies/Abraham.Lincoln.Vampire.Hunter.2012.720p.BluRay.x264-DAA/daa-alvh-720p.mkv" size="4682326613" container="mkv"/><br />
</Media><br />
<Genre tag="Action & Adventure"/><br />
<Genre tag="Horror"/><br />
<Writer tag="Seth Grahame-Smith"/><br />
<Writer tag="Simon Kinberg"/><br />
<Director tag="Timur Bekmambetov"/><br />
<Country tag="USA"/><br />
<Role tag="Benjamin Walker"/><br />
<Role tag="Dominic Cooper"/><br />
<Role tag="Anthony Mackie"/><br />
</Video>
Perl script output:
<br />
pre sha256 (test code 'myurl'): /video/:/transcode/segmented/start.m3u8?identifier=com.plexapp.plugins.library&ratingKey=40641&offset=0&quality=5&url=http%3A%2F%2Flocalhost%3A32400%2Flibrary%2Fparts%2F37817%2Ffile.mkv&3g=0&httpCookies=&userAgent=@1351124094<br />
<br />
post sha256(test code 'msg'): efVsD01UEpw3wvVZRqrskyE0VNVLNEaz3Bc9FXGuAEE=<br />
<br />
headers:<br />
$VAR1 = bless( {<br />
'x-plex-access-code' => 'efVsD01UEpw3wvVZRqrskyE0VNVLNEaz3Bc9FXGuAEE=',<br />
'x-plex-access-time' => '1351124094',<br />
'x-plex-access-key' => 'KQMIY6GATPC63AIMC4R2'<br />
}, 'HTTP::Headers' );<br />
<br />
Get URL:<br />
http://plex:32400/video/:/transcode/segmented/start.m3u8?identifier=com.plexapp.plugins.library&ratingKey=40641&offset=0&quality=5&url=http%3A%2F%2Flocalhost%3A32400%2Flibrary%2Fparts%2F37817%2Ffile.mkv&3g=0&httpCookies=&userAgent=@1351124094<br />
<br />
urldecoded for readability:<br />
http://plex:32400/video/:/transcode/segmented/start.m3u8?identifier=com.plexapp.plugins.library&ratingKey=40641&offset=0&quality=5&url=http://localhost:32400/library/parts/37817/file.mkv&3g=0&httpCookies=&userAgent=@1351124094<br />
<br />
HTTP response: 401 Unauthorized<br />
test.htm output:
X-Plex-Access-Key=KQMIY6GATPC63AIMC4R2<br />
X-Plex-Access-Time=1351124094<br />
X-Plex-Access-Code=efVsD01UEpw3wvVZRqrskyE0VNVLNEaz3Bc9FXGuAEE=
server.log output:
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - Request: GET /video/:/transcode/segmented/start.m3u8?identifier=com.plexapp.plugins.library&ratingKey=40641&offset=0&quality=5&url=http%3A%2F%2Flocalhost%3A32400%2Flibrary%2Fparts%2F37817%2Ffile.mkv&3g=0&httpCookies=&userAgent=@1351124094 [172.16.1.3:56224] (1 live)<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - * identifier => com.plexapp.plugins.library<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - * ratingKey => 40641<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - * offset => 0<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - * quality => 5<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - * url => http://localhost:32400/library/parts/37817/file.mkv<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - * 3g => 0<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - * httpCookies =><br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - * userAgent => @1351124094<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - Cookie header in secure request:<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] DEBUG - Checking cookie ''<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] ERROR - Client 'KQMIY6GATPC63AIMC4R2' access code is incorrect.<br />
Oct 25, 2012 10:11:59 [0x7ffdb67fc700] VERBOSE - Request: GET /video/:/transcode/segmented/start.m3u8?identifier=com.plexapp.plugins.library&ratingKey=40641&offset=0&quality=5&url=http%3A%2F%2Flocalhost%3A32400%2Flibrary%2Fparts%2F37817%2Ffile.mkv&3g=0&httpCookies=&userAgent=@1351124094 complete<br />