MarkEdmondson1234 / searchConsoleR

R interface with Google Search Console API v3, including Search Analytics.
http://code.markedmondson.me/searchConsoleR/
Other
114 stars 41 forks source link

Consolidating searchConsoleR list_sitemaps where profiles have variable numbers of sitemaps. #42

Open james-faulkes opened 6 years ago

james-faulkes commented 6 years ago

Hi guys, I am trying to consolidate sitemaps data from a large list of websites in search console. I am coercing the data into a data frame and then rbind'ing and looping through the profiles.

All is working, except when a search console profile has multiple sitemaps.

When you review the ouput, you can see that the $contents are provided separately to the $sitemap

list_sitemaps("http://www.brand.com/") $sitemap path lastSubmitted isPending isSitemapsIndex type lastDownloaded warnings errors 1 http://www.brand.com/ca/en/sitemap.xml 2018-05-18T03:15:36.538Z FALSE FALSE sitemap 2018-05-23T04:01:27.494Z 0 0 2 http://www.brand.com/sitemap.xml 2014-10-30T07:27:25.039Z FALSE FALSE sitemap 2017-06-18T23:38:37.379Z 4 1 3 http://www.brand.com/uk/sitemap.xml 2018-05-18T15:39:21.495Z TRUE FALSE sitemap 2018-05-17T23:52:48.708Z 1 0

$contents $contents[[1]] type submitted indexed 1 web 508 498

$contents[[2]] type submitted indexed 1 web 1047 24

$contents[[3]] type submitted indexed 1 web 825 806

So whilst every other profile linked to this domain produces 11 columns in the data frame, this one produces 17.

As you can see it is producing contents.submitted.1/2/3 for each profile and repeating the data. I am guessing there must be some method to control this within r than I do not know?

**sitemap.path sitemap.lastSubmitted sitemap.isPending sitemap.isSitemapsIndex sitemap.type sitemap.lastDownloaded sitemap.warnings sitemap.errors contents.type contents.submitted contents.indexed contents.type.1 contents.submitted.1 contents.indexed.1 contents.type.2 contents.submitted.2 contents.indexed.2**
                                 
http://www.brand.com/ca/en/sitemap.xml 2018-05-18T03:15:36.538Z FALSE FALSE sitemap 2018-05-23T04:01:27.494Z 0 0 web 508 498 web 1047 24 web 825 806
http://www.brand.com/sitemap.xml 2014-10-30T07:27:25.039Z FALSE FALSE sitemap 2017-06-18T23:38:37.379Z 4 1 web 508 498 web 1047 24 web 825 806
http://www.brand.com/uk/sitemap.xml 2018-05-18T15:39:21.495Z TRUE FALSE sitemap 2018-05-17T23:52:48.708Z 1 0 web 508 498 web 1047 24 web 825 806
james-faulkes commented 6 years ago

To be clear, list_sitemaps is returning 2 separate data frames and then I am coercing them into 1, resulting in multiple columns being created

MarkEdmondson1234 commented 6 years ago

Hi James, sorry I am a bit unclear on the question here - I think perhaps you are looking at seeing the structure of what is returned, which may be better seen via str(obj) rather than as a data.frame.