baidu风云榜_数据 作者 wunengwu 日期 2009-2-27 11:24:00
  1. <?php
  2.  
  3. //mysql_connect("localhost","root","");
  4. //mysql_select_db(’baidu’);
  5. $array  = array(
  6. ‘上升最快’,
  7.  
  8. ‘一周热点’,
  9.  
  10. ‘热门搜索’,
  11.  
  12. ‘电影’,
  13.  
  14. ‘电视剧’,
  15.  
  16. ‘游戏’,
  17.  
  18. ‘小说’,
  19.  
  20. ‘体育热点’,
  21.  
  22. ‘电视节目’,
  23.  
  24. ‘动漫卡通’,
  25.  
  26. ‘美女’,
  27.  
  28. ‘帅哥’,
  29.  
  30. ‘娱乐女明星’,
  31.  
  32. ‘娱乐男明星’,
  33.  
  34. ‘女歌手’,
  35.  
  36. ‘男歌手’,
  37.  
  38. ‘人物’,
  39.  
  40. ‘富豪’,
  41.  
  42. ‘汽车’,
  43.  
  44. ‘数码产品’,
  45.  
  46. ‘上市公司’,
  47.  
  48. ‘基金’,
  49.  
  50. ‘化妆品品牌’,
  51.  
  52. ‘畅销书’,
  53.  
  54. ‘高校’,
  55.  
  56. ‘宠物’,
  57.  
  58. ‘软件’,
  59.  
  60. ‘风景名胜’
  61. );
  62.  
  63.  
  64. $array1 = array(
  65. ‘http://top.baidu.com/top10.html’,
  66.  
  67. ‘http://top.baidu.com/weekhotspot.html’,
  68.  
  69. ‘http://top.baidu.com/top_keyword.html’,
  70.  
  71. ‘http://top.baidu.com/movie.html’,
  72.  
  73. ‘http://top.baidu.com/tv.html’,
  74.  
  75. ‘http://top.baidu.com/game.html’,
  76.  
  77. ‘http://top.baidu.com/book.html’,
  78.  
  79. ‘http://top.baidu.com/sport.html’,
  80.  
  81. ‘http://top.baidu.com/dianshi.html’,
  82.  
  83. ‘http://top.baidu.com/katong.html’,
  84.  
  85. ‘http://top.baidu.com/girls.html’,
  86.  
  87. ‘http://top.baidu.com/boys.html’,
  88.  
  89. ‘http://top.baidu.com/ymingxing.html’,
  90.  
  91. ‘http://top.baidu.com/nmingxing.html’,
  92.  
  93. ‘http://top.baidu.com/ygeshou.html’,
  94.  
  95. ‘http://top.baidu.com/ngeshou.html’,
  96.  
  97. ‘http://top.baidu.com/renwu.html’,
  98.  
  99. ‘http://top.baidu.com/rich.html’,
  100.  
  101. ‘http://top.baidu.com/car.html’,
  102.  
  103. ‘http://top.baidu.com/shuma.html’,
  104.  
  105. ‘http://top.baidu.com/company.html’,
  106.  
  107. ‘http://top.baidu.com/jijin.html’,
  108.  
  109. ‘http://top.baidu.com/hzp.html’,
  110.  
  111. ‘http://top.baidu.com/shu.html’,
  112.  
  113. ‘http://top.baidu.com/school.html’,
  114.  
  115. ‘http://top.baidu.com/pet.html’,
  116.  
  117. ‘http://top.baidu.com/soft.html’,
  118.  
  119. ‘http://top.baidu.com/fengjingmingsheng.html’
  120. );
  121.  
  122. foreach($array1 as $key=>$value) {
  123.         $content                =       ClearSpace(file_get_contents($value));
  124.  
  125.         preg_match_all(‘|<tr> <td align="center"><strong>([^<]+)</strong></td> <td><a href="([^>]+)" target="_blank">([^<]+)</a></td> <td class="ff2">([^<]+)</td> <td class="ff2">([^<]+)</td> <td class="ff2">([^<]+)</td> <td class="ff2">([^<]+)</td> <td align="left">|si’,$content,$array);
  126.  
  127.         if(empty($array[1][0])){
  128.                         preg_match_all(‘|<tr> <td align="center"><strong>([^<]+)</strong></td> <td><a href="([^>]+)" target="_blank">([^<]+)</a></td> <td class="ff2"><img src="/img/ico_up.gif">([^<]+)</td> <td class="ff2">([^<]+)</td> <td class="ff2">([^<]+)</td> <td class="ff2">([^<]+)</td> <td align="left">|si’,$content,$array);     
  129.         }
  130.         foreach($array[1] as $key=>$value){
  131.                 //mysql_query("insert into baidu_log set sort=’$value’,add_time=NOW(),keywords=’".$array[3][$key]."’,jinri=’".$array[4][$key]."’,lishi=’".$array[5][$key]."’,top_tianshu=’".$array[6][$key]."’,ri_pingjun=’".$array[7][$key]."’,main_id=’$main_id’");
  132.                 echo "insert into baidu_log set sort=’$value’,add_time=NOW(),keywords=’".$array[3][$key]."’,jinri=’".$array[4][$key]."’,lishi=’".$array[5][$key]."’,top_tianshu=’".$array[6][$key]."’,ri_pingjun=’".$array[7][$key]."’,main_id=’$main_id’\n";
  133.  
  134.         }
  135. }
  136.  
  137. ClearSpace($document)
  138. {
  139.         $document               = str_replace(array("\n","\r"),,$document);
  140.         //$document             = str_replace("’",’"’,$document);
  141.         $document               = preg_replace(‘/\s+/si’,‘ ‘,$document);
  142.         return $document;
  143. }
  144. ?>
  • 标签:baidu风云榜 数据 
  • 发表评论:
    载入中...

    载入中...

    About Me

    载入中...

    Category

    载入中...

    newlog

    载入中...

    Recent Comments

    载入中...

    Recent Message

    载入中...

    Links

    Search

    Statistics

    载入中...

    中关村首页 | 博客首页 | 意见反馈 中关村社区 版权所有 / 京ICP证05038935号