Closed GoogleCodeExporter closed 9 years ago
timdream 下午 1:45
他是用 API 去抓 XML 資料 但是 AMO 對實驗中套件不會吐 XML
就要從網頁拉
網頁可能有改動所以拉不到吧我想
Original comment by irvinfly
on 24 Aug 2009 at 5:48
Confirmed. 但是搞不定抓取 title 跟 summary 的 regexp...
Php 的好像跟別人不太一樣。
貼一下再會跑但是 php 不跑的 regexp
/* RegExp to fetch title (version), description */
$config['gfx_amo_title_regexp'] =
'/<h2.+class="addon">[.\r\n]*<img.*src="([^"]+)".*\/>[.\r\n]*<span>([^<]+)
+([\d\.a-z]+) *<\/span>/';
$config['gfx_amo_desc_regexp'] = '/<div id="addon-summary"[^>]+>(.+)<div
id="addon-install">/';
有人可以試出來就可以解這個 bug ...:-)
Original comment by timdr...@gmail.com
on 28 Aug 2009 at 8:48
試試看下面試不是你要的吧
<?php
$html=file_get_contents('http://addons.mozilla.org/zh-TW/firefox/addon/13860');
/* RegExp to fetch title (version), description */
$config['gfx_amo_title_regexp'] =
'/<h2.*?class="addon">.*?<span>(.*?)<\/span>/s';
$config['gfx_amo_desc_regexp'] = '/<div
id="addon-summary".*?>.*?<p.*?>(.*?)<\/p>.*?<\/div>/s';
preg_match($config['gfx_amo_title_regexp'],$html,$result);
print_r($result);
preg_match($config['gfx_amo_desc_regexp'],$html,$result);
print_r($result);
Original comment by tka...@gmail.com
on 29 Aug 2009 at 5:17
http://orz.othree.net/tmp/gfx/test.php
Result.
http://orz.othree.net/tmp/gfx/test.txt
My code.
Original comment by oth...@gmail.com
on 29 Aug 2009 at 5:46
title 那個要把版號跟圖片網址也抓到 $1 $2 $3 裡面 ^^:
如果真的搞不定的話用 x(HT)ML parser 解好像也可以吧...
感謝兩位。
如果搞定的話放到 sudo svn update; 然後把設定放到
application/config/gfx.php 裡面就可以了
Original comment by timdr...@gmail.com
on 29 Aug 2009 at 6:08
有人這五天把它處理掉了嗎?
Original comment by timdr...@gmail.com
on 5 Sep 2009 at 4:55
not~
Original comment by irvinfly
on 5 Sep 2009 at 6:52
<?php
$html=file_get_contents('http://addons.mozilla.org/zh-TW/firefox/addon/13860');
/* RegExp to fetch title (version), description */
$config['gfx_amo_title_regexp'] =
'/<h2.*?class="addon">.*?<span>(.*?)([\d\.]+)\s+<\/span>/s';
$config['gfx_amo_desc_regexp'] = '/<div
id="addon-summary".*?>.*?<p.*?>(.*?)<\/p>.*?<\/div>/s';
preg_match($config['gfx_amo_title_regexp'],$html,$result);
print_r($result);
preg_match($config['gfx_amo_desc_regexp'],$html,$result);
print_r($result);
Original comment by tka...@gmail.com
on 5 Sep 2009 at 9:21
Fixed. thanks taklu.
Original comment by timdr...@gmail.com
on 5 Sep 2009 at 2:10
修好啦!萬歲!
Original comment by irvinfly
on 5 Sep 2009 at 2:19
Original issue reported on code.google.com by
irvinfly
on 24 Aug 2009 at 5:46