megamindame/school_scraper
Composer 安装命令:
composer create-project megamindame/school_scraper
包简介
This package scrapes all Tanzania's schools from Necta's website.
README 文档
README
A package to scrape Tanzania schools
Usage
Add the package from the composer by running composer require megamindame/school_scraper
If you want to get school data by using this package, not use it in your code, you can uncomment the code section you want in the App.php file,
Using the Package
3 types of data can be accessed from 3 education levels. Education levels 1) Primary 2) Secondary 3)Advanced Secondary
Data that can be accessed
- schools - An array of formatted school data
- nodes - XPath nodelist of all the html link tags. You can iterate through the list to scrape the results page of a school. Check the Xpath documentation to see how you can use the Xpath node.
- data - An array of un-formatted school data
Accessing the data
You can initialize any of the fetchers and pass the year you want to fetch. Images are embedded to show the returned data format.
1) Primary
$fetcher = new PrimaryFetcher(2022);
//Get Primary schools
return $fetcher->getSchools();
//Get Data
return $fetcher->getPrimaryData();
//Get Nodes
return $fetcher->getNodes();
2) Secondary and Advanced Secondary
$fetcher = new SecondaryFetcher(2022);
//or
$fetcher = new AdvancedSecondaryFetcher(2022);
//Get Primary schools
return $fetcher->getSchools();
//Get Data
return $fetcher->getData();
//Get Nodes
return $fetcher->getNodes();
People who want to fetch results from the nodes can use the Fetcher->getRootUrl() method to get the Root Url. You can take a look at the code to see how the nodes can be used to fetch their corresponding web pages, in this case, school results pages
As stated above, if you want to use the package as a standalone, then you can just download the code, run composer install then check the
'App.php' file for some directions on how to fetch data. Try to uncomment the sections inside the file, then run
php index.php. You can try to run php index.php > filename to save the echoed data into a
file.
megamindame/school_scraper 适用场景与选型建议
megamindame/school_scraper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 9, 最近一次更新时间为 2023 年 07 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 megamindame/school_scraper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 megamindame/school_scraper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-06