web-scrapingissuu

Issuu get documentId from embedded iframe's configId


I would like to fetch more information for an embedded Issuu player via the Issuu API, but it seems that the new embeds dont carry the documentIds anymore, but a configId.
The API however only works with the documentId.

Example embed:

<div data-configid="0/919xxx" style="width: 525px; height: 356px;" class="issuuembed"></div><script type="text/javascript" src="//e.issuu.com/embed.js" async="true"></script>

or

<iframe width="525" height="356" src="//e.issuu.com/embed.html#0/91xxxx" frameborder="0" allowfullscreen></iframe>

So how can i get the documentId when i only have the configId?


Solution

  • On the object loaded by ISSUU you will find: <param name="flashvars" value="long_url">

    within this long_url you can find the documentID by slicing url parameters.

    The way I do it is by using oembed json API and the issuu url of a publication

    function get_magazine_info($issuu_url) {
    
    $issuu_link = 'http://issuu.com/oembed?url=' . $issuu_url . '&format=json';
    
    $magazine_info = json_decode(file_get_contents($issuu_link), TRUE);
    return $magazine_info; }
    

    it returns a JSON with all the information you need and if you want to use the real API where you need to use the secret API keys and do the md5 encryption, you should be doing this on the back end anyway, I would not try to embed a magazine and extract the docID from there and send it back to the server.

    If what you are trying to use is the viewer API, you need the embedID which is the same as the cofing id.