|
@@ -185,7 +185,7 @@ switch (key)
|
|
|
|
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
- string temSavePath = $"{savePath}{strPubDate}";
|
|
|
+ string temSavePath = Path.Combine(savePath,start.Year.ToString(),strPubDate); //$"{savePath}{strPubDate}";
|
|
|
if (TotalPatents > 0)
|
|
|
{
|
|
|
|
|
@@ -196,7 +196,7 @@ switch (key)
|
|
|
|
|
|
if (TotalPatents > 10000)
|
|
|
{
|
|
|
- list = new IPRSSearcher().splitCondition(strCondition,DateTime.Now.AddYears(-15),DateTime.Now);
|
|
|
+ list = new IPRSSearcher().splitCondition(strCondition,DateTime.Parse("1985-01-01"),start.AddDays(1));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -255,7 +255,7 @@ switch (key)
|
|
|
|
|
|
if (!System.IO.File.Exists($"{temSavePath}/{appNo}.json"))
|
|
|
{
|
|
|
- RetiredPatents++;
|
|
|
+
|
|
|
using (StreamWriter writer = new StreamWriter($"{temSavePath}/{appNo}.json"))
|
|
|
{
|
|
|
writer.WriteLine(Datas[i].ToString());
|
|
@@ -265,12 +265,12 @@ switch (key)
|
|
|
TryGetMainPic:
|
|
|
try
|
|
|
{
|
|
|
- string mpicUrl = searcher1.GetPatentCnMainPic(appNo);
|
|
|
- byte[] data = new HttpClient().GetByteArrayAsync(mpicUrl).Result;
|
|
|
- using (FileStream fileStream = new FileStream($"{temSavePath}/{appNo}_abs.jpeg", FileMode.Create))
|
|
|
- {
|
|
|
- fileStream.Write(data, 0, data.Length);
|
|
|
- }
|
|
|
+ //string mpicUrl = searcher1.GetPatentCnMainPic(appNo);
|
|
|
+ //byte[] data = new HttpClient().GetByteArrayAsync(mpicUrl).Result;
|
|
|
+ //using (FileStream fileStream = new FileStream($"{temSavePath}/{appNo}_abs.jpeg", FileMode.Create))
|
|
|
+ //{
|
|
|
+ // fileStream.Write(data, 0, data.Length);
|
|
|
+ //}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -283,63 +283,71 @@ switch (key)
|
|
|
|
|
|
if (strType == "3")
|
|
|
{
|
|
|
- Console.WriteLine($"{(page - 1) * 50 + i + 1}/{TotalPatents1}-{RetiredPatents}/{TotalPatents}\t{appNo}\t{DateTime.Now}\t{start.ToString("yyyMMdd")}");
|
|
|
- continue;
|
|
|
- string strWGImagesUrl = searcher1.GetPatentCNWGImage(appNo);
|
|
|
-
|
|
|
- if (!string.IsNullOrEmpty(strWGImagesUrl))
|
|
|
- {
|
|
|
- using (StreamWriter writer = new StreamWriter($"{temSavePath}/{appNo}_ImageUrls.txt"))
|
|
|
- {
|
|
|
- writer.WriteLine(strWGImagesUrl);
|
|
|
- }
|
|
|
- #region
|
|
|
- //break;
|
|
|
-
|
|
|
- //string[] img_urls = strWGImagesUrl.Split('|');
|
|
|
-
|
|
|
- //for (int idx = 0; idx < img_urls.Length; idx++)
|
|
|
- //{
|
|
|
- // int iTryGetPic = 0;
|
|
|
- //TryGetPic:
|
|
|
- // try
|
|
|
- // {
|
|
|
- // byte[] data = new HttpClient().GetByteArrayAsync(img_urls[idx]).Result;
|
|
|
- // using (FileStream fileStream = new FileStream($"{temSavePath}/{appNo}_img{idx + 1}.jpeg", FileMode.Create))
|
|
|
- // {
|
|
|
- // fileStream.Write(data, 0, data.Length);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // catch
|
|
|
- // {
|
|
|
- // iTryGetPic++;
|
|
|
-
|
|
|
- // if (iTryGetPic < 3)
|
|
|
- // {
|
|
|
- // goto TryGetPic;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // Console.WriteLine($"{appNo}图{idx}获取错误!");
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- //}
|
|
|
- #endregion
|
|
|
-
|
|
|
- }
|
|
|
+ //Console.WriteLine($"{(page - 1) * 50 + i + 1}/{TotalPatents1}-{RetiredPatents}/{TotalPatents}\t{appNo}\t{DateTime.Now}\t{start.ToString("yyyMMdd")}");
|
|
|
+
|
|
|
+ //string strWGImagesUrl = searcher1.GetPatentCNWGImage(appNo);
|
|
|
+
|
|
|
+ //if (!string.IsNullOrEmpty(strWGImagesUrl))
|
|
|
+ //{
|
|
|
+ // using (StreamWriter writer = new StreamWriter($"{temSavePath}/{appNo}_ImageUrls.txt"))
|
|
|
+ // {
|
|
|
+ // writer.WriteLine(strWGImagesUrl);
|
|
|
+ // }
|
|
|
+ // #region
|
|
|
+ // //break;
|
|
|
+
|
|
|
+ // //string[] img_urls = strWGImagesUrl.Split('|');
|
|
|
+
|
|
|
+ // //for (int idx = 0; idx < img_urls.Length; idx++)
|
|
|
+ // //{
|
|
|
+ // // int iTryGetPic = 0;
|
|
|
+ // //TryGetPic:
|
|
|
+ // // try
|
|
|
+ // // {
|
|
|
+ // // byte[] data = new HttpClient().GetByteArrayAsync(img_urls[idx]).Result;
|
|
|
+ // // using (FileStream fileStream = new FileStream($"{temSavePath}/{appNo}_img{idx + 1}.jpeg", FileMode.Create))
|
|
|
+ // // {
|
|
|
+ // // fileStream.Write(data, 0, data.Length);
|
|
|
+ // // }
|
|
|
+ // // }
|
|
|
+ // // catch
|
|
|
+ // // {
|
|
|
+ // // iTryGetPic++;
|
|
|
+
|
|
|
+ // // if (iTryGetPic < 3)
|
|
|
+ // // {
|
|
|
+ // // goto TryGetPic;
|
|
|
+ // // }
|
|
|
+ // // else
|
|
|
+ // // {
|
|
|
+ // // Console.WriteLine($"{appNo}图{idx}获取错误!");
|
|
|
+ // // }
|
|
|
+ // // }
|
|
|
+
|
|
|
+ // //}
|
|
|
+ // #endregion
|
|
|
+
|
|
|
+ //}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
string strFullText = searcher1.GetPatentFullTxtInfo(appNo);
|
|
|
- using (StreamWriter writer = new StreamWriter($"{temSavePath}/{appNo}_fulltext.xml"))
|
|
|
+ if (!string.IsNullOrEmpty(strFullText))
|
|
|
{
|
|
|
- writer.WriteLine(strFullText);
|
|
|
+ using (StreamWriter writer = new StreamWriter($"{temSavePath}/{appNo}_fulltext.xml"))
|
|
|
+ {
|
|
|
+ writer.WriteLine(strFullText);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ RetiredPatents++;
|
|
|
}
|
|
|
-
|
|
|
+ else
|
|
|
+ {
|
|
|
+ RetiredPatents++;
|
|
|
+ }
|
|
|
+
|
|
|
Console.WriteLine($"{(page - 1) * 50 + i + 1}/{TotalPatents1}-{RetiredPatents}/{TotalPatents}\t{appNo}\t{DateTime.Now}\t{start.ToString("yyyMMdd")}");
|
|
|
|
|
|
}
|
|
@@ -351,10 +359,10 @@ switch (key)
|
|
|
}
|
|
|
}
|
|
|
start = start.AddDays(1);
|
|
|
- while ((start.DayOfWeek != DayOfWeek.Friday ) && (start.DayOfWeek != DayOfWeek.Tuesday))
|
|
|
- {
|
|
|
- start = start.AddDays(1);
|
|
|
- }
|
|
|
+ //while ((start.DayOfWeek != DayOfWeek.Friday ) && (start.DayOfWeek != DayOfWeek.Tuesday))
|
|
|
+ //{
|
|
|
+ // start = start.AddDays(1);
|
|
|
+ //}
|
|
|
|
|
|
}
|
|
|
|