summaryrefslogtreecommitdiffstats
path: root/debian/htdig/htdig-3.2.0b6/contrib/doc2html/swf2html.pl
diff options
context:
space:
mode:
authorSlávek Banko <[email protected]>2021-11-05 13:28:23 +0100
committerSlávek Banko <[email protected]>2021-11-05 13:28:23 +0100
commit8c787c3591c1c885b91a54128835b400858c5cca (patch)
treeeca1b776912a305c4d45b3964038278a2fae1ead /debian/htdig/htdig-3.2.0b6/contrib/doc2html/swf2html.pl
parentfe188b907cdf30dfdfe0eba9412e7f8749fec158 (diff)
downloadextra-dependencies-8c787c3591c1c885b91a54128835b400858c5cca.tar.gz
extra-dependencies-8c787c3591c1c885b91a54128835b400858c5cca.zip
DEB htdig: Added to repository.
Signed-off-by: Slávek Banko <[email protected]>
Diffstat (limited to 'debian/htdig/htdig-3.2.0b6/contrib/doc2html/swf2html.pl')
-rwxr-xr-xdebian/htdig/htdig-3.2.0b6/contrib/doc2html/swf2html.pl67
1 files changed, 67 insertions, 0 deletions
diff --git a/debian/htdig/htdig-3.2.0b6/contrib/doc2html/swf2html.pl b/debian/htdig/htdig-3.2.0b6/contrib/doc2html/swf2html.pl
new file mode 100755
index 00000000..5f0cdb07
--- /dev/null
+++ b/debian/htdig/htdig-3.2.0b6/contrib/doc2html/swf2html.pl
@@ -0,0 +1,67 @@
+#!/usr/bin/perl -w
+use strict;
+#
+# Version 1.1 17-May-2002
+# Written by David Adams <[email protected]>
+#
+# Uses swfparse utlity to extract URL's from Shockwave flash files
+#
+# Can be called directly from htdig as an external converter,
+# or may be called by doc2html.pl converter script.
+#
+
+####--- Configuration ---####
+# Full path of swfparse
+# (get it from http:/www.htdig.org/files/contrib/contrib/parsers/)
+
+##### YOU MUST SET THIS ####
+
+my $SWFPARSE = "/.. .../swfdump";
+
+####--- End of configuration ---###
+
+if (! -x $SWFPARSE) { die "Unable to execute swfparse" }
+
+my $Input = $ARGV[0] || die "Usage: swf2html.pl filename [mime-type] [URL]";
+my $MIME_type = $ARGV[1] || '';
+if ($MIME_type and ($MIME_type !~ m#^application/x-shockwave-flash#i)) {
+ die "MIME/type $MIME_type wrong";
+}
+
+my $Name = $ARGV[2] || '';
+$Name =~ s#^(.*/)##;
+# decode if 2nd argument was a URL
+$Name =~ s/%([A-F0-9][A-F0-9])/pack("C", hex($1))/gie if $1;
+
+print <<"HEAD";
+<HTML>
+<HEAD>
+<TITLE>SWF $Name</TITLE>
+<META NAME="robots" CONTENT="follow, noindex">
+</HEAD>
+HEAD
+
+open(CAT, "$SWFPARSE -t '$Input'|") ||
+ die "$SWFPARSE doesn't want to be opened using pipe\n";
+
+print "<BODY>\n";
+my $c = 0;
+while (<CAT>) {
+### if ($_ !~ m/\s+getUrl\s+(.*?)\s+.*$/) { next }
+ if ($_ !~ m/\s+getUrl\s+(.*)$/) { next }
+ my $link = $1 . ' ';
+ if ($link =~ m/^FSCommand:/) { next }
+ if ($link =~ m/\s+target\s+/) {
+ $link =~ s/^(.*)\s+target\s+.*$/$1/;
+ } else {
+ $link =~ s/^(.*?)\s+.*$/$1/;
+ }
+ print '<A href="', $link, '"> </a>', "\n";
+ $c++;
+}
+close CAT;
+
+print "</BODY>\n</HTML>\n";
+print STDERR "No links extracted\n" if ($c == 0);
+
+exit;