Using JQuery to get the HTML from another website: Possible? Legal?

后端 未结 5 1882
猫巷女王i
猫巷女王i 2021-02-04 14:40

I am trying to get HTML code from a webpage that is not in the same domain. The html text is parsed & summarises a recipe(recipe name, main ingredients, no. of steps) found

5条回答
  •  遇见更好的自我
    2021-02-04 15:42

    To add something to the answers you already got, I can tell you that html is not meant to be used as a way to transmit data "like a service". For that purpose there is XML or JSON exposed through SOAP or REST.

    In your scenario, the best approach that I can think of, keeping in mind both technical and legal aspects, is to use an iframe to display the external content and citing the source of the iframe content, including an external link like you're already doing.

    You can still try the server side approach to fetch the remote html but again, not a clean way to do it, surely not a good practice and possibly not legal.

    If the author of the content wants it to be reusable outside of its site, he can express this intent by making the unformatted content available through a service or an RSS / Atom feed.

提交回复
热议问题