Skip to content

Commit

Permalink
php cs
Browse files Browse the repository at this point in the history
  • Loading branch information
cacing69 committed Sep 6, 2023
1 parent e45edde commit 87dfdf8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Release Notes

## [v1.2.0](https://github.com/cacing69/cquery/compare/v1.1.0...v1.2.0) (2023-09-06)

- Support for multi Loader, it will be enable to scrape with another engine
- Now u can scrape webpage loaded by js/ajax, but u need to use [Panther Adapter](https://github.com/cacing69/cquery-panther-loader) to make it work

## [v1.1.0](https://github.com/cacing69/cquery/compare/v1.0.0...v1.1.0) (2023-09-06)

- Add method onContentLoaded(Closure $closure) for submit or go to another page when content loaded
- Add method eachItem(Closure $closure) to manipulate each item
- Add method onObtainedResults(Closure $closure) to manipulate result array with closure callback
- Add single quotes adapter
- Add String adapter
- Add Integer adapter
- Add Float adapter

## [v1.0.0](https://github.com/cacing69/cquery/releases/tag/v1.0.0) (2023-09-05)

- First release
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recen

### Currently experimenting

Attempt to extract data from webpage which, in my opinion, becomes more enjoyable. All methods and usage instructions provided here are designed according to that i needs. If you have any suggestions or feedback to improve them, it would be highly appreciated and
Attempt to extract data from webpage which, in my opinion, becomes more enjoyable, my intention in creating this was to enable web scraping of websites that utilize js/ajax for content loading.

To perform web scraping on pages loaded with js/ajax, you need an adapter outside of this package, this was developed using `symfony/panther`. I don't want to add it as a default package in the core of cquery because, this feature is optional for some people. Please check and understand its usage here. I refer to it as [cacing69/cquery-panther-loader](https://github.com/cacing69/cquery-panther-loader). Read more information about [symfony/panther](https://github.com/symfony/panther), you'll discover installation and additional information there

All methods and usage instructions provided here are designed according to that i needs. If you have any suggestions or feedback to improve them, it would be highly appreciated and

### What kind of thing is this

Expand All @@ -39,6 +43,7 @@ I would greatly accept any support/contribution from everyone. See [CONTRIBUTING
- [Manipulate Query Result](#handle-manipualte-result)
- [Multiple Requests (to get detail from another url)](#handle-multi-async)
- [Doing action after page load (click link/submit form)](#handle-doing-action)
- [Scrape website load by js/ajax)](#handle-doing-action)

## Quick Installation

Expand Down
2 changes: 1 addition & 1 deletion src/Cquery.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
class Cquery
{
private $loaderName = DOMCrawlerLoader::class;
private $loaderName;

/**
* The base Loader instance.
Expand Down
16 changes: 8 additions & 8 deletions src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ protected function fetchCrawler()
$this->crawler = new Crawler($this->client->getResponse()->getContent());
}

// } elseif ($this->clientName === "curl") {
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, $this->uri);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output = curl_exec($ch);

// $this->crawler = new Crawler($output);
// curl_close($ch);
// } elseif ($this->clientName === "curl") {
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, $this->uri);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output = curl_exec($ch);

// $this->crawler = new Crawler($output);
// curl_close($ch);

} else {
throw new CqueryException("client {$this->clientName} doesnt support");
Expand Down
1 change: 1 addition & 0 deletions src/Trait/HasGetWithDomCrawlerMethod.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

namespace Cacing69\Cquery\Trait;

use Cacing69\Cquery\CqueryException;
use Symfony\Component\DomCrawler\Crawler;
use Cacing69\Cquery\Support\Collection;
Expand Down

0 comments on commit 87dfdf8

Please sign in to comment.