Good day!

I need help writing a parser. For example, earlier on my-hit.ru there was a jw player of the old version. You can look at the saved page of the page and see the source.

flashvars="file= http://a-11.my-hit.ru/data3/previews/8998.flv это ссылка на фильм." 

In the parser, you could write:

 preg_match( "#flashvars\=['\"](.*?)['\"]#is", $content, $matches ); 

Pay attention only to this code: #flashvars\=['\"](.*?)['\"]#is

So I managed to parse the link, but with the release of the 6th version of the jw player, May, the Hitters put it right away and the links on the site now need to be parsed differently, does anyone have any ideas?

    2 answers 2

    On the page there is an entry:

     <script type='text/javascript'>jwplayer('hit-video').setup({file: 'http://b-62.my-hit.ru/data0/previews/20437.flv?id=f48d5e8b72b04b6c60dde2639868715c',startparam: 'start',autostart: 'true',primary: 'flash',width: '640',height: '480'});</script> 

    Respectively parse like this:

     preg_match("#setup\({file: ['\"](.*?)['\"],#i", $cont, $matches ); 
    • Is that exactly right? I still do not work. This ['\ "] means that the link must be parsed before the'? (. *?) Sign - the link itself, right? ['\"] - start the parsing from the'? - The Wanderer Maverick
    • I have all the parsit. Test page: my-hit.ru/film/4427/online ['\ "] - means that there is either a single quote or a double. After the quote is our text, and the question mark means that our text goes to the next quote, which we indicated. - lampa
    • Maybe here in the code what is wrong, without a clue. / * * Getting player / public function get ($ url = false) {$ content = curl_redirect_exec ($ this-> ch); preg_match ("# setup ({file: ['\"] (. ?) [' \ "], # i", $ content, $ matches); parse_str (trim ($ matches [1]), $ vars); $ file = $ vars ['file']. '? id ='. $ vars ['id']; return array ('file' => $ file);}} - Wanderer Maverick
    • @ The wanderer Maverick comes to curl_redirect_exec ($ this-> ch); ? and that returns var_dump ($ matches); - lampa

    And now you probably have to look for something like

     preg_match( "file: ['\"](.*?)['\"]", $content, $matches ); 
    • yes, something like him! but I tried several options, does not fit. Any more examples? Share! - The Wanderer Maverick