CodePTIT Scrape Tool is a tool that helps to collect all exercise data from the website https://code.ptit.edu.vn/. The tool uses Scrapy to automatically gather data.
- Python
- Scrapy
The tool requires logged-in cookies from the website code.ptit.edu.vn to access the exercise data. You can use browser tools to obtain the logged-in cookies.
Make sure you have Python and Scrapy installed. If not, you can install Scrapy with the following command:
pip install scrapyTo run the tool, use the following command in the terminal:
scrapy crawl ptitspiderThis command will start the data collection process from the website.
To export the collected data to a CSV file, use the command:
scrapy crawl ptitspider -O dsa.csvYou can change the export file name and format (CSV or JSON) as desired. For example, to export to a JSON file:
scrapy crawl ptitspider -O dsa.jsonThe tool requires cookies logged in to code.ptit.edu.vn. To configure cookies, add the cookies to Scrapy's settings, which can be edited in the settings.py file or managed using the COOKIES_ENABLED and COOKIES_DEBUG parameters.
You can customize the data collection process by editing the spider code ptitspider.py. To change the URL, request methods, or other data processing tasks, check the start_requests(), parse(), and pipeline functions to fit the goals of your project.
- Cookies: Ensure the cookies you use are still valid; otherwise, update the cookies to avoid access errors.