Click here to Skip to main content
15,916,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a PHP file that responds with a similar javascript response to below.
JavaScript
var count = 0;
var actors = [];
var directors = [];
var movies = ["7​/n​/n# L<DxJ", "7x​/nx​/nxlNTv", "(N​/lN​/lNUnNTv", "}x​/Yx​/YxL#llNTv", "}​/Y​/Y<L<J", "O​/u​;uiLY<J", "@​/J​/JNUL<DxJ"];
var hidden = [];
var r_space = null;
var chars = {
    "i": "N",
    "R": "6",
    "u": "T",
    "a": "i",
    "V": "p",
    ">": "a"
};
for (var i in chars) {
    if (i == ' ') r_space = asta[i];
}

The movie names are encoded using a simple algorithm using var chars. I want to iterate through the var movies and get all values in to an array so I can decode them.

What I have tried:

I tried using below code to split by ";" and then store it an array but the issues is some words in var movies also contain ";".
<pre lang="Python">var_array = str(response.content.decode()).split(";")[7][14:-1].split(",")
for va in var_array:
    print(va[1:-1])

Is there a different way I can get all values in var movies to an array and then decode? Thanks.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900