|
@@ -74,10 +74,10 @@ public class HttpUtils {
|
|
|
httppost.setHeader("User-Agent", USER_AGENT);
|
|
|
|
|
|
List<Cookie> list = cookieStore.getCookies();
|
|
|
- for (Cookie ck : list) {
|
|
|
- System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
- }
|
|
|
- System.out.println("-------------------------------------");
|
|
|
+// for (Cookie ck : list) {
|
|
|
+// System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
+// }
|
|
|
+// System.out.println("-------------------------------------");
|
|
|
for (String key : headers.keySet()) {
|
|
|
httppost.setHeader(key, headers.get(key));
|
|
|
}
|
|
@@ -122,9 +122,9 @@ public class HttpUtils {
|
|
|
httppost.setHeader("User-Agent", USER_AGENT);
|
|
|
httppost.addHeader("Content-Type", "application/json");
|
|
|
List<Cookie> list = cookieStore.getCookies();
|
|
|
- for (Cookie ck : list) {
|
|
|
- System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
- }
|
|
|
+// for (Cookie ck : list) {
|
|
|
+// System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
+// }
|
|
|
for (String key : headers.keySet()) {
|
|
|
httppost.setHeader(key, headers.get(key));
|
|
|
}
|
|
@@ -190,9 +190,9 @@ public class HttpUtils {
|
|
|
httppost.setHeader("User-Agent", USER_AGENT);
|
|
|
httppost.addHeader("Content-Type", "application/json");
|
|
|
List<Cookie> list = cookieStore.getCookies();
|
|
|
- for (Cookie ck : list) {
|
|
|
- System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
- }
|
|
|
+// for (Cookie ck : list) {
|
|
|
+// System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
+// }
|
|
|
for (String key : headers.keySet()) {
|
|
|
httppost.setHeader(key, headers.get(key));
|
|
|
}
|
|
@@ -226,14 +226,14 @@ public class HttpUtils {
|
|
|
try {
|
|
|
httpGet.setHeader("User-Agent", USER_AGENT);
|
|
|
List<Cookie> list2 = cookieStore.getCookies();
|
|
|
- for (Cookie ck : list2) {
|
|
|
- System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
- }
|
|
|
+// for (Cookie ck : list2) {
|
|
|
+// System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
+// }
|
|
|
response = httpClient.execute(httpGet);
|
|
|
List<Cookie> list = cookieStore.getCookies();
|
|
|
- for (Cookie ck : list) {
|
|
|
- System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
- }
|
|
|
+// for (Cookie ck : list) {
|
|
|
+// System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
+// }
|
|
|
int statusCode = response.getStatusLine().getStatusCode();
|
|
|
if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
|
|
|
String newUrl = response.getFirstHeader("Location").getValue();
|
|
@@ -321,11 +321,11 @@ public class HttpUtils {
|
|
|
HttpPost httpPost = new HttpPost(url);
|
|
|
List<Cookie> list = cookieStore.getCookies();
|
|
|
// cookieStore.clear();
|
|
|
- for (Cookie ck : list) {
|
|
|
-
|
|
|
- System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
- }
|
|
|
- System.out.println("-------------------------------------");
|
|
|
+// for (Cookie ck : list) {
|
|
|
+//
|
|
|
+// System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
+// }
|
|
|
+// System.out.println("-------------------------------------");
|
|
|
httpPost.setHeader("Content-Type", "application/json");
|
|
|
String result = null;
|
|
|
|
|
@@ -340,10 +340,10 @@ public class HttpUtils {
|
|
|
while ((line = reader.readLine()) != null) {
|
|
|
builder.append(line);
|
|
|
}
|
|
|
- for (Cookie ck : list) {
|
|
|
-
|
|
|
- System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
- }
|
|
|
+// for (Cookie ck : list) {
|
|
|
+//
|
|
|
+// System.out.println(ck.getName() + "=" + ck.getValue() + "," + ck.getDomain());
|
|
|
+// }
|
|
|
result = builder.toString();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -388,44 +388,44 @@ public class HttpUtils {
|
|
|
|
|
|
TTFParser ttfParser = new TTFParser();
|
|
|
TrueTypeFont ttf = ttfParser.parse(urlconn.getInputStream());
|
|
|
- System.out.println(new Gson().toJson(ttf.getGlyph().getGlyphs()));
|
|
|
+// System.out.println(new Gson().toJson(ttf.getGlyph().getGlyphs()));
|
|
|
GlyphData[] datas = ttf.getGlyph().getGlyphs();
|
|
|
CmapSubtable[] tables = ttf.getCmap().getCmaps();
|
|
|
Gson gson = new Gson();
|
|
|
- System.out.println(gson.toJson(tables));
|
|
|
+// System.out.println(gson.toJson(tables));
|
|
|
CmapSubtable table = tables[0];
|
|
|
Map<String, Integer> numberMap = new HashMap<String, Integer>();
|
|
|
Map<String, String> fontMap = new HashMap<String, String>();
|
|
|
for (int i = 0; i <= 13; i++) {
|
|
|
GlyphData data = datas[i];
|
|
|
if (data != null) {
|
|
|
- System.out.println("getBoundingBox" + data.getBoundingBox());
|
|
|
+// System.out.println("getBoundingBox" + data.getBoundingBox());
|
|
|
float fx = data.getBoundingBox().getLowerLeftX();
|
|
|
float fy = data.getBoundingBox().getLowerLeftY();
|
|
|
float rx = data.getBoundingBox().getUpperRightX();
|
|
|
float ry = data.getBoundingBox().getUpperRightY();
|
|
|
Integer num = getKuaishouNumber(String.valueOf(rx - fx) + "#" + String.valueOf(ry - fy));
|
|
|
- if (num != null) {
|
|
|
- System.out.println(num);
|
|
|
- }
|
|
|
+// if (num != null) {
|
|
|
+// System.out.println(num);
|
|
|
+// }
|
|
|
fontMap.put(String.valueOf((char) table.getCharCodes(i).get(0).intValue()), String.valueOf(num));
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- System.out.println(new Gson().toJson(fontMap));
|
|
|
+// System.out.println(new Gson().toJson(fontMap));
|
|
|
fontsMap.put(ttfName, fontMap);
|
|
|
for (GlyphData data : datas) {
|
|
|
if (data != null) {
|
|
|
- System.out.println("getBoundingBox" + data.getBoundingBox());
|
|
|
+// System.out.println("getBoundingBox" + data.getBoundingBox());
|
|
|
float fx = data.getBoundingBox().getLowerLeftX();
|
|
|
float fy = data.getBoundingBox().getLowerLeftY();
|
|
|
float rx = data.getBoundingBox().getUpperRightX();
|
|
|
float ry = data.getBoundingBox().getUpperRightY();
|
|
|
Integer num = getKuaishouNumber(String.valueOf(fx) + "#" + String.valueOf(fy) + "#" + String.valueOf(rx) + "#" + String.valueOf(ry));
|
|
|
- System.out.println(num);
|
|
|
+// System.out.println(num);
|
|
|
}
|
|
|
}
|
|
|
- System.out.println(new Gson().toJson(numberMap));
|
|
|
+// System.out.println(new Gson().toJson(numberMap));
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|