text使用node-simplecrawler在nodejs中抓取facebook(代码片段)

author author     2022-12-01     135

关键词:

var Crawler = require("simplecrawler");
var Url = require("url");

var target = "https://graph.facebook.com/ledzeppelin/feed?access_token=1597581200507009%7Ce749be55ea86249f92ae56b081c37b38&fields=from%2Cmessage%2Ccreated_time%2Ctype%2Clink%2Ccomments.summary(true)%2Clikes.summary(true)%2Cshares&since=2016-07-11&until=2016-07-14&limit=10";
var url = Url.parse(target);

var crawler = new Crawler(url.host);
crawler.initialPath = url.path;
crawler.initialPort = 443;
crawler.initialProtocol = "https";

crawler.maxConcurrency = 1;
crawler.maxDepth = 2;
crawler.stripQuerystring = false;
crawler.decodeResponses = true;
crawler.supportedMimeTypes.push(/^application\/json/i);
 
crawler.on("fetchcomplete", function(queueItem, buffer, response) 
    console.log("Completed fetching resource:", queueItem.url);
    node.send(payload: "Completed fetching resource: " + queueItem.url);
    node.send(payload: buffer);
);

crawler.on("fetcherror", function(queueItem, response) 
    console.log("Error fetching resource:", queueItem.url);
    //console.log(queueItem);
    node.send(payload: "error" : queueItem);
);

crawler.discoverResources = function(buffer, queueItem) 
    try 
        var data = JSON.parse(buffer);
        if (data.paging && data.paging.next) 
            return [data.paging.next];
        
    
    catch (e) 
        console.log(e);
    
    return [];
;


crawler.start();
console.log("start crawling...");

如何在 reactJS 中使用 Thymeleaf th:text

】如何在reactJS中使用Thymeleafth:text【英文标题】:HowtouseThymeleafth:textinreactJS【发布时间】:2016-06-0108:10:41【问题描述】:我正在使用Thymeleaf和reactJS运行springboot应用程序。通过在页面中使用th:text从message.properties读取所有HTML文本,... 查看详情

C# 仅在存在时使用数组

】C#仅在存在时使用数组【英文标题】:C#onlyusearraysifitexists【发布时间】:2021-02-1901:28:37【问题描述】:我是编程初学者。而现在我面临着一个我无法再进一步的任务。可能比较容易解决。这就是我想做的:我读出了一个.txt文... 查看详情

如何在 System.Text.Json 中使用 JsonConstructor 属性

】如何在System.Text.Json中使用JsonConstructor属性【英文标题】:HowtouseJsonConstructorAttributeinSystem.Text.Json【发布时间】:2021-12-2805:41:29【问题描述】:我使用的是.NET提供的Json命名空间,而不是Newtonsoft的命名空间。我有一段代码:string... 查看详情

使用 Form::text 在 Laravel 输入字段上设置自动对焦

】使用Form::text在Laravel输入字段上设置自动对焦【英文标题】:SetautofocusonLaravelinputfieldusingForm::text【发布时间】:2013-09-2911:41:10【问题描述】:如何使用表单在某个字段上设置autofocus?我已经通过注册宏来设置焦点,但是可以在... 查看详情

在 DataTemplate 中使用 TextSearch.Text

】在DataTemplate中使用TextSearch.Text【英文标题】:UsageofTextSearch.TextinDataTemplate【发布时间】:2012-04-2606:48:05【问题描述】:我有一个非常简单的例子:带有单个表单的WPF表单应用程序,其中包含带有数据的字典:DimdictAsNewCollections.... 查看详情

何时在 mysql 中使用 TEXT 而不是 VARCHAR [重复]

】何时在mysql中使用TEXT而不是VARCHAR[重复]【英文标题】:WhentouseTEXTinmysqlinsteadofVARCHAR[duplicate]【发布时间】:2012-07-1114:41:45【问题描述】:可能重复:MySQL:LargeVARCHARvs.TEXT?既然VARCHAR现在可以有65k字节,那么什么时候应该使用TEXT而... 查看详情

text在mac上使用python(代码片段)

查看详情

text在本地环境中使用php(代码片段)

查看详情

text在组织模式下使用href(代码片段)

查看详情

你怎么知道啥时候使用varchar,啥时候在sql中使用text?

】你怎么知道啥时候使用varchar,啥时候在sql中使用text?【英文标题】:Howdoyouknowwhentousevarcharandwhentousetextinsql?你怎么知道什么时候使用varchar,什么时候在sql中使用text?【发布时间】:2011-06-0923:33:57【问题描述】:这似乎是一个... 查看详情

如何在反序列化之前使用 System.Text.Json 验证 JSON

】如何在反序列化之前使用System.Text.Json验证JSON【英文标题】:HowtovalidateJSONusingSystem.Text.Jsonbeforedeserialization【发布时间】:2021-07-1519:27:27【问题描述】:在.NETCore5.0中,使用System.Text.Json.JsonSerializerDeserialize(someJsonFile)我得到:Syst... 查看详情

如何在 Tensorflow 2 中使用 CRF 层(使用 tfa.text)?

】如何在Tensorflow2中使用CRF层(使用tfa.text)?【英文标题】:HowtouseaCRFlayerinTensorflow2(usingtfa.text)?【发布时间】:2020-04-0300:31:54【问题描述】:model=Sequential()model.add(keras.layers.Embedding(vocab_size,output_dim=100,input_length=input_len, 查看详情

在 QML 中使用 Text.implicitWidth 时的性能损失

】在QML中使用Text.implicitWidth时的性能损失【英文标题】:PerformancePenaltywhenusingText.implicitWidthinQML【发布时间】:2016-12-1914:40:05【问题描述】:在Item的文档中可以找到:注意:使用Text或TextEdit的implicitWidth并显式设置宽度会导致性... 查看详情

如何使用 Pango 在 Clutter.Text 中设置行高

】如何使用Pango在Clutter.Text中设置行高【英文标题】:HowtosetlineheightinClutter.TextusingPango【发布时间】:2015-04-0510:14:28【问题描述】:我想让Clutter.Text使用Gtk.Pango以双倍行距显示文本。注意:在css中,我认为我们会使用line-height:200%... 查看详情

text在.net核心中使用urlhelper(代码片段)

查看详情

text在apache中使用url代理(代码片段)

查看详情

使用 CORS 在 WebAPI 中将 text/plain 作为复杂对象发布

】使用CORS在WebAPI中将text/plain作为复杂对象发布【英文标题】:Postingtext/plainasacomplexobjectinWebAPIwithCORS【发布时间】:2013-03-1507:21:19【问题描述】:所以我希望使用CORS从AJAX帖子中将复杂对象POST(或PUT)到服务器。不幸的是,IE8只... 查看详情

如何在浏览器中使用 twitter-text

】如何在浏览器中使用twitter-text【英文标题】:HowdoIusetwitter-textinabrowser【发布时间】:2021-12-0302:36:34【问题描述】:我想计算推文长度。Twitter让这变得非常非常困难。他们有这个repo:https://github.com/twitter/twitter-text,其中包含这... 查看详情