Is it possible to have a node value correspond to how much light is hitting that pixel? The puzzle I'm facing comes from when I was participating in Nodevember, so although I can think of ways to manage this by using baked image sequences or sync'ing up a mask to roughly match the movement of the light source, I'd rather achieve this purely using nodes.

In my scene, I have only a single light source that moves around and this means that the camera can sometimes see the dark side of the object.

I want the dark side of the object to become an emission shader and the side with light hitting it to be a diffuse shader.

I've tried having both shaders cover the whole object and turning the brightness of the light up very high so the emission is barely visible over the reflections from the diffuse shader on the side where the light hits but they are still visible.

Is there any way to add a node that outputs a value based on how much light hits it?

In the image below, both shaders cover the whole object, the light source is off to the right, the emission shader is emitting blue for the land, yellow for the cities and nothing for the oceans in the left half of the earth which is in darkness but you can see the yellow cities on the right, daytime half and the whole thing is tinged a bit blue.
I think you need to bake diffuse indirect/direct to a texture and then use that as a source for incoming light. IFAIK it would be hard to know in forehand how much light ended up hitting a particular point on a surface before everything is calculated.

Another way would to do this in compositing where you could render the globe with a white material and use the inverted image as a mask where to let the light show.