meilisearch / scrapix

MIT License
23 stars 9 forks source link

Does the `exctract_code_from_page` feature works? #31

Open bidoubiwa opened 1 year ago

bidoubiwa commented 1 year ago

In this PR #28, I had to fix the call made to this._format_code(code) that was wrong. It previously was format_code(code);. Which does not exists. This leads me to think that maybe this feature does not work.

 // A function that retro-engineer the hljs generated html to extract the code
  async _extract_code_from_page(page: Page) {
    let code = await page.evaluate(() => {
      let code = "";
      let pre = document.getElementsByTagName("pre");
      for (let i = 0; i < pre.length; i++) {
        let code_elem = pre[i].getElementsByTagName("code");
        if (code_elem.length > 0) {
          code += code_elem[0].innerText;
        }
      }
      return code;
    });
    return this._format_code(code);  // Used to be  format_code(code);
  }
qdequele commented 1 year ago

No this code is not used. :D