freeCodeCamp / freeCodeCamp/devdocs

[low priority refactoring] generalize executing JS during scraping

未关闭
#789 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Ruby
星标
39.5k
派生
2.6k
平均合并
4 天 32 分钟
30 天内合并 PR
13

描述

If doc sites use client-side JavaScript to produce or fetch some of their content, we need to launch a headless browser and execute it. Currently scraper subclasses do that individually using capybara, e.g.
https://github.com/freeCodeCamp/devdocs/blob/master/lib/docs/scrapers/angularjs.rb#L42-L45
but it might be better to extract a helper method or config option, a little more like this:
https://github.com/freeCodeCamp/devdocs/blob/master/lib/docs/scrapers/webpack.rb#L43-L46

cc @dangeranger

贡献指南

打开贡献指南

调研方向

首先比较 lib/docs/scrapers/angularjs.rb#L42-L45 与 lib/docs/scrapers/webpack.rb#L43-L46,以了解现有的基于 Capybara 的 JavaScript 执行模式。跟踪 scraper 配置和辅助工具的组织方式,然后定义一种能够保留相关 scraper 行为的共享方案,并验证受影响的 scraper 仍会生成预期内容。

由索引模型根据 Issue 内容生成。

评估

技术栈
ruby
领域
documentation, tooling
Issue 类型
重构
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。