回答編集履歴
1
GetHolidays関数の無駄なループ修正
test
CHANGED
@@ -152,190 +152,184 @@
|
|
152
152
|
|
153
153
|
|
154
154
|
|
155
|
+
string date;
|
156
|
+
|
157
|
+
string week;
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
index = GetInnerText(source, index, dateTag, spanEndTag, date);
|
162
|
+
|
163
|
+
if (index < 0)
|
164
|
+
|
165
|
+
{
|
166
|
+
|
167
|
+
return result;
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
index = GetInnerText(source, index, weekTag, spanEndTag, week);
|
174
|
+
|
175
|
+
if (index < 0)
|
176
|
+
|
177
|
+
{
|
178
|
+
|
179
|
+
return result;
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
|
155
185
|
while (true)
|
156
186
|
|
157
187
|
{
|
158
188
|
|
159
|
-
string
|
189
|
+
string country;
|
160
|
-
|
190
|
+
|
161
|
-
string
|
191
|
+
string holiday;
|
162
|
-
|
163
|
-
|
164
|
-
|
192
|
+
|
193
|
+
|
194
|
+
|
165
|
-
index = GetInnerText(source, index,
|
195
|
+
index = GetInnerText(source, index, countryTag, pEndTag, country);
|
166
196
|
|
167
197
|
if (index < 0)
|
168
198
|
|
169
199
|
{
|
170
200
|
|
201
|
+
return result;
|
202
|
+
|
203
|
+
}
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
index = GetInnerText(source, index, holidayTag, pEndTag, holiday);
|
208
|
+
|
209
|
+
if (index < 0)
|
210
|
+
|
211
|
+
{
|
212
|
+
|
213
|
+
return result;
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
result += StringFormat("%s %s %s %s\n", date, week, country, holiday);
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
return result;
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
void OnTimer()
|
232
|
+
|
233
|
+
{
|
234
|
+
|
235
|
+
static int timeHour = -1;
|
236
|
+
|
237
|
+
if(Hour() == timeHour) return;
|
238
|
+
|
239
|
+
timeHour = Hour();
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
string cookie = NULL;
|
244
|
+
|
245
|
+
string headers;
|
246
|
+
|
247
|
+
char post[];
|
248
|
+
|
249
|
+
char result[];
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
string req_url = "https://fx.minkabu.jp/references/holidays";
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
int res = WebRequest(
|
258
|
+
|
259
|
+
"GET", // HTTPメソッド
|
260
|
+
|
261
|
+
req_url, // URL
|
262
|
+
|
263
|
+
cookie, // cookie
|
264
|
+
|
265
|
+
NULL, // リファラ
|
266
|
+
|
267
|
+
5000, // タイムアウト
|
268
|
+
|
269
|
+
post, // HTTPメッセージ本体
|
270
|
+
|
271
|
+
0, // HTTPメッセージサイズ
|
272
|
+
|
273
|
+
result, // 応答データ配列
|
274
|
+
|
275
|
+
headers // 応答ヘッダ
|
276
|
+
|
277
|
+
);
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
if (res == -1) // エラーチェック
|
282
|
+
|
283
|
+
{
|
284
|
+
|
285
|
+
Print("WebRequesエラー。 エラーコード = ", GetLastError());
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
return;
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
string text = CharArrayToString(result, 0, WHOLE_ARRAY,CP_UTF8);
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
string dlTag = "<dl class=\"holidayslist__day flexbox flexbox_wrap flexbox_l-end";
|
300
|
+
|
301
|
+
string dlEndTag = "</dl>";
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
int index = 0;
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
string comment = "";
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
while (true)
|
314
|
+
|
315
|
+
{
|
316
|
+
|
317
|
+
string dl;
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
index = GetTagText(text, index, dlTag, dlEndTag, dl);
|
322
|
+
|
323
|
+
if (index < 0)
|
324
|
+
|
325
|
+
{
|
326
|
+
|
171
327
|
break;
|
172
328
|
|
173
329
|
}
|
174
330
|
|
175
331
|
|
176
332
|
|
177
|
-
index = GetInnerText(source, index, weekTag, spanEndTag, week);
|
178
|
-
|
179
|
-
if (index < 0)
|
180
|
-
|
181
|
-
{
|
182
|
-
|
183
|
-
break;
|
184
|
-
|
185
|
-
}
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
while (true)
|
190
|
-
|
191
|
-
{
|
192
|
-
|
193
|
-
string country;
|
194
|
-
|
195
|
-
string holiday;
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
index = GetInnerText(source, index, countryTag, pEndTag, country);
|
200
|
-
|
201
|
-
if (index < 0)
|
202
|
-
|
203
|
-
{
|
204
|
-
|
205
|
-
return result;
|
206
|
-
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
index = GetInnerText(source, index, holidayTag, pEndTag, holiday);
|
212
|
-
|
213
|
-
if (index < 0)
|
214
|
-
|
215
|
-
{
|
216
|
-
|
217
|
-
return result;
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
result += StringFormat("%s %s %s %s\n", date, week, country, holiday);
|
224
|
-
|
225
|
-
}
|
226
|
-
|
227
|
-
}
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
return result;
|
232
|
-
|
233
|
-
}
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
void OnTimer()
|
238
|
-
|
239
|
-
{
|
240
|
-
|
241
|
-
static int timeHour = -1;
|
242
|
-
|
243
|
-
if(Hour() == timeHour) return;
|
244
|
-
|
245
|
-
timeHour = Hour();
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
string cookie = NULL;
|
250
|
-
|
251
|
-
string headers;
|
252
|
-
|
253
|
-
char post[];
|
254
|
-
|
255
|
-
char result[];
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
string req_url = "https://fx.minkabu.jp/references/holidays";
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
int res = WebRequest(
|
264
|
-
|
265
|
-
"GET", // HTTPメソッド
|
266
|
-
|
267
|
-
req_url, // URL
|
268
|
-
|
269
|
-
cookie, // cookie
|
270
|
-
|
271
|
-
NULL, // リファラ
|
272
|
-
|
273
|
-
5000, // タイムアウト
|
274
|
-
|
275
|
-
post, // HTTPメッセージ本体
|
276
|
-
|
277
|
-
0, // HTTPメッセージサイズ
|
278
|
-
|
279
|
-
result, // 応答データ配列
|
280
|
-
|
281
|
-
headers // 応答ヘッダ
|
282
|
-
|
283
|
-
);
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
if (res == -1) // エラーチェック
|
288
|
-
|
289
|
-
{
|
290
|
-
|
291
|
-
Print("WebRequesエラー。 エラーコード = ", GetLastError());
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
return;
|
296
|
-
|
297
|
-
}
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
string text = CharArrayToString(result, 0, WHOLE_ARRAY,CP_UTF8);
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
string dlTag = "<dl class=\"holidayslist__day flexbox flexbox_wrap flexbox_l-end";
|
306
|
-
|
307
|
-
string dlEndTag = "</dl>";
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
int index = 0;
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
string comment = "";
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
while (true)
|
320
|
-
|
321
|
-
{
|
322
|
-
|
323
|
-
string dl;
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
index = GetTagText(text, index, dlTag, dlEndTag, dl);
|
328
|
-
|
329
|
-
if (index < 0)
|
330
|
-
|
331
|
-
{
|
332
|
-
|
333
|
-
break;
|
334
|
-
|
335
|
-
}
|
336
|
-
|
337
|
-
|
338
|
-
|
339
333
|
comment += GetHolidays(dl);
|
340
334
|
|
341
335
|
}
|