-2

So Lets say I have a site like this one http://www.worldtimeserver.com/ and I want somehow to get the value of the time every second and write that value in a .txt file. I was going to use a OCR(optical character recognition) software for this job but ..... in the end this option wasn a good choice because I could not rely on exact position of the clock.

Then I started to think "is there a way to inject/put some code in the browser that would do this?". When I inspect the web-page (in Chrome) I saw that the Div containing the time has an id="theTime". So is there a way to do this? I have some basic experience in JS & DOM ... but this I have no idea how to do or from where to start. Also i would like to point out that I need to rely that the script will do this job for hours and hours and that the value of the clock is set by outside (a server).

GregorII
  • 221
  • 4
  • 13
  • What precisely are you trying to achieve with this? Assuming that a text file full of incrementing values isn't really an end in itself. – jonrsharpe Apr 12 '17 at 11:11
  • Well this example (with the clock) is just to show as simple and clear what I want to do. My case is different - I have a Field that will show some digits, but the digits will be changing constantly every second and most definitely wont be successive/incrementing. I need this because I want to store the data and after that to analyze it. Yet the site/server allow you to see the data only for the past 1 hour and I need it sometimes to show it for a full day – GregorII Apr 12 '17 at 11:21
  • 1
    The thing you're trying to do in general terms is web crawling/scraping, you should do some research around that. – jonrsharpe Apr 12 '17 at 11:26

2 Answers2

1

If the value does not require the browser to refresh to change the value.. you can save it using localstorage and later copy paste it in a txt file

arvinhubert
  • 46
  • 1
  • 8
0

this is a possible duplicate.
Get value of input field inside an iframe
use an iframe (you can hide it if you don't want users to see it).

Community
  • 1
  • 1
Elie Nassif
  • 464
  • 4
  • 11