Chrome extension - Get html from a separate page of a website in the background

后端 未结 1 793
小鲜肉
小鲜肉 2021-01-25 18:22

I have made an extension that will track what manga a person reads on a manga site and list what chapter they last read for it in their favorites page. And I\'ve recently come u

相关标签:
1条回答
  • 2021-01-25 18:45

    It heavily depends on how the page in question is constructed.

    If the page is static (HTTP response includes the data you need), then scraping the page via XMLHttpRequest is the way to go.

    If the page is dynamic (no data initially, and JavaScript on the page then queries the server to fill it), then XHR route will not work. You can try to observe network requests made by that page and replicate them.

    Of note: while it's unlikely, check if the site has a public API. That will save you the reverse-engineering efforts and lets you avoid the grey area of automated data scraping.


    Also, see if you can somehow check from the page you're normally tracking if the item is favourited or not. It will be easier than scraping another page.

    0 讨论(0)
提交回复
热议问题