Skip to content
This repository was archived by the owner on Aug 5, 2020. It is now read-only.

overjt/taringajs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ed01b44 · Sep 28, 2017

History

38 Commits
Feb 15, 2016
Oct 26, 2015
Sep 10, 2014
Sep 10, 2014
Sep 28, 2017
Jan 8, 2016
Jan 14, 2016

Repository files navigation

npm version GitHub version

TaringaJS

Taringa + nodejs

Para instalar en su proyecto:

npm install taringajs --save

Ejemplos

Todos los ejemplos tienen el siguiente encabezado

var t = require('taringajs');
var taringa = new t('USERNAME', 'PASSWORD');

Hacer un Shout

  • Texto
taringa.shout.add("Test - #NodeJS");
  • Imagen
taringa.shout.add("Test image", 1, 0, "http://k33.kn3.net/taringa/9/2/3/6/7/8//djtito08/9B4.jpg"); //La url debe ser de kn3
  • Video
taringa.shout.add("Test video", 2, 0, "https://www.youtube.com/watch?v=l7Fi8-7HRhc");
  • Link
taringa.shout.attach_link("http://coffeescript.org/", function(err, data) {
  if (err) {
    return console.log(err);
  }
  return taringa.shout.add("Test link", 3, 0, data);
});

Comentar un shout

taringa.shout.add_comment("Hola",60544255,19963011,"shout");

Dar "Me gusta" a un shout

taringa.shout.like(60544255,19963011);

Dar "Reshout" a un shout

taringa.shout.reshout(60544255,19963011); // shout_id, shout_owner_id

Obtener los datos de un shout utilizando el id

taringa.shout.get_object(60544255, function(err, data) {
    if (err) {
        return console.log(err);
    }
    console.log(data);
});

Importar una imagen a kn3

taringa.kn3.import("https://i.imgur.com/s8yBeZ8.png", function(err, data) {
    if (err) {
        return console.log(err);
    }
    console.log(data);
});

Obtener los datos de un usuario según el nick

taringa.user.get_user_id_from_nick("overjt", function(err, data) {
    if (err) {
        return console.log(err);
    }
    console.log(data);
});

Seguir a un usuario

taringa.user.follow(19963011);

Dejar de seguir a un usuario

taringa.user.unfollow(19963011);

Dar favorito a un shout

taringa.shout.fav(60544255,19963011);

Obtener el último MP

taringa.message.getLast(function(err, data) {
    if (err) {
        return console.log(err);
    }
    console.log(data);
});

Obtener un MP por ID

taringa.message.get(1324344, function(err, data) {
    if (err) {
        return console.log(err);
    }
    console.log(data);
});

Todos los ejemplos están en el archivo test/test.js

Crear un post

var title = 'Posteo algo y te lo muestro';
var body = "[img]https://k60.kn3.net/taringa/9/5/0/0/6/4//xxx_555/BA9.jpg[/img]";
var category = 1;
var tags = "imagenes, gif, random, taringa";

//el thumbnail debe ser una imagen de kn3
var thumbnail ="https://k60.kn3.net/taringa/9/5/0/0/6/4//xxx_555/BA9.jpg";

taringa.post.create(title,body,category,tags,thumbnail); 
                        

TODO

  • Comentar el código
  • Añadir funcionalidades para los post