new-scrapper #1

Open
RomanGolienko wants to merge 2 commits from new-scrapper into main
5 changed files with 27 additions and 9 deletions
Showing only changes of commit 02e6ad458c - Show all commits

1
.gitignore vendored
View File

@ -21,3 +21,4 @@ yarn-error.log
/.phpstorm.meta.php
/_ide_helper.php
/_ide_helper_models.php
/public/img/icons/play-button.png

View File

@ -22,7 +22,7 @@ class PageScrapper
$arr = [];
$rez = preg_match_all($strForPregMatch, $page, $arr);
return $content = $arr[1][0];
return $content = $arr[0][0];
}
public function normalizeURLFile($content)

View File

@ -8,8 +8,9 @@
],
"license": "MIT",
"require": {
"php": "^8.2",
"php": "^8.1|8.2",
"guzzlehttp/guzzle": "^7.8.1",
"imangazaliev/didom": "^2.0",
"laravel/framework": "^10.41.0",
"laravel/sanctum": "^3.3.3",
"laravel/tinker": "^2.9.0",
@ -64,6 +65,7 @@
}
},
"config": {
"platform-check": false,
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,

View File

@ -1,4 +1,5 @@
@extends('layouts.applicant-layout')
@section('content')
<style>
@ -35,12 +36,25 @@
<div class="col-10">
@php
use App\Services\PageScrapper;
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/podat-dokumenty-onlayn/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row);
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
echo $content;
use DiDom\Document;
$document = new Document('https://mkgtu.ru/postuplenie/podat-dokumenty-onlayn/', true);
$posts = $document->find('.content_info');
echo $document->first('.content_info')->html();
/*
use App\Services\PageScrapper;
$pageScrapper = new PageScrapper("https://mkgtu.ru/postuplenie/podat-dokumenty-onlayn/", '<div class=["\']content_info["\']>');
$row = $pageScrapper->getHTML();
$content = $pageScrapper->normalizeURLFile($row);
$content = $pageScrapper->cutHTML($content,'/<footer(.*)<\/footer>/isU');
echo $content;
*/
@endphp

View File

@ -28,13 +28,14 @@
$row3 = $pageScrapper3->cutHTML($row3,'/<footer(.*)<\/footer>/isU');
$content = $row . $row2 . $row3;
//dd($content);
//$content = $pageScrapper->cutHTML($row,'/<footer(.*)<\/footer>/isU');
// $content = $pageScrapper->normalizeURLFile($content);
echo htmlspecialchars($content);
echo $content;
@endphp