Forum Discussion
myriam_ouan
4 years agoRegular Visitor
Web query shows empty
Hi guys, I've been trying to scrape data from a company's website, something very simple. I basically want to retrieve the headlines, url and publication date from their news release. I've alre...
BA_Pete
4 years agoSuper User
Hi myriam_ouan ,
In your Source Step, try changing Web.Contents("https....) to Web.BrowserContents("https....).
Pete
myriam_ouan
4 years agoRegular Visitor
Hi Pete,
thanks for your answer. I tried but I have an error message : can't connect to [url]
- BA_Pete4 years agoSuper User
Hi myriam_ouan ,
I don't know what to suggest I'm afraid - I can't recreate this issue.
If I take your original query and make the Source change, I get all the data just fine.
Try pasting this into a new blank query, just in case you have a typo:
let Source = Web.BrowserContents("https://ir.tevapharm.com/news-and-events/press-releases/default.aspx"), #"Extracted Table From Html" = Html.Table(Source, {{"Column0","a[href^=""/news-""]", each [Attributes][href]}, {"Column1", ".module-news .module_headline"}, {"Column2", ".module-news .module_date-time"}}, [RowSelector=".module-news .module_item-wrap"]), #"Replaced Value" = Table.ReplaceValue(#"Extracted Table From Html","/news-","https://www.ir.tevapharm.com/news-",Replacer.ReplaceText,{"Column0"}), #"Changed Type" = Table.TransformColumnTypes(#"Replaced Value",{{"Column0", type text}, {"Column1", type text}, {"Column2", type date}}), #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column0", "URL"}, {"Column1", "Headlines"}, {"Column2", "Date"}}) in #"Renamed Columns"Pete