Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

myTweetFeed

node v4.9.1
version: 2.0.0
endpointsharetweet
var base = 'https://twitter.com/fabiofranchino' var endpoint = require("@runkit/runkit/json-endpoint/1.0.0") var request = require("request") var cheerio = require("cheerio") endpoint(module.exports, function(req, done) { var url = base doit(url, done) }) function doit(url, done){ request(url, function(error, response, body) { if (error) return done({error: "could not retrieve page"}) var $ = cheerio.load(body) var items = $('.js-stream-item') var resp = [] items.each(function(i, e){ var tit = $(this).find('.tweet-text') resp.push({ id: $(this).data('item-id'), type: $(this).data('item-type'), screenName: $(this).data('screen-name'), fullName: $(this).find('.fullname').text(), text: $(this).find('.js-tweet-text-container').text() }) }) done({ items: resp }) }) } doit(base, (data)=>console.log(data))
Loading…

no comments

    sign in to comment