cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FloriGi
Frequent Visitor

No content with Web.Contents vs. Web.BrowserContents

Dear all,

I have an - at least for me - strange behaviour here. A simplified example:

I want to scrape some Reviews & Ratings values from a Web-Shop

 

It works perfectly fine in PBI Desktop and I receive the intended values in my table.

But I want to run it as a PBI service - so not possible with Web.BrowserContents as far as I know - thus I switch to Web.Contents (with Web.Contents I run some other projects successfully in PBI Service with RelativePath, etc).

 

But this time & in this specific Web-Shop I receive with the same code "w/o the Browser" only an empty table!?

 

Looking one step before I see in this case that I can find "manually" the respective product information in the HTML results of Web.BrowserContents while I can't see the product information in the HTML results of Web.Contents manually either, but rather a very short HTML result (in other Web-Shops I see the same HTML results).

Have you seen different responds from Web.BrowserContents vs. Web.Contents?
Do Servers accept We.BrowserContents rather as a human browser than Web.Contents?

Thanks a lot for any inspiration how to receive the same results with Web.Contents!


BR
Florigi

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @FloriGi ,

Based on my test, if you want to get the HTML table from web, you need to use Web.BroswerContents() which returns html, Web.Contents() will return a binary result.

If you nest Html.table() outside Web.Contents(), you will always get an empty table whatever your web address.

When you use the web connector to extract data, you would find that it also use Web.BroswerContents() instead of Web.Contents().

 

In addition, about Dynamic data source using Web.contents, you can refer: Dynamic Web.Contents() and Power BI Refresh Errors 

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yingjl
Community Support
Community Support

Hi @FloriGi ,

Sometimes, when you migrate your queries from Power Query in desktop tools to the dataflow, you get an error saying that a module is disabled in this context. One example of this situation is when your query uses functions such as Web.Page or Web.BrowserContents.

Reason:

Disabled modules are related to functions that require an on-premises data gateway connection to work. Even if the function is getting data from a webpage, because of some security compliance requirements, it needs to go through a gateway connection.

 

Resolution:

In power bi service, you need to configure gateway for your data source first. If you do not have a gateway, you can download from here.

1.png2.png

Then refresh power query editor in the dataflow, you will get the same result which has been shown in power bi desktop.

4.png3.png

 

Reference:

Expression.Error: The module named 'xyz' has been disabled in this context 

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

FloriGi
Frequent Visitor

Hi @v-yingjl ,

 

thanks a lot for your reply.

 

But maybe I have not been very clear in my post: I am still in both scenarios within Power BI Desktop.

 

Only to avoid later-on issues when publishing to service I want now to switch from Web.BrowserContents to Web.Contents - why (small excurseion:

 

When using Web.BrowserContent - I receive in the PBI Service the following error message:

" This dataset includes a dynamic data source." with a link to https://aka.ms/dynamic-data-sources

There is said:
In most cases, Power BI datasets that use dynamic data sources cannot be refreshed in the Power BI service. There are a few exceptions in which dynamic data sources can be refreshed in the Power BI service, such as when using the RelativePath and Query options with the Web.Contents M function.

As I understand it I have to use Web.Contents with "RelativePath" instead of Web.BrowserContents. And this way it works also for other projects scraping other web-shops perfectly fine for me later-on in PBI Service (without On Premis Gateway).

But for the specific URL mentioned above I receive different results from Web.Contents compared to Web.BrowserContents.

So my main question is: How to workaround to receive the same HTML result from Web.Contents within PBI Desktop (in order to be able to publish it later-on to PBI service)?

v-yingjl
Community Support
Community Support

Hi @FloriGi ,

Based on my test, if you want to get the HTML table from web, you need to use Web.BroswerContents() which returns html, Web.Contents() will return a binary result.

If you nest Html.table() outside Web.Contents(), you will always get an empty table whatever your web address.

When you use the web connector to extract data, you would find that it also use Web.BroswerContents() instead of Web.Contents().

 

In addition, about Dynamic data source using Web.contents, you can refer: Dynamic Web.Contents() and Power BI Refresh Errors 

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Get Ready for Power BI Dev Camp

Power BI Dev Camp - June 24th

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors