Search code examples
c#pdfembedded-flashplayerissuu

Can't obtain Source Code of embedded ISSUU flash


First of all what I want to do is legal (since they let you download the pdf). I just wanted to make a faster and automatic method of downloading the pdf.

For example: http://www.lasirena.es/article/&path=10_17&ID=782

It has an embedded flash pdf and when I download that page source code, the link to the pdf: http://issuu.com/lasirena/docs/af_fulleto_setembre_andorra_sense_c?e=3360093/9079351

Doesn't show up, the only thing that I have on the source code is this: 3360093/9079351 I tried to find a way to build the pdf link from it, but I can't find the name "af_fulleto_setembre_andorra_sense_c" anywhere...

I've made plenty of automatic downloads like this, but it's the first time that I can't build or get the pdf link and I can't seem to find a way, is it even possible?

I tried to try and find jpg's links but without success either. Either way (jpg or pdf) is fine...

PS: the Document ID doesn't show on the downloaded source code either.

Thank you.


Solution

  • I thought a workaround for this, some might not consider this a solution but in my case works fine because it depends on the ISSUU publisher account. The Solution itself is making a Request to ISSUU API connected with the publisher account I'm looking for.

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://api.issuu.com/query?action=issuu.documents.list" +
                    "&apiKey=Inser Your API Key" +
                    "&format=json" +
                    "&documentUsername=User of the account you want to make a request" +
                    "&pageSize=100&resultOrder=asc" +
                    "&responseParams=name,documentId,pageCount" +
                    "&username=Insert your ISSUU username" +
                    "&token=Insert Your Token here");
    
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.Accept = "application/json";
    
            try
            {
                using (WebResponse response = request.GetResponse())
                {
                    var responseValue = string.Empty;
                    // grab the response  
                    using (var responseStream = response.GetResponseStream())
                    {
                        using (var reader = new StreamReader(responseStream))
                        {
                            responseValue = reader.ReadToEnd();
                        }
                    }
                    if (responseValue != "")
                    {
                        List<string> lista_linkss = new List<string>();
    
                        JObject ApiRequest = JObject.Parse(responseValue);
                        //// get JSON result objects into a list
                        IList<JToken> results = ApiRequest["rsp"]["_content"]["result"]["_content"].Children()["document"].ToList();
    
                        for (int i = 0; i < results.Count(); i++)
                        {
                            Folheto folheto = new Folheto();
                            folheto.name = results[i]["name"].ToString();
                            folheto.documentId = results[i]["documentId"].ToString();
                            folheto.pageCount = Int32.Parse(results[i]["pageCount"].ToString());
                            string _date = Newtonsoft.Json.JsonConvert.SerializeObject(results[i]["uploadTimestamp"], Formatting.None, new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd hh:mm:ss" }).Replace(@"""", string.Empty);
                            folheto.uploadTimestamp = Convert.ToDateTime(_date);
                            if (!lista_nomes_Sirena.Contains(folheto.name))
                            {
                                list.Add(folheto);
                            }
                        }
                    }
                }
            }
            catch (WebException ex)
            {
                // Handle error
            }
    

    You have to pay attention to the Parameter "pageSize" the maximum permitted by the API is 100, this means the maximum number of results you get is 100, since the account I'm following has around 240 pdf's, I used this request once with the Parameter "resultOrder = asc" and another time with the value "resultOrder=desc".

    This allowed me to get the first 100 pdfs and the latest 100 pdfs inserted. Since I didn't need a history but just the pdf's they will be sending out from now, it didn't make a difference.

    Finalizing my code I'm sending all the document's ID's to a sql database I made, and when I start the program, I make a check to see if the ID was already downloaded, if not it downloads the pdf, if yes it doesn't.

    Hope someone can find this work around useful