serp-spider / search-engine-google

:spider: Google client for SERPS
https://serp-spider.github.io
Other
168 stars 61 forks source link

v0.4.0 Not returning Ad results #98

Open LunarDevelopment opened 6 years ago

LunarDevelopment commented 6 years ago

Hello,

I'm doing requests for pretty standard keywords holiday homes cornwall which does have adwords.

Then parsing natural results fine, but if I parse foreach ($gRank->adwordsResults as $i => $position) { I get 0 results.

Is this a Dom issue ?

using google.co.uk

gsouf commented 6 years ago

Hi @LunarDevelopment

I'm not sure it's related to v0.4 because there were no updates that would broke this part of the code.

Can you confirm it was working just before you upgrade?

PS: did you make sure to use the correct method as seen here https://serp-spider.github.io/documentation/search-engine/google/parse-page/#adwords-sections

In your example you are using ->adwordsResults instead of ->getAdwordsResults()

LunarDevelopment commented 6 years ago

I don't believe it was working pre upgrade.. I'm scraping thousands of terms a day and the last adword record I got was a single result on 2018-05-29 and prior to that 4 results on 2018-05-23.

So it seems to be working 0.0001% of the time..?

$gRank->adwordsResults is the output of $this->adwordsResults = $this->response->getAdwordsResults();

I've tried hundreds of terms while testing and I always get the below from getAdwordsResults()on v0.4.0, I've not had an adword result yet.

object(Serps\Core\Serp\CompositeResultSet)#69 (1) {
  ["resultSets":protected]=>
  array(2) {
    [0]=>
    object(Serps\SearchEngine\Google\AdwordsSectionResultSet)#66 (3) {
      ["location":protected]=>
      string(16) "adws_section_top"
      ["startingAt":protected]=>
      int(0)
      ["items":protected]=>
      array(0) {
      }
    }
    [1]=>
    object(Serps\SearchEngine\Google\AdwordsSectionResultSet)#63 (3) {
      ["location":protected]=>
      string(19) "adws_section_bottom"
      ["startingAt":protected]=>
      int(0)
      ["items":protected]=>
      array(0) {
      }
    }
  }
}

To be honest the adwords results are just being collected as a byproduct which is why they've gone unnoticed but it would be nice to know it's working well / contribute in a small way back to this fantastic library.

LunarDevelopment commented 6 years ago

Here's an output example:

dom.html.zip

dlepaux commented 6 years ago

Same issue here !

LunarDevelopment commented 6 years ago

This resolved it's self for me.

Closing because of inactivity..