How can I programmatically clear an image from another site?

A few years ago, I helped someone put together a web page (for local personal use only, and not for the whole world) that combines photos on webcams from several of his favorite websites. This saves time for browsing multiple websites at once. It was easy for us when the images on these sites had fixed URLs. And we were able to write JavaScript code when the URLs changed predictably (for example, when it had a date when it was specified). But now he would like to add an image whose file name has changed, it would seem, at random, and I do not know how to handle this. Basically, I would like to:

  • Programmatically visit another website to find the URL of a particular image.
  • Paste this url into my tagged webpage <img>.

I understand that this is probably a confusing and unusual question. I want to help explain as much as possible. I just don't know how to ask what this guy wants to do.

Update: David Dorward mentioned that doing this using JavaScript violates the Same Origin Policy . I am open to suggestions on other ways to solve this problem.

+3
source share
4 answers
  • Get html of remote page using Cross AJAX .
  • Then analyze it to get the URLs of the images of interest.
  • Then for each url do <img src=url />
0

, .

- img. , , , , , .

+1

php , CURL - regex URL- .

0

Python , , , Python Beautiful . HTML.

0

Source: https://habr.com/ru/post/1735424/


All Articles