I'm developing a script that does the followings:

  1. Creates a new page (from HTML and CSS string)
  2. Extract media from page
  3. Embed the media and metadata inside the new page
  • Both media and metadata placements vary from site to site.
  1. Replace old page by new

The question is this:
**Should I allocate the script into sections of action or do a switch/case to any domain seperately?
First (allocate by action) may make the script shorter.
Second (allocate by domain) will make the script longer but easily manageable.

Is there another option?
What's best?