首先,我想做的是合法的(因为他们让你下载pdf)。 我只是想制作一个更快速,更自动的下载pdf的方法。
例如:http://www.lasirena.es/article/&path=10_17&ID=782
它有一个嵌入式Flash pdf,当我下载该页面源代码时,指向pdf的链接: http://issuu.com/lasirena/docs/af_fulleto_setembre_andorra_sense_c?e=3360093/9079351
没有显示,我对源代码的唯一依据是:3360093/9079351 我试图找到一种方法来建立它的pdf链接,但我找不到名称" af_fulleto_setembre_andorra_sense_c"任何地方...
我已经制作了大量这样的自动下载,但这是我第一次无法构建或获取pdf链接,而我似乎无法找到方法,它甚至可能吗?
我试图找到jpg的链接,但也没有成功。无论哪种方式(jpg或pdf)都很好......
PS:文档ID也没有显示在下载的源代码上。
谢谢。
答案 0 :(得分:0)
我认为这是一个解决方法,有些人可能不会认为这是一个解决方案但在我的情况下工作正常,因为它取决于ISSUU发布者帐户。 解决方案本身正在向我正在寻找的发布商帐户发送与ISSUU API相关的请求。
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
}
你必须注意参数&#34; pageSize&#34; API允许的最大值为100,这意味着您获得的最大结果数为100,因为我跟随的帐户大约有240个pdf,我使用参数&#34使用了此请求一次; resultOrder = asc&#34;另一次使用值&#34; resultOrder = desc&#34;。
这使我得到了前100个pdf和最新的100个pdf插入。 由于我不需要历史记录,只是他们将从现在开始发送的PDF文件,但它没有任何作用。
完成我的代码我将所有文档的ID发送到我创建的sql数据库,当我启动程序时,我会检查ID是否已经下载,如果不是,则下载pdf,如果是,则不会。
希望有人能找到有用的工作