Forum

Automated Search Re...
 
Notifications
Clear all

Automated Search Results Returning Nothing

9 Posts
2 Users
0 Reactions
74 Views
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
Topic starter
 

Hi,

 

Please can check why I get zero result when I run this macro.

 

Thanks;

Bill

 
Posted : 04/10/2020 7:19 am
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
Topic starter
 

Hi Bill,

Please start your own topic if you have a question, don't tag on to someone else's topic.

Your code doesn't work because you're looking for an element in the HTML that doesn't exist

Set var1 = html.getelementbyid("resultStats")

If you load the search URL into your browser and then examine the source code of the results page, you'll see there isn't an element with the ID resultStats.  Modify the code to find the correct ID.

Regards

Phil

 
Posted : 04/10/2020 9:23 pm
(@bill-jone)
Posts: 28
Eminent Member
 

Hi Phil

It is working now. How kind you are to help me. Thank you very much.

I still need your help, I need to add new column to get the URL as I have some companies and I want to get their websites in separated column. please check attached file.

Thank you very much; your support is greatly appreciated.

Thanks;

Bill

 
Posted : 06/10/2020 5:13 pm
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
Topic starter
 

No problem Bill.

Where do you want to get the company website address from? 

Looking at the results I get when searching, for 3M the 1st search result has a website address, but there's also an address on the right hand side of the screen where there is specific company information.

My results for Toshiba don't show a web address on the right hand side.

So will you settle for the first result in search, which isn't necessarily going to be the company's website.

Regards

Phil

toshiba-search-result-1.png3m-search-result-1.png

 
Posted : 06/10/2020 7:06 pm
(@bill-jone)
Posts: 28
Eminent Member
 

Hi Phil,

Thank you very much; your support is greatly appreciated.

Please if you can update the macro by two results, each result will be in separated column.

Also I am surprised as I see google result have website for Toshiba, please check attached image.

Thanks again for all your assistance.

Thanks;

Bill

Toshiba-1.png

 
Posted : 07/10/2020 8:59 am
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
Topic starter
 

Hi Bill,

Google search results are location specific.  The results it gives me when I search here in Australia will most likely be different to what you see when you search - and your image verifies this.

I'm not sure what you mean by 'update the macro by two results, each result will be in separated column'?

Do you mean get 2 website addresses from the search results, 1 from the main results and the other from the company specific panel on the right hand side of the page?

Regards

Phil

 
Posted : 07/10/2020 6:48 pm
(@bill-jone)
Posts: 28
Eminent Member
 

Hi Phil,

Yes please I want to 2 website addresses from the search results, 1 from the main results and the other from the company specific panel on the right hand side of the page.

I'm sure you are very busy, so when you have a chance please reply me.

That's a huge help - thanks!

Thanks;

Bill

 
Posted : 08/10/2020 5:44 am
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
Topic starter
 

Hi Bill,

This is proving to be very difficult to implement.  Google results are not in a fixed format.  Not only do the results vary by where you are when you do your search, they can vary by the network you are on, the browser you are using etc.

I've written code to pick out the info you need but it doesn't always work because the section of the results page that shows the company info and web address for 3M (for example) contains different info if I search for something else.  If I search for abbott italy I get a map at the top of the search results with various links and other info.

Getting inconsistent page layout of the results makes it very difficult to write any generic code to get the info you are after.

As we've already discussed, the results you see are different to what I see.  I'm getting results specifically tailored to being in Australia.  The info and website addresses for 3M are different to what you are seeing

Added to this a lot of the content of the page is not using easily identifiable elements.  Some parts of the HTML do not have an ID.  Most have CSS class names that look randomly generated.  Whilst they'd need to be consistent with the CSS rules in order for page styling to work, I have no idea if they will suddenly change a class name to something else.  If that happened, any code to identify an element on the page would stop working.

Sorry, I just can't get my code to consistently retrieve the data because the layout and content of the search result pages keeps changing.

Phil

 
Posted : 09/10/2020 10:09 pm
(@bill-jone)
Posts: 28
Eminent Member
 

Hi Phil,

Words cannot express how grateful I am for your help.

I got what you mean, currently the attached macro give the first result from google but the result contain that the website + Title in the same cell.

so Is there ability to get the hyperlinks only as below.

Searched word is 3M

Current result:  

Web results

3M Science. Applied to Life. 3M United Stateswww.3m.comwww.3m.com
Cached
3M applies science and innovation to make a real impact by igniting progress and inspiring innovation in lives and communities across the globe.
‎About 3M · ‎Products · ‎Covid-19 · ‎Personal Protective Equipment

Expected result from macro after the update:

https://www.3m.com/

I will always remember your kindness and support. Thank you very much!

Thanks;

Bill

 
Posted : 10/10/2020 11:51 am
Share: