Cast article_id list index as string for better failsafe compatibility.
Bring TARGET_OUTPUT_DIR out of __main__.