<?xml version="1.0" encoding="utf-8"?>
<parser delay="1500" crpj="true" date="2020.03.29">
    <url><![CDATA[https?://stories\.audible\.com/pdp/(?<id>[^?]+)\??]]></url>
    <title><![CDATA[title="([^"]+)"]]></title>
    <thumbnail><![CDATA[thumbnail=([^,]+)]]></thumbnail>
    <duration><![CDATA[]]></duration>
    <mediaUrl><![CDATA[cr_video_url=([^"]+)]]></mediaUrl>
    <jsCode><![CDATA[
        try {
            var asin = window.location.href.match(/pdp\/([^?]+)/)[1];
            //info...
            var api_url = 'https://stories.audible.com/audibleapi/1.0/catalog/products/' + asin + '?response_groups=product_desc,media';
            var data = window.external.getHtmlCode(api_url);
            var jo = JSON.parse(data);
            var title = jo.product.title;
            var thumbnail = jo.product.product_images[500];
            //key...
            api_url = 'https://stories.audible.com/audibleapi/1.0/pages/blissey-anon-info';
            data = window.external.getHtmlCode(api_url);
            api_key = data.match(/xApiKey\",\"text\":\"([^\"]+)/)[1];
            var args = '{\"disableErrorHandler\":true,\"doRetry\":true,\"consumption_type\":\"Streaming\",\"drm_type\":\"Hls\",\"useAdaptiveBitRate\":true,\"rights_validations\":\"Client\"}';
            var headers = 'Content-Type: application/json\r\nx-api-key: ' + api_key;
            api_url = 'https://stories.audible.com/audibleapi/1.0/content/' + asin + '/licenserequest';
            data = window.external.getPostResultEx(api_url, args, headers);
            jo = JSON.parse(data);
            var video_url = jo.content_license.license_response;
            document.body.innerHTML = 'title=\"' + title + '\",thumbnail=' + thumbnail + ',cr_video_url=' + video_url + '\"';
        }
        catch (ex) {
        }
    ]]></jsCode>
</parser>