Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
giauphan committed Mar 14, 2024
1 parent 18141c9 commit 7e728fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

"require": {
"php": "^8.1",
"giauphan/goutte": "*",
"giauphan/goutte": "^1.1",
"guzzlehttp/guzzle": "^7.2",
"illuminate/console": "*",
"illuminate/database": "*"
Expand Down
8 changes: 5 additions & 3 deletions src/Commands/CrawlBlogData.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Giauphan\CrawlBlog\Models\CategoryBlog;
use Giauphan\CrawlBlog\Models\Post;
use Illuminate\Console\Command;
use Weidner\Goutte\GoutteFacade;
use Giauphan\Client;
use Illuminate\Support\Str;
use Carbon\Carbon;
use Symfony\Component\DomCrawler\Crawler;
Expand All @@ -30,7 +30,8 @@ public function handle()
$category = CategoryBlog::firstOrCreate(['name' => $categoryName], ['slug' => Str::slug($categoryName)]);
$categoryId = $category->id;
do {
$crawler = GoutteFacade::request('GET', $pageUrl);
$client = new Client();
$crawler = $client->request('GET', $pageUrl);

$crawl_arr = $crawler->filter('.classnameBLog');
if ($crawl_arr->count() === 0) {
Expand Down Expand Up @@ -69,7 +70,8 @@ public function handle()

public function scrapeData($url, $title, $image, $summary, $categoryId, $lang)
{
$crawler = GoutteFacade::request('GET', $url);
$client = new Client();
$crawler =$client->request('GET', $url);
$content = $this->crawlData_html('#main .post', $crawler);
$check = Post::all();

Expand Down

0 comments on commit 7e728fb

Please sign in to comment.