And one more patch to retrieve the v= parameter. (This must be applied on top of the previous patch.) Also I've formatted the output as perl source:
Code:
diff -u -r1.2 ./hulu-get-keys.c
--- ./hulu-get-keys.c 2009/10/28 03:05:45 1.2
+++ ./hulu-get-keys.c 2009/11/02 08:14:10
@@ -41,7 +41,7 @@
SwfdecAsContext *ctx;
SwfdecAsValue out;
SwfdecAsObject *obj;
- SwfdecAsObject *xmlkeys, *keypair;
+ SwfdecAsObject *keys, *keypair;
struct _SwfdecSandbox *sbox;
const char *txt, *a2, *a3;
gboolean res;
@@ -96,14 +96,27 @@
}
obj = SWFDEC_AS_VALUE_GET_OBJECT(out);
+ txt = swfdec_as_context_get_string(ctx, "v");
+ res = swfdec_as_object_call(obj, txt, 0, NULL, &out);
+ txt = swfdec_as_value_to_string(ctx,out);
+ printf("my $v='%s';\n", txt);
+
txt = swfdec_as_context_get_string(ctx, "copyrighted_strings");
res = swfdec_as_object_get_variable(obj, txt, &out);
if (!res) {
fprintf(stderr, "class copyrighted_strings not found\n");
return 1;
}
- txt = swfdec_as_value_to_string(ctx,out);
- puts(txt);
+ keys = SWFDEC_AS_VALUE_GET_OBJECT(out);
+ nkeys = swfdec_as_array_get_length(keys);
+ printf("my @pid=(");
+ for (i=0; i<nkeys; i++) {
+ swfdec_as_array_get_value(keys, i, &out);
+ txt = swfdec_as_value_to_string(ctx,out);
+ if (i) printf(",");
+ printf("\n\t'%s'", txt);
+ }
+ printf(");\n");
a2 = swfdec_as_context_get_string(ctx, "a2");
a3 = swfdec_as_context_get_string(ctx, "a3");
@@ -113,10 +126,11 @@
fprintf(stderr, "class xmldecskeys not found\n");
return 1;
}
- xmlkeys = SWFDEC_AS_VALUE_GET_OBJECT(out);
- nkeys = swfdec_as_array_get_length(xmlkeys);
+ keys = SWFDEC_AS_VALUE_GET_OBJECT(out);
+ nkeys = swfdec_as_array_get_length(keys);
+ printf("my @smil=(");
for (i=0; i<nkeys; i++) {
- swfdec_as_array_get_value(xmlkeys, i, &out);
+ swfdec_as_array_get_value(keys, i, &out);
keypair = SWFDEC_AS_VALUE_GET_OBJECT(out);
res = swfdec_as_object_get_variable(keypair, a2, &out);
if (!res) {
@@ -124,7 +138,8 @@
return 1;
}
txt = swfdec_as_value_to_string(ctx,out);
- puts(txt);
+ if (i) printf(",");
+ printf("\n['%s', ", txt);
res = swfdec_as_object_get_variable(keypair, a3, &out);
if (!res) {
@@ -132,8 +147,9 @@
return 1;
}
txt = swfdec_as_value_to_string(ctx,out);
- puts(txt);
+ printf("'%s']", txt);
}
+ printf(");\n");
return !res;
}