[EtsyBridge] Repair bridge and flip checkbox (#2457)

This commit is contained in:
Yaman Qalieh 2022-03-29 16:23:14 -04:00 committed by GitHub
parent a746987d7a
commit 98a0c2de55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 12 deletions

View File

@ -22,12 +22,10 @@ class EtsyBridge extends BridgeAbstract {
(anything after ?search=<your search query>)', (anything after ?search=<your search query>)',
'exampleValue' => '&explicit=1&locationQuery=2921044' 'exampleValue' => '&explicit=1&locationQuery=2921044'
), ),
'showimage' => array( 'hideimage' => array(
'name' => 'Show image in content', 'name' => 'Hide image in content',
'type' => 'checkbox', 'type' => 'checkbox',
'required' => false, 'title' => 'Activate to hide the image in the content',
'title' => 'Activate to show the image in the content',
'defaultValue' => 'checked'
) )
) )
); );
@ -35,29 +33,29 @@ class EtsyBridge extends BridgeAbstract {
public function collectData(){ public function collectData(){
$html = getSimpleHTMLDOM($this->getURI()); $html = getSimpleHTMLDOM($this->getURI());
$results = $html->find('li.block-grid-item'); $results = $html->find('li.wt-list-unstyled');
foreach($results as $result) { foreach($results as $result) {
// Skip banner cards (ads for categories) // Remove Lazy loading
if($result->find('span.ad-indicator')) if($result->find('.wt-skeleton-ui', 0))
continue; continue;
$item = array(); $item = array();
$item['title'] = $result->find('a', 0)->title; $item['title'] = $result->find('a', 0)->title;
$item['uri'] = $result->find('a', 0)->href; $item['uri'] = $result->find('a', 0)->href;
$item['author'] = $result->find('p.text-gray-lighter', 0)->plaintext; $item['author'] = $result->find('p.wt-text-gray > span', 2)->plaintext;
$item['content'] = '<p>' $item['content'] = '<p>'
. $result->find('span.currency-value', 0)->plaintext . ' '
. $result->find('span.currency-symbol', 0)->plaintext . $result->find('span.currency-symbol', 0)->plaintext
. $result->find('span.currency-value', 0)->plaintext
. '</p><p>' . '</p><p>'
. $result->find('a', 0)->title . $result->find('a', 0)->title
. '</p>'; . '</p>';
$image = $result->find('img.display-block', 0)->src; $image = $result->find('img.wt-display-block', 0)->src;
if($this->getInput('showimage')) { if(!$this->getInput('hideimage')) {
$item['content'] .= '<img src="' . $image . '">'; $item['content'] .= '<img src="' . $image . '">';
} }