|
@@ -390,33 +390,66 @@ class HtmlCollect extends Command |
|
@@ -390,33 +390,66 @@ class HtmlCollect extends Command |
|
390
|
$js_html = curl_c(getImageUrl($new_source), false);
|
390
|
$js_html = curl_c(getImageUrl($new_source), false);
|
|
391
|
preg_match_all("/[large|thumb]+URL:['\"]+(\s*[^>]+?)['\"]+,/i", $js_html, $result_js_source);
|
391
|
preg_match_all("/[large|thumb]+URL:['\"]+(\s*[^>]+?)['\"]+,/i", $js_html, $result_js_source);
|
|
392
|
$js_source = $result_js_source[1] ?? [];
|
392
|
$js_source = $result_js_source[1] ?? [];
|
|
393
|
- foreach ($js_source as $vjs) {
|
|
|
|
394
|
- $vjs_result = $this->url_check($vjs, $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
395
|
- if (!$vjs_result) {
|
|
|
|
396
|
- continue;
|
|
|
|
397
|
- }
|
393
|
+ if($js_source){
|
|
|
|
394
|
+ foreach ($js_source as $vjs) {
|
|
|
|
395
|
+ $vjs_result = $this->url_check($vjs, $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
396
|
+ if (!$vjs_result) {
|
|
|
|
397
|
+ continue;
|
|
|
|
398
|
+ }
|
|
398
|
|
399
|
|
|
399
|
- if ($vjs_result['download']) {
|
|
|
|
400
|
- $new_vjs = CosService::uploadRemote($project_id, 'source', $vjs_result['url_complete']);
|
|
|
|
401
|
- if ($new_vjs) {
|
|
|
|
402
|
- CollectSource::insert([
|
|
|
|
403
|
- 'project_id' => $project_id,
|
|
|
|
404
|
- 'origin' => $vjs_result['url'],
|
|
|
|
405
|
- 'target' => $new_vjs,
|
|
|
|
406
|
- 'created_at' => date('Y-m-d H:i:s'),
|
|
|
|
407
|
- 'updated_at' => date('Y-m-d H:i:s'),
|
|
|
|
408
|
- ]);
|
|
|
|
409
|
- $js_html = str_replace($vjs, getImageUrl($new_vjs), $js_html);
|
400
|
+ if ($vjs_result['download']) {
|
|
|
|
401
|
+ $new_vjs = CosService::uploadRemote($project_id, 'source', $vjs_result['url_complete']);
|
|
|
|
402
|
+ if ($new_vjs) {
|
|
|
|
403
|
+ CollectSource::insert([
|
|
|
|
404
|
+ 'project_id' => $project_id,
|
|
|
|
405
|
+ 'origin' => $vjs_result['url'],
|
|
|
|
406
|
+ 'target' => $new_vjs,
|
|
|
|
407
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
|
408
|
+ 'updated_at' => date('Y-m-d H:i:s'),
|
|
|
|
409
|
+ ]);
|
|
|
|
410
|
+ $js_html = str_replace($vjs, getImageUrl($new_vjs), $js_html);
|
|
|
|
411
|
+ }
|
|
|
|
412
|
+ } else {
|
|
|
|
413
|
+ $js_html = str_replace($vjs, getImageUrl($vjs_result['url_complete']), $js_html);
|
|
410
|
}
|
414
|
}
|
|
411
|
- } else {
|
|
|
|
412
|
- $js_html = str_replace($vjs, getImageUrl($vjs_result['url_complete']), $js_html);
|
|
|
|
413
|
}
|
415
|
}
|
|
|
|
416
|
+
|
|
|
|
417
|
+ CosService::uploadRemote($project_id, 'source', $new_source, $new_source, $js_html);
|
|
|
|
418
|
+ }
|
|
|
|
419
|
+ }
|
|
|
|
420
|
+ }
|
|
|
|
421
|
+ } elseif(substr($vs['url_complete'], -2, 2) == 'js') {
|
|
|
|
422
|
+
|
|
|
|
423
|
+ $js_html = curl_c(getImageUrl($vs['url_complete']), false);
|
|
|
|
424
|
+ preg_match_all("/[large|thumb]+URL:['\"]+(\s*[^>]+?)['\"]+,/i", $js_html, $result_js_source);
|
|
|
|
425
|
+ $js_source = $result_js_source[1] ?? [];
|
|
|
|
426
|
+ if($js_source){
|
|
|
|
427
|
+ foreach ($js_source as $vjs) {
|
|
|
|
428
|
+ $vjs_result = $this->url_check($vjs, $project_id, $domain, $web_url_domain, $home_url);
|
|
|
|
429
|
+ if (!$vjs_result) {
|
|
|
|
430
|
+ continue;
|
|
414
|
}
|
431
|
}
|
|
415
|
|
432
|
|
|
416
|
- CosService::uploadRemote($project_id, 'source', $new_source, $new_source, $js_html);
|
433
|
+ if ($vjs_result['download']) {
|
|
|
|
434
|
+ $new_vjs = CosService::uploadRemote($project_id, 'source', $vjs_result['url_complete']);
|
|
|
|
435
|
+ if ($new_vjs) {
|
|
|
|
436
|
+ CollectSource::insert([
|
|
|
|
437
|
+ 'project_id' => $project_id,
|
|
|
|
438
|
+ 'origin' => $vjs_result['url'],
|
|
|
|
439
|
+ 'target' => $new_vjs,
|
|
|
|
440
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
|
441
|
+ 'updated_at' => date('Y-m-d H:i:s'),
|
|
|
|
442
|
+ ]);
|
|
|
|
443
|
+ $js_html = str_replace($vjs, getImageUrl($new_vjs), $js_html);
|
|
|
|
444
|
+ }
|
|
|
|
445
|
+ } else {
|
|
|
|
446
|
+ $js_html = str_replace($vjs, getImageUrl($vjs_result['url_complete']), $js_html);
|
|
|
|
447
|
+ }
|
|
417
|
}
|
448
|
}
|
|
|
|
449
|
+
|
|
|
|
450
|
+ CosService::uploadRemote($project_id, 'source', $vs['url_complete'], $vs['url_complete'], $js_html);
|
|
418
|
}
|
451
|
}
|
|
419
|
- } else {
|
452
|
+ }else{
|
|
420
|
$html = str_replace($vs['url'], getImageUrl($vs['url_complete']), $html);
|
453
|
$html = str_replace($vs['url'], getImageUrl($vs['url_complete']), $html);
|
|
421
|
}
|
454
|
}
|
|
422
|
}
|
455
|
}
|