Use QueryList to collect Kingsoft's daily sentence

Source: Internet
Author: User
If you collect a daily sentence of Kingsoft Mac, you must note that the audio address cannot be directly matched. The match is similar to the following string: iciba_common_top_onseconddelay(news.iciba.comadmintts2015-02-27213 ); therefore, you need to use a callback function to filter out the audio address. PhpQuery? Phprequire

The collection of Kingsoft word overlord daily sentence, it should be noted that, and can not directly match the audio address, matched is similar to this string: iciba_common_top_onSecondDelay (http://news.iciba.com/admin/tts/2015-02-27.mp3 ); therefore, you need to use a callback function to filter out the audio address. PhpQuery? Phprequire'

If you collect a daily sentence of Kingsoft Mac, you must note that the audio address cannot be directly matched. The matching is similar to the following string:
Iciba_common_top_onSecondDelay ('HTTP: // news.iciba.com/admin/tts/2015-02-27.mp3 ');
Therefore, you need to use a callback function to filter out the audio address. PhpQuery
 Array (". en> a "," text "), // match Chinese" cn "=> array (". cn> a "," text "), // match audio" audio "=> array (". sound "," onmouseover ",'', function ($ v, $ k) {// callback function, used to match the audio address if (preg_match ('/http [^ \'] +/', $ v, $ arr) {$ v = $ arr [0];} return $ v ;}), // match the image "pic" => array ("a: eq (0)> img", "src "), // match the page address "page" => array ("a: eq (0)", "href"); $ data = QueryList: Query ($ url, $ rang, $ reg)-> jsonArr [0]; print_r ($ data );
Array ([en] => Courage is not the absence of fear, but rather the judgement that something else is more important than fear. [cn] => brave people do not have to fear anything, but identify things worth more attention than fear. [Audio] => http://news.iciba.com/admin/tts/2015-02-27.mp3?pic] => http://cdn.iciba.com/news/word/big_2015-02-27b.jpg? Rand = 8637 [page] => http://news.iciba.com/dailysentence/detail-1212.html)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.