Home>

There is such a complex line :

[2,3],
 [['https://h8.rmr.rocks/','',"auto/54/43/58/001___________.png?t=1641084571&
u= 0 &
h= KiNURRSNRlWIHRfawmjv6Q ", 720,10706],
['https://h38.rmr.rocks/','',"auto/54/43/58/002___________.png?t=1641084571&
u= 0 &
h= N3ncSIbn_PLRi-GpCme0vQ ", 720,11167],
['https://h27.rmr.rocks/','',"auto/54/43/58/003___________.png?t=1641084571&
u= 0 &
h= vupT5VUvHQ6j1liMt6NF0A ", 720,12237],
['https://h32.rmr.rocks/','',"auto/54/43/58/004___________.png?t=1641084571&
u= 0 &
h= hSbWgf646fK0fYKWksxaAA ", 720,13222],
['https://h27.rmr.rocks/','',"auto/54/43/58/005___________.png?t=1641084571&
u= 0 &
h= vvcK12ZIA8wEnDcHcrKZWQ ", 720,12709],
['https://h38.rmr.rocks/','',"auto/54/43/58/006___________.png?t=1641084571&
u= 0 &
h= -knVcY8GQpmTgw3XImiGIQ ", 720,12747],
['https://h8.rmr.rocks/','',"auto/54/43/58/007___________.png?t=1641084571&
u= 0 &
h= yr5xwhHI_7_rcBsS8r6oVA ", 720,11670],
['https://h32.rmr.rocks/','',"auto/54/43/58/008___________.png?t=1641084571&
u= 0 &
h= BDXPbLoAE58iwsYgH7u_ZQ ", 720,12414],
['https://h24.rmr.rocks/','',"auto/54/43/58/009___________.png?t=1641084571&
u= 0 &
h= 87VP6YSArvidx1wz0SXvFg ", 720,12251],
['https://h37.rmr.rocks/','',"auto/54/43/58/010___________.png?t=1641084571&
u= 0 &
h= IIVF7DiFt3eoEx1X-LfILQ ", 716,7473],
['https://h32.rmr.rocks/','',"auto/54/43/58/011___________.png_res.jpg?t=1641084571&
u= 0 &
h= vmYoIIEzU2uLm8dy5Qc51A ", 1920,1080]],
 0, false, [{"path": "https://h32.rmr.rocks/", "res": true},
{"path": "https://h37.rmr.rocks/", "res": true},
{"path": "https://h8.rmr.rocks/", "res": true},
{"path": "https://h40.rmr.rocks/", "res": true},
{"path": "https://h27.rmr.rocks/", "res": true},
{"path": "https://h30.rmr.rocks/", "res": true},
{"path": "https://h42.rmr.rocks/", "res": true},
{"path": "https://h24.rmr.rocks/", "res": true},
{"path": "https://h31.rmr.rocks/", "res": true},
{"path": "https://h38.rmr.rocks/", "res": true},
{"path": "https://h34.rmr.rocks/", "res": true}],
 false

It is necessary to transform it somehow using PHP or JS to into an array .

IMPORTANT: only the data where the parameters are NOT objects should be included in the array.

Example: ['https://h8.rmr.rocks/','',"auto/54/43/58/001___________.png?t=1641084571& u= 0 & h= KiNURRSNRlWIHRfawmjv6Q ", 720,10706]-will get into the array,[{"path": "https://h32.rmr.rocks/", "res": true}, {"path": "https://h37.rmr.rocks/", "res": true}]-will not get into the array.

I tried to do this through PHP, but it is not very efficient, since sometimes two links merge into one:

$ data= [];
preg_match_all ('/\ [\ [(.*?)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ been', $ current_js, $ _data);
    foreach ($ _data as $ key= >
 $ value) {
        if (count ($ value) >
 0) {
            $ firstData= substr ($ value [0],
 0, 1)=== '[';
            if ($ firstData) {
                $ value= substr ($ value [0],
 eleven);
                $ images= explode (',', $ value);
                $ old= '';
                foreach ($ images as $ key2= >
 $ valData) {
                    $ valData= str_replace ('[', '', $ valData);
                    $ valData= str_replace (']', '', $ valData);
                    $ valData= str_replace ("''", '', $ valData);
                    if (strlen ($ valData) >
 0 &
&
 ! is_numeric ($ valData)) {
                        $ valData= str_replace ("'",' ', $ valData);
                        $ valData= str_replace ('"', '', $ valData);
                        preg_match_all ('/https: \ /\ //is', $ valData, $ dda);
                        if (count ($ dda [0]) >
 0) {
                            $ old= $ valData;
                            if (! array_key_exists ($ old, $ data ['images'])) $ data ['images'] [$ old]= '';
                        }
                        $ data ['images'] [$ old].= $ valData;
                    }
                }
            }
        }
    }

Is it possible to somehow pull out the data I need with a regular basis? Or is there another way?

json_decode you didn’t try to do this?

teran2022-01-03 22:36:13

@teran, the string is not valid for json_decode so didn't even try. And the function can process such lines too? There are no keys for the most part.

Sire IMPACTUS2022-01-03 22:36:13

where there are no keys it is an array. here if the whole line is wrapped in [], then it is decoded completely

teran2022-01-03 22:36:13