- You may be looking for the comic story.
The Master of Spiders sought to keep in order his empire of spiders on the planet on which he resided.
When the Second Doctor, John and Gillian arrived on the planet, the Master spied on them from his giant mechanical spider. He had his spiders pursue the Doctor and his grandchildren into a cave, sealed them inside it, and had the spiders in the cave attack them.
When the Doctor used his recorder to stop the spiders from reaching them, the Master captured them in a net and sent his spiders onto the Doctor and his grandchildren. The Doctor used his recorder again to interfere with the device the Master used to control the spiders. The spider attacked the Master.
The Master fled in his mechanical spider while the Doctor and his grandchildren got out of the net. With the Master about to attack them, the Doctor quickly fired his newly-built ray gun at the mechanical spider, destroying it and presumably killing the Master within. (COMIC: Master of Spiders)