From d1a20e3938ff4811e85752fc757102dfe42dc7ba Mon Sep 17 00:00:00 2001 From: idoctnef Date: Thu, 7 Apr 2016 17:34:13 +0200 Subject: [PATCH] pushing project --- dadestw.xml | 20 +++++ index.html | 26 ++++++ tuitsapp.html | 231 ++++++++++++++++++++++++++++++++++++++++++++++++++ tuitsview.py | 57 +++++++++++++ xml2json.js | 155 +++++++++++++++++++++++++++++++++ 5 files changed, 489 insertions(+) create mode 100644 dadestw.xml create mode 100644 index.html create mode 100644 tuitsapp.html create mode 100644 tuitsview.py create mode 100644 xml2json.js diff --git a/dadestw.xml b/dadestw.xml new file mode 100644 index 0000000..7a925e3 --- /dev/null +++ b/dadestw.xml @@ -0,0 +1,20 @@ +Suean los analistas con Exploit Kits? https://t.co/Q6fN1p7wxA por @juanmapumaRT @WikiFauna_: https://t.co/KEErii8gGnJefe q pena que no puedas ver lo guapo q te dejao...RT @barbarroja_: el nuevo nmero de @unaposicio est en el horno a punto de salir... https://t.co/v8f2ci6YSVTiempos de reflexin y de combate :: https://t.co/JZP22H0rkYRT @La_Enre_tetuan: Si queris saber ms sobre la relacin entre #racismo y #patriarcado, maana tenis una cita q no os podis perder. httRT @HelenaMaleno: Alertan familiares de una #patera con 33 personas (21 hombres, 8 mujeres, y 4 nios) en el mar de #alboran #nomastragediasFrisem per saber com es justifica ara all de la investidura per possibilitar una "ruptura" i tal #MsDifcilTodava https://t.co/iSqguhEP9nQuiero echar a mi compaera d piso d casa pq ve la tele...y no puedo construir mi mundo EN MI CASAUy s la desconexin.El precio de defenderse - https://t.co/4XSpzXxFKtDesconectar de JxS no, no? #senseporRT @didaclopez: @Fisiofan #SensePor , s. #SenseVergonya , tambRT @kbcitalok: Dos mujeres asesinadas en Tarragona y Bidarte por #ViolenciaMachista, y un menor hurfano. +#NosQueremosVivas +#MachismoMata +#SCUM. #SensePorRT @andresgil: Por qu ya no se habla de desahucios cuando el problema est lejos de desaparecer https://t.co/Cx3XI39FtE por @Sofi_pmRT @angelescasocrow: En #Oviedo se estn quemando edificios maravillosos +La calle Ura ahora mismo https://t.co/q98W144eb3RT @oscarsenar: Excepcional nmero de @lamarea_com, felicidades. https://t.co/pBfgBpVnIDRT @RRYrevolucion: Francia: Estudiantes de #Montpellier bloquean el liceo Clemenceau contra la #LoiTravail. #ToutBloquerDevientVital https:RT @Fair_Coop: 1 5-6-7-8 2016 https://t.co/KMw2A3byvsRT @ProtestPics: We don't know our true power https://t.co/FfQTjzMxN4RT @MarusiaLC: Hay un profundo sentido de humanidad, dignidad y esperanza en el gesto que hizo Bertha Ziga Cceres en la @CIDH https://t.Es curioso el impacto de esta noticia, en todo tipo de medios. Haba pasado antes? https://t.co/xOST9WfQdbRT @juancarlosmohr: "Vivimos como perros aqu ..Dormimos en el suelo con nuestros hijos.." Situacion en Hungra de #refugiados v/ @LydsG htCriminalizando falsa injerencia de Venezuela y ocultando la verdadera de Miami y Alemania :: https://t.co/Mtu8fkKWOPAqu hemos tenido un otoo un poco largo pero ya es verano.Segons @APE_cat, Endesa i Gas Natural no tenen cap intenci de complir la llei contra la #pobresaenergtica" https://t.co/tV833mAYW3D'aqu tres hores, fem el #DebatCRTIC a Girona, amb Quim Nadal, Gemma Ubasart i Benet Salellas. Ens hi acompanyeu? https://t.co/qHizWsGEbcRT @CarlaBotb: Han cambiado el cartel de la enfermera pidiendo silencio por la clave del Wi-Fi y ya no se oye a nadie en las salas de esperRT @Desobedeced: Desobedece sus guerras, haz Objecin Fiscal al gasto militar #DesarmaTusImpuestosRT @fanetin: SOR-PREE-SAAA... https://t.co/2M7O6cs58HRT @cayeruby: A l le abrumaron y se vio obligado a evadir. https://t.co/UbPgpA9IljRT @PROACTIVA_SERV: Prefieren morir aqu a volver al lugar del que huyen.All solo les espera la muerte. UE cmplice y asesina https://t.coCuuenta machitroll que se hace pasar por femimista. Block preventivo. Difundid, please! https://t.co/fGhzvgbxYQNo ho puc evitar. Val. Perd. https://t.co/OyND1ZI1g8https://t.co/6Kf9D2FOhGApirilak 11 Iruean Andrs Bodlorekin elkartasun konzentrazioa #JusticiaParaBodalo #BodaloAskatu https://t.co/F0qPicVlqaProfessionals de la infermeria, en defensa de la #PrescripciInfermera https://t.co/NVu8Q6ttgO @COIBarcelona +https://t.co/PNbRbqaHVCEl dedo y la yakuza (robar y privatizar con ms tranquilidad) :: https://t.co/ooE2wzMUkjNuevo disco de Manel. Estamos perdiendo.1st Gathering of Solidarity economy and integral cooperativism in Greece. Karditsa, 5-6-7-8 of May 2016 https://t.co/eZX7DJKq1O Join it![DEM] |18h| Presentaci "Dejadlos crecer" d'Enrique Martnez Reguera i editat per @viruseditorial. Us hi esperem! https://t.co/nhjonlStdBNuestros "contactos" en las policas tecnolgicas nos comunican que estn muy ocupados/entretenidos con los grupos de Telegram RT @Informatica_CGT: Aviso para navegantes: https://t.co/zCXURbo3rDRT @Informatica_CGT: El pago por firmar un ERE: +Indra paga 2 liberados a tiempo completo a cada sindicato @UGTIndraMadrid @ccoo_indra httpsNeonazis omplen el campus de la Universitat de Valncia d'esvstiques i amenaces https://t.co/3xu3OoJ7DB https://t.co/aqaAnMXzYfAs funciona el cifrado extremo a extremo de @whispersystems adoptado ahora por @WhatsApp buen curro de @xataka https://t.co/dBqlGofIT1Ms dones han dinvolucrar-se en poltica pel b de la raa humana. +Aung San Suu Kyi + +#Feminisme +https://t.co/CiP1ZZypJRAu pair: grado y mster para cambiar paales. Este reportaje y muchos otros en #LaMarea37 https://t.co/XYx6epM3qS https://t.co/CRSpc0YJ40RT @CGTBarcelona: 1 de Maig Manifestaci @CGTBarcelona a les 11h. Va Laietana/Jaume I. LLIBERTAT I LLUITA!! https://t.co/hHSnw6u4wNRT @TanquemElsCIEs: Hem demostrat que s q es pot. Avui marxem per tornarem quan calgui. El dia que reobri, a les 19h a Pl. Urquinaona! htRT @magnet_es: Qu pasara si maana un famoso locutor desvelase tus datos personales en antena? https://t.co/85CZ3QTmww https://t.co/RFmpRT @desalambre: Activistas se encadenan en el CIE de Barcelona para evitar su reapertura https://t.co/VRfvT1wBFw https://t.co/NAMJtgyCxLLhome s ric en proporci a la quantitat de coses de les que pot prescindir. +Henry David Thoreau + +https://t.co/s10ZoiB4wzComunicado de presos polticos mapuche desde la crcel de Temuko :: https://t.co/w4DGiG55Hy#ACTUALITZACI | @l_obrera de #Sabadell convoca roda de premsa dem a les 11h i assemblea oberta diumenge a les 19h https://t.co/aGWQ6m2CnvLos cursos ms elementales en la UIT y GDT instruyen sobre la infiltracin en grupos de IRC y similares, remember ;) https://t.co/t0gaZ6jP9zRT @SergioEfe: Verdades como puos. cc @MargaretCastor @grodira https://t.co/h9uwsCpUhk#Hoy #Jueves #7A Presentacin #libro +Industria musical y sueos prefabricados +https://t.co/8fl1dnxBLS https://t.co/QhKWQwPcDlRT @jordipanye: @EspaiContraband recomanar #llibres d #pensamentcrtic a @LaKlau_Cat a partir dl proper dimarts @AlbanoDante76 @mdelasm @pRT @ceskfreixas: Els llibres que hem amagat a Alcoi i Lleida ja han sigut trobats! Properament, ms edicions d'A la intemprie! https://t.cRT @barbarroja_: Las banlieus entrando en el movimiento... esto se puede poner an ms interesante... https://t.co/gkomxy5Nql#Audio +Penltimos das. Mercancas, mquinas y hombres de Santiago Alba Rico + +https://t.co/LoOx2KZf17 https://t.co/LrOmuiaZFrAvui a les 20H, com cada primer dijous de mes, #AssembleaOberta del #CSOOldSchool, el centre social de #Vallcarca! https://t.co/NZn8EieasUEmiliano Tern + @pensarecarton junts avui a les 19h a presentaci Devenir casta #Amricallatina #lluitesdebase https://t.co/foJFge9ZIB#OPINI | @soniamoll: En aquest mitj en som unes quantes, de dones, que rescatem la paraula https://t.co/YCIuaa8zmN https://t.co/OofjxawxD2Cryptocat actualiza a la versin 3.0.24 https://t.co/HeXmcEVmADRecordeu, dem presentaci de 'Els estralls de la memria' a @EspaiContraband BCN i dissabte @LaPapasseit #Manresa ! https://t.co/qCYNs2hrHSEl feixisme avana si no se'l combat! #AlertaAntifeixista +Tot el suport des de #Sants. https://t.co/4YnZj1XeiKRT @Simon9barris: A 98 del 50% ens ajudeu? https://t.co/9Jy10jjFJx @LiteralBCNHacienda investiga a las empresas espaolas que aceptan pagos con bitcoins https://t.co/pCJuLjy3oOUna tarde muy especial visitando la escuela d Ruzafa en #Valencia :) #charla #compatir #vueltaalmundo #viaje #sueos https://t.co/TfgvsWf3PWRT @BellvmInfo: https://t.co/A2SxjcsVGORT @ManuYanezM: Interesantsimo texto de @gdpedro sobre @DocTarajal. Se ver el sbado en @CinetecaMadrid: https://t.co/kOR6S33xf0 https://Pren la iniciativa i participa en les festes del barri! Concerts, curses, decoraci, teatre, cultura popular... https://t.co/FZKiR0szW0L'epidmia de grip s'ha acabat a Catalunya, segons dades de l'Agncia de Salut Pblica https://t.co/ztcNtHL8AaRT @abc_es: #LTIMAHORA Mauricio Macri imputado por su participacin en una sociedad offshore https://t.co/5BuzcbLFyq@Ed_Aldarull :)Cam de Girona! On the road! Avui a les 19h fem conversa amb Quim Nadal, Benet Salellas i Gemma Ubasart. ;-) https://t.co/MlCUtRKkSJRT @Ed_Aldarull: Seguiu a @distrilapolilla, el quiosc okupat de plaa revoluci que tots els diumenges fa activitats i dona veu als presos.Creo que el CM de @abc_es no ha entendido bien para qu sirve un hilo de Twitter. https://t.co/0Sd818eDsyOPININ | Permiso de paternidad igual e intransferible: solucin o tirita? Por M.J. Ortiz https://t.co/8dUerDio1l https://t.co/SEPczPbGwzProhben a Noelia Cotelo leer un libro de Emma Goldman "por razones de seguridad" :: https://t.co/s6YtwawCHaEl otro da me pill esto https://t.co/MevmjzQxfhRT @r_cuartielles: La Marea Blanca per la Salut es manifesta davant la seu de la UE en motiu del Dia Mundial de la Salut @btvnoticies https@Klinamen_libros @AlbertKaliayev "<3" \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..bf2a0a9 --- /dev/null +++ b/index.html @@ -0,0 +1,26 @@ + + + +obrintnovafinestra + + + + + + + + diff --git a/tuitsapp.html b/tuitsapp.html new file mode 100644 index 0000000..025c031 --- /dev/null +++ b/tuitsapp.html @@ -0,0 +1,231 @@ + + + +info visualizer + + + + + + + + + + + + + + + + + + + +
+ + +

+
+ + +
+ + + + + + diff --git a/tuitsview.py b/tuitsview.py new file mode 100644 index 0000000..fdd2ea0 --- /dev/null +++ b/tuitsview.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +import sys +import tweepy +import os +import xml.etree.cElementTree as ET + +consumer_key = 'XXXXXXX' +consumer_secret = 'XXXXXXX' +access_token = 'XXXXXXX' +access_secret = 'XXXXXXX' + + +auth = tweepy.OAuthHandler(consumer_key, consumer_secret) +auth.set_access_token(access_token, access_secret) + + +api = tweepy.API(auth) + +#gets the last twits que veuria l'usuari al home +##display homepage tweets of authenticated user +for i in range(0, 5): + print(" ") +print("...........---------/////////TL\\\\\\\\-------............") +print(" ") + +root = ET.Element("root") +llistatuits = ET.SubElement(root, "llistatuits") + +public_tweets = api.home_timeline(count=90) +for tweet in reversed(public_tweets): + print("::::::::::::::::") + hora= tweet.created_at.strftime('%H') + hora= int(hora) + 1 + emisor= tweet.user.name + " - @" + tweet.user.screen_name + print(emisor + " -" + str(hora) + ":" + tweet.created_at.strftime('%M:%S')) + #continguttuit=tweet.text.encode('latin-1', 'ignore').decode('utf-8', 'ignore') + continguttuit=tweet.text.encode('latin-1', 'ignore').decode('utf-8', 'ignore') + print (continguttuit) + nretuits=str(tweet.retweet_count) + print (nretuits) + horatuit= str(hora) + ":" + tweet.created_at.strftime('%M:%S') + if 'media' in tweet.entities: + for image in tweet.entities['media']: + imatgetuit= image['media_url'] + ET.SubElement(llistatuits, "tuit", de=emisor, retuits=nretuits, hora=horatuit, imatge=imatgetuit).text = str(continguttuit) + else: + ET.SubElement(llistatuits, "tuit", de=emisor, retuits=nretuits, hora=horatuit).text = str(continguttuit) + + +tree = ET.ElementTree(root) +tree.write("dadestw.xml") + +print(" ") + +import webbrowser +webbrowser.open_new('index.html') diff --git a/xml2json.js b/xml2json.js new file mode 100644 index 0000000..9446dda --- /dev/null +++ b/xml2json.js @@ -0,0 +1,155 @@ +/* This work is licensed under Creative Commons GNU LGPL License. + + License: http://creativecommons.org/licenses/LGPL/2.1/ + Version: 0.9 + Author: Stefan Goessner/2006 + Web: http://goessner.net/ +*/ +function xml2json(xml, tab) { + var X = { + toObj: function(xml) { + var o = {}; + if (xml.nodeType==1) { // element node .. + if (xml.attributes.length) // element with attributes .. + for (var i=0; i 1) + o = X.escape(X.innerXml(xml)); + else + for (var n=xml.firstChild; n; n=n.nextSibling) + o["#cdata"] = X.escape(n.nodeValue); + } + } + if (!xml.attributes.length && !xml.firstChild) o = null; + } + else if (xml.nodeType==9) { // document.node + o = X.toObj(xml.documentElement); + } + else + alert("unhandled node type: " + xml.nodeType); + return o; + }, + toJson: function(o, name, ind) { + var json = name ? ("\""+name+"\"") : ""; + if (o instanceof Array) { + for (var i=0,n=o.length; i 1 ? ("\n"+ind+"\t"+o.join(",\n"+ind+"\t")+"\n"+ind) : o.join("")) + "]"; + } + else if (o == null) + json += (name&&":") + "null"; + else if (typeof(o) == "object") { + var arr = []; + for (var m in o) + arr[arr.length] = X.toJson(o[m], m, ind+"\t"); + json += (name?":{":"{") + (arr.length > 1 ? ("\n"+ind+"\t"+arr.join(",\n"+ind+"\t")+"\n"+ind) : arr.join("")) + "}"; + } + else if (typeof(o) == "string") + json += (name&&":") + "\"" + o.toString() + "\""; + else + json += (name&&":") + o.toString(); + return json; + }, + innerXml: function(node) { + var s = "" + if ("innerHTML" in node) + s = node.innerHTML; + else { + var asXml = function(n) { + var s = ""; + if (n.nodeType == 1) { + s += "<" + n.nodeName; + for (var i=0; i"; + } + else + s += "/>"; + } + else if (n.nodeType == 3) + s += n.nodeValue; + else if (n.nodeType == 4) + s += ""; + return s; + }; + for (var c=node.firstChild; c; c=c.nextSibling) + s += asXml(c); + } + return s; + }, + escape: function(txt) { + return txt.replace(/[\\]/g, "\\\\") + .replace(/[\"]/g, '\\"') + .replace(/[\n]/g, '\\n') + .replace(/[\r]/g, '\\r'); + }, + removeWhite: function(e) { + e.normalize(); + for (var n = e.firstChild; n; ) { + if (n.nodeType == 3) { // text node + if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // pure whitespace text node + var nxt = n.nextSibling; + e.removeChild(n); + n = nxt; + } + else + n = n.nextSibling; + } + else if (n.nodeType == 1) { // element node + X.removeWhite(n); + n = n.nextSibling; + } + else // any other node + n = n.nextSibling; + } + return e; + } + }; + if (xml.nodeType == 9) // document node + xml = xml.documentElement; + var json = X.toJson(X.toObj(X.removeWhite(xml)), xml.nodeName, "\t"); + return "{\n" + tab + (tab ? json.replace(/\t/g, tab) : json.replace(/\t|\n/g, "")) + "\n}"; +}