این اسکریپت با استفاده از پایتون و Selenium، نظرات یک اپلیکیشن را از سایت کافه بازار Cafebazaar.ir استخراج میکند. ورودی این اسکریپت آدرس صفحه اپلیکیشن شما و خروجی آن یک فایل اکسل حاوی نظرات میباشد.
-
نصب Google Chrome: دانلود Google Chrome
-
نصب ChromeDriver: دانلود ChromeDriver
-
نصب Python: دانلود Python
-
نصب Pip: راهنمای نصب Pip
-
نصب پکیجهای مورد نیاز پایتون: ترمینال یا خط فرمان را باز کنید و دستورات زیر را برای نصب Selenium، BeautifulSoup4 و Pandas اجرا کنید:
pip install selenium pip install beautifulsoup4 pip install pandas
-
ویرایش اسکریپت: فایل اسکریپت را باز کرده و مقدار متغیر
url
(در خط 10) را به آدرس صفحه اپلیکیشن خود در سایت Cafebazaar.ir تغییر دهید. پس از انجام این تغییر، فایل را ذخیره کنید.url = 'https://cafebazaar.ir/app/com.farsitel.bazaar' # این را به آدرس صفحه اپلیکیشن خود تغییر دهید
-
اجرای اسکریپت: اسکریپت را با استفاده از پایتون با دستور زیر اجرا کنید:
python Cafebazaar_Scraper.py
صبر کنید تا اجرای اسکریپت به پایان برسد. این اسکریپت یک فایل خروجی با نام
comments.xlsx
حاوی نظرات استخراج شده ایجاد خواهد کرد.از این داده ها می توان برای تحلیل های مختلفی از جمله موارد مرتبط با پردازش زبان طبیعی یا NLP استفاده کرد که دیتاهای scrap شده برخی از نرم افزارها به صورت کامل در پوشه Scraped Data در دسترس قرار گرفته است.
This script scrapes the Cafebazaar.ir application page for comments using Python and Selenium. The input is the URL of your application's page, and the output is an .xlsx
file containing the comments.
- Install Google Chrome: Google Chrome Download
- Install ChromeDriver: ChromeDriver Download
- Install Python: Python Download
- Install Pip: Pip Installation Guide
-
Install Required Python Packages: Open your command prompt or terminal and run the following commands to install Selenium, BeautifulSoup4, and Pandas:
pip install selenium pip install beautifulsoup4 pip install pandas
-
Edit the Script: Open the script file and change the
url
variable (line 10) to your application's page address on Cafebazaar.ir. Save the file after making this change.url = 'https://cafebazaar.ir/app/com.farsitel.bazaar' # Change this to your app page URL
-
Run the Script: Run the script using Python with the following command:
python Cafebazaar_Scraper.py
Wait until the script finishes execution. It will create an output file named
comments.xlsx
containing the scraped comments.These data can be used for various analyses, including those related to Natural Language Processing (NLP). complete scraped data from some applications are available in the "Scraped Data" folder.