gpt4 book ai didi

mashup - craigslist mashup 如何获取数据?

转载 作者:行者123 更新时间:2023-12-03 09:22:43 24 4
gpt4 key购买 nike

就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the help center为指导。




9年前关闭。




我正在做一些关于内容聚合器的研究工作,我很好奇当前的一些 craigslist 聚合器如何将数据放入他们的 mashup 中。

例如,www.housingmaps.com 和现已关闭的 www.chicagocrime.org

如果有网址可以引用就完美了!

最佳答案

对于 AdRavage.com我使用 Magpie RSS(提取从搜索返回的数据)和自定义屏幕抓取类的组合来正确填充构建搜索时使用的城市/类别信息。

例如,要提取类别,您可以:

//scrape category data
$h = new http();
$h->dir = "../cache/";
$url = "http://craigslist.org/";

if (!$h->fetch($url, 300)) {
echo "<h2>There is a problem with the http request!</h2>";
exit();
}

//we need to get all category abbreviations (data looks like: <option value="ccc">community)
preg_match_all ("/<option value=\"(.*)\">([^`]*?)\n/", $h->body, $categoryTemp);

$catNames = $categoryTemp['2'];

//return the array of abreviations
if(sizeof($catNames) > 0)
return $catNames;
else
return $emptyArray = array();

关于mashup - craigslist mashup 如何获取数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/237124/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com