Beautiful Soup returns empty list

前端 未结 2 1027
悲&欢浪女
悲&欢浪女 2021-01-16 07:07

I am new to webscrapping. So I have been given a task to extract data from : Here

I am choosing dataset of \"comments\". Below is my code for scrapping.



        
2条回答
  •  终归单人心
    2021-01-16 07:34

    you are getting this [] because data you want to scrape is coming from API which loads after you web page load so page you are accessing does not contain that class

    you can open you browser console and check in network as given in screenshot there you find data you want to scrape so you have to make request to that URL to get data

    you can retrive data in this URL in preview tab you can see all data.

    also if you have good knowledge of python you can also use this to scrape data

    https://doc.scrapy.org/en/latest/intro/overview.html

提交回复
热议问题