2021年4月28日星期三

Webscraping on html function parameter and export to csv

<div class="readmore">       <a href="" onclick="updateDetailModal({name&quot;:&quot;Company Name 1&quot;,&quot;website&quot;:&quot;https:\/\/hello.com.sg\/&quot;,&quot;phone&quot;:&quot;65 8123 4567&quot;,&quot;email&quot;:&quot;hello@gmail.com.sg&quot;})" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">More       </a>  </div>  

Hi I'm looking to web scrape the following so that I can get it in a .csv file in this format<br>

Company Name | Website Url | Phone | Email -> 1st Row
Company Name 1 | https://hello.com.sg/ | 81234567 | hello@gmail.com -> 2nd Row
Company Name 2 | https://hello2.com.sg/ | 87654321 | hello2@gmail.com -> Subsequent rows for all links

Is there a way to use regex to get the individual fields and export them to a CSV file? I've been trying python and beautiful soup but I only know how to export using class or id. Not sure how to do it for function parameters.

Appreciate your help!

https://stackoverflow.com/questions/67310656/webscraping-on-html-function-parameter-and-export-to-csv April 29, 2021 at 11:31AM

没有评论:

发表评论