Skip to content

Instantly share code, notes, and snippets.

@yonatan
Last active March 16, 2017 21:25
Show Gist options
  • Save yonatan/b275020f39cca5f980b3998964c9dce8 to your computer and use it in GitHub Desktop.
Save yonatan/b275020f39cca5f980b3998964c9dce8 to your computer and use it in GitHub Desktop.
Patch wonderfl swfs to change asset urls to relative paths
#!/bin/bash -e
if [[ $# -ne 2 ]]; then
echo "Usage: swf-surgery <input-file> <output-file>"
exit 1
fi
TMP="/tmp/$(basename $0).$$"
SWF="$TMP.swf"
BAK="$TMP.\$wf"
cp $1 $SWF
flasm -x $SWF
sed -e 's|http://swf\.wonderfl\.net/swf/usercode|../../../../swfs/./././././././././.|g' \
-e 's|http://assets\.wonderfl\.net/images/related_images|../../../../assets/././././././././././././././.|g' \
-e 's|http://swf\.wonderfl\.net/static/assets|../../../../assets/static/./././././.|g' \
-i $SWF
flasm -z $SWF
mv $SWF $2
rm $BAK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment