Migrando de Haloscan a Disqus (si podés comentar, funcionó ;-)
Si sos usuario de Haloscan, y estás empezando a preguntarte que hacer... esta página te va a explicar una forma de llevarte tus comentarios a Disqus, otro servicio de comentarios para blogs gratuito.
Hace unos pocos días Haloscan anunció el fin de su servicio de comentarios gratuitos para blogs. Adiviná en qué servicio tengo 9 años de comentarios? Sí, en Haloscan.
Ofrecen una migración sencilla a su plataforma Echo, que es un servicio pago. Si bien Echo parece una plataforma de comentarios perfectamente digna, no tengo ganas de gastar dinero en este bloh si puedo evitarlo. Ya bastante le doy tiempo!
Por suerte, los muchachos de Haloscan permiten exportar los comentarios (antes había que pagar para eso), así que gracias Haloscan, fué un gusto!
Entonces empecé a investigar a donde me podía escapar. Parece haber dos sistemas grandes y gratuitos de comentarios:
Téngase en mente que principal interés es no perder mis comentarios, no la calidad del servicio. Habiendo dicho eso, los dos parecen ofrecer más o menos las mismas características.
Consideremos como importar comentarios en cada servicio:
Disqus: Puede importar de blogger y algún otro servicio hosteado. No de Haloscan.
Intense Debate: Puede importar algunos servicios hosteados y algunos archivos. No el que Haloscan me dió.
Entonce que hago? Escribir un programa en Python, por supuesto! Ahí ganó Disqus: tienen un API pública para los comentarios.
Entonces, todo lo que hay que hacer es:
Entender el API de Disqus
Entender los comentarios de Haloscan (es XML)
Crear los hilos necesarios en Disqus
Postear los comentarios de Haloscan a Disqus
Arreglar el blog para que los links a Haloscan funcionen con Disqus
Pan comido. Me llevó medio día, lo que a mi tarifa actual es el equivalente de 3 años de Echo, pero que gracia tendría pagar?
Así que, vamos paso por paso.
1. Entender el API de Disqus
Por suerte hay una biblioteca razonable: Disqus Python Client library y docs para la API así que esto no fué tan difícil.
Instale la biblioteca:
hg clone https://IanLewis@bitbucket.org/IanLewis/disqus-python-client/ cd disqus-python-client python setup.py install
El uso que vamos a darle al API es sencillo, así que si hace falta, lee la documentación 15 minutos. Yo saqué todo lo que necesitaba de este script para importar pybloxsom
Básicamente:
Obterner un key para la API
Loguearse
Obtener el "foro" correcto (Se puede usar una cuenta Disqus para más de un blog)
Postear en el hilo adecuado
2. Entender el archivo de comentarios de Haloscan
No sólo es XML, ¡ Es XML fácil!
Es más o menos así:
<?xml version="1.0" encoding="iso-8859-1" ?> <comments> <thread id="BB546"> <comment> <datetime>2007-04-07T10:21:54-05:00</datetime> <name>superstoned</name> <email>josje@isblond.nl</email> <uri></uri> <ip>86.92.111.236</ip> <text><![CDATA[that is one hell of a cool website ;-)]]></text> </comment> <comment> <datetime>2007-04-07T16:14:53-05:00</datetime> <name>Remi Villatel</name> <email>maxilys@tele2.fr</email> <uri></uri> <ip>77.216.206.65</ip> <text><![CDATA[Thank you for these rare minutes of sweetness in this rough world...]]></text> </comment> </thread> </comments>
Entonces: un tag comments, que contiene una o más tags thread, que contienen uno o mas tags comment. ¡Pan comido con ElementTree!
Hay una obvia correspondencia entre comentarios y threads en Haloscan y Disqus. Bien.
3. Crear los hilos necesarios en Disqus
Esta es la parte complicada, porque requiere cosas de tu blog.
Hay que tener un permalink por post
Cada permalink debe ser una página separada. No sirve un permalink con # en la URL.
Para cada post, hay que saber el título, el permalink, y cómo identificar los comentarios en Haloscan.
Por ejemplo, supongamos que hay un post en //ralsina.me/weblog/posts/ADV0.html con un link de Haloscan como éste:
<a href="javascript:HaloScan('ADV0');" target="_self"> <script type="text/javascript">postCount('ADV0');</script></a>
¿Adónde más sale ese 'ADVO'? En el archivo XML de Haloscan, por supuesto. Es el atributo "id" de un thread.
Además, el título de este post es "Advogato post for 2000-01-17 17:19:57" (Es mi blog por supuesto ;-)
¿Tenés esos datos?
Entonces vamos a crear un thread en Disqus con exactamente los mismos datos:
URL
Thread ID
Titulo
La mala noticia es... vas a necesitar tener esta información para todo tu blog y guardarla en algún lado. Si tenés suerte, tal vez la puedas sacar de una base de datos, como hice yo. Si no... bueno, va a ser bastante trabajo :-(
Para los propósitos de esta explicación voy a asumir que ese dato está en un bonito diccionario indexado por thread id:
{ id1: (url, title), id2: (url, title) }
4. Postear los comentarios de Haloscan a Disqus
Aquí está el código. No está realmente probado, porque tuve que hacer varios intentos y arreglos parciales, pero debería estar cerca de lo correcto. (download):
#!/usr/bin/python # -*- coding: utf-8 -*- # Read all comments from a CAIF file, the XML haloscan exports from disqus import DisqusService from xml.etree import ElementTree from datetime import datetime import time # Obviously these should be YOUR comment threads ;-) threads={ 'ADV0': ('//ralsina.me/weblog/posts/ADV0.html','My first post'), 'ADV1': ('//ralsina.me/weblog/posts/ADV1.html','My second post'), } key='USE YOUR API KEY HERE' ds=DisqusService() ds.login(key) forum=ds.get_forum_list()[0] def importThread(node): t_id=node.attrib['id'] # Your haloscan thread data thr_data=threads[t_id] # A Disqus thread: it will be created if needed thread=ds.thread_by_identifier(forum,t_id,t_id)['thread'] # Set the disqus thread data to match your blog ds.update_thread(forum, thread, url=thr_data[0], title=thr_data[1]) # Now post all the comments in this thread for node in node.findall('comment'): dt=datetime.strptime(node.find('datetime').text[:19],'%Y-%m-%dT%H:%M:%S') name=node.find('name').text or 'Anonymous' email=node.find('email').text or '' uri=node.find('uri').text or '' text=node.find('text').text or 'No text' print '-'*80 print 'Name:', name print 'Email:', email print 'Date:', dt print 'URL:', uri print print 'Text:' print text print ds.create_post(forum, thread, text, name, email, created_at=dt, author_url=uri) time.sleep(1) def importComments(fname): tree=ElementTree.parse(fname) for node in tree.findall('thread'): importThread(node) # Replace comments.xml with the file you downloaded from Haloscan importComments('comments.xml')
Ahora, si tuvimos suerte, ya tenés una linda y funcional colección de comentarios en tu cuenta de Disqus, y la tranquilidad de que no se perdieron los datos. Listo para el paso final?
5. Hackear tu blog para que los links de Haloscan ahora vayan a Disqus
Tal vez no necesites hacer nada más de lo que la guía de instalación de Disqus sugiere. Si vas a hacer la instalación universal editando HTML manualmente, es algo así:
Primero cambié mis links de comentarios. Así era con Haloscan:
<a href="javascript:HaloScan('ADV0');" target="_self"> <script type="text/javascript">postCount('ADV0');</script></a>
Y así es con Disqus:
<a href="//ralsina.me/weblog/posts/ADV0.html#disqus_thread">Comments</a>
Se agrega el javascript al fondo, antes del </body> como dice la guía (Éste es el mío, no es el que querés usar!):
<script type="text/javascript"> //<![CDATA[ (function() { var links = document.getElementsByTagName('a'); var query = '?'; for(var i = 0; i < links.length; i++) { if(links[i].href.indexOf('#disqus_thread') >= 0) { query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&'; } } document.write('<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/yourownblognamegoeshere/get_num_replies.js' + query + '"></' + 'script>'); })(); //]]> </script>
Además, en la página del post, hay que agregar el "embed code" de la guía de Disqus donde sea que vayan los comentarios.
Si querés que más de una página comparta los comentarios (por ejemplo, yo uso los mismos comentarios para la versión en inglés y castellano de un post), hay que usar algo así antes del embed code:
<script type="text/javascript"> var disqus_url = "http://the_url_where_the_comments_really_belong.com"; </script>
Y eso es todo. Debería ser suficiente para ponerte en marcha. Sin embargo:
Si esta guía te resultó útil y te ahorró dinero, porqué no ser un buen tipo y dármelo a mí? Hay un link de donaciones a la izquierda ;-)
Si no lo podés hacer andar, pedime ayuda. Cobro barato!
Asegurate de exportar los comentarios de Haloscan mientras puedas!
Echo is free (I use it on one of my blogs and haven't paid yet).
It's not going to be free anymore: http://js-kit.com/pricing/
por favor serias tan amable de ayudarme a llevar mis comentarios de haloscan a DISQUS, ya subi la plantilla pero ahora no me paarece ningun coments,claro yo tengo mi plantilla original bien guardada, x otra parte tambien tengo en mi pc los coments exportados en formato xml de haloscan estuve viendo en tools de disqus pero hago lo me dice igual no consigo integrar mis ocmnets de haloscan a disqus HELPPPPPPPPPPPPPPPPP
Hey, talk about timing, just got the "upgrade in the next 15 days or your comments die" email from Haloscan two hours after posting :-)
Sorry guys, no need!
Thinking a bit more about this: If you have a list of permalinks, then generating the list of Haloscan IDs and titles is just a matter of programming and screen-scraping.
The biggest missing link seems to be that you need a cross reference listing that links the Haloscan ID to the permalink (because Disqus requires a permalink in it's upload, whereas the Haloscan export XML file only provides a Haloscan ID). The question is, now that Haloscan no longer provides the "Manage Comments" page, is there another way that you're aware of to automatically get this relationship, or will I have to manually go in and identify the permalink for each Haloscan ID?
I could get it automatically because I knew exactly how each haloscan ID was generated (it was basically a post's internal ID). For other systems, well, it is going to be manual labour.
OTOH, it can be done gradually, it doesn't have to be done all at once.
Thanks Roberto!
Disqus claims to have an "import" feature that supports js-kit, but so far I haven't had any luck (it claims to have imported the data, but no actual comments show up on the "Moderate" page).
While I've got your attention... anyone know of a good strategy to make Disqus work with an XHTML-Strict site served as application/xml+xhtml? Their javascript relies on document.write(), which won't work in such a case.
ISame thing happened here, it "imported" in minutes but nothing appeared. Probably the wrong flavor of XML or something.
wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post
Thanks
Joyner
______________________________________________
miracle cabbage soup diet | miracle cabbage soup diet | miracle cabbage soup diet | miracle cabbage soup diet | cayenne pepper detox | cayenne pepper detox | cayenne pepper detox | cayenne pepper detox | maple syrup detox | maple syrup detox | maple syrup detox | maple syrup detox | british heart foundation diet | british heart foundation diet | british heart foundation diet | british heart foundation diet | weight gain diets | weight gain diets | weight gain diets | weight gain diets | easy diet plans | easy diet plans | easy diet plans | easy diet plans | sugar busters diet | sugar busters diet | sugar busters diet | sugar busters diet | diets for quick weight loss | diets for quick weight loss | diets for quick weight loss | diets for quick weight loss | diets for quick weight loss
but .from now on ,i know that ,there still have some one care of the comment which have wealth of information.
am i right?
Hot deals--
Hi Robert (and everyone else)!
Thanks for the writeup. Over at Disqus, we're working quickly to better support people coming over from Haloscan. Disqus is a free (as in pricing) alternative to Haloscan that you may want to check out.
Let me know if you need any help.
--@danielha on Twitter
It's working pretty well, thanks!
That's very impressive what you did Roberto. Most people who blog would not be capable of migrating their comments to another system.
How long before Disqus puts their free users in the same situation as Echo and start charging for their service?
Well, it's the second time I do this. This blog was first hosted at a free service that included comments (pycs.net).
When that died, I switched to static hosting plus haloscan.
Now, because haloscan died, it's static hosting plus disqus.
Should disqus die too, it would probably have to be a personal djangocomments thing or whatever.
So far, I had to move the comments twice in six or seven years, so it's not exactly a common event (The first two/three years I used advogato that's way more limited).
What if Disqus decided next week to change their free service to a fee service? We don't know if or when this might happen. Hopefully it won't happen. I suppose that is the risk everyone takes in using anything offered for free.
It's often the criticism that I get for choosing Disqus when there are free commenting components available right in the open source blog system that I am using.
Is offering commenting systems for free simply a business tactic to build up a potential customer base for future paid fee services?
Then I migrate again, this time to something I host myself, or maybe something I hack on app engine. No big deal.
That'sthe good side of being a programmer. Computers do what I tell them to do.
Then I migrate again, this time to something I host myself, or maybe something I hack on app engine. No big deal.
That'sthe good side of being a programmer. Computers do what I tell them to do.
Then I migrate again, this time to something I host myself, or maybe something I hack on app engine. No big deal.
That'sthe good side of being a programmer. Computers do what I tell them to do.
cool i like this post! It's amazing! thanks a lot!
thanks a lot, very nice post!
Wow. That's a lot of work to move comments over from Haloscan. When you were comparing Disqus and Intense Debates, did you happen to look into how difficult it might be to migrate off those platforms when you moved onto them? Just a thought...
Yes, basically there is no way to migrate them to intense debate at all, as far as I can see.
Thanks for the writeup. Over at Disqus, we're working quickly to better support people coming over from Haloscan. Disqus is a free (as in pricing) alternative to Haloscan that you may want to check out.
Let me know if you need any help.
I like disqus blog comments
por favor serias tan amable de ayudarme a llevar mis comentarios de haloscan a DISQUS, ya subi la plantilla pero ahora no me paarece ningun coments,claro yo tengo mi plantilla original bien guardada, x otra parte tambien tengo en mi pc los coments exportados en formato xml de haloscan estuve viendo en tools de disqus pero hago lo me dice igual no consigo integrar mis ocmnets de haloscan a disqus HELPPPPPPPPPPPPPPPPP
Con ponerlo una vez era suficiente :-(
Después te contacto por mail para ver como hacemos.
sorry, es q no me salia publicado x eso intente varias veces :(
PD: ahy te dejo mis ubicaciòn
Io sono per il Disqus e anche la mia società di utilizzare questo sistema con le pagine internet
Hi, this is a great post. I've been also trapped in this situation with the end of Haloscan, and have exported 5 years of comments. Disqus seams great but I'm afraid that the same thing might happen to Disqus in the future, so I'm more likely to pass to Blogger comments, although I'm not such a great fan... Do you have any clue if it is possible to import the Haloscan comments to Blogger, and how?
Well, if blogger has an API for comments, then you can use half of this post for reading the haloscan data, and then post it into blogger somehow.
I am thesis writer and used your article in my dissertation!
Thanks)
This article is very good. Useful to me. I will return to read this article and other article absolute sure. thank you
For my site Linking
This is great story but I more likely to pass to Blogger comments with the help of DISQUS. I like DISQUS blog comments. because DISQUS is a free commenting plug-in..
I was looking for a post related to moving the comments from Haloscan to Disqus, and at last I found it. Thanks
I like this blogs because DISQUS also works with many different platforms Users also don’t have to sign up for DISQUS or your blog to post comments. You can use your login credentials from another service like Yahoo, Twitter, Open-ID, and others and share the comments...
Este metodo es muy dificil.. alguien encontro una forma mas sencilla de hacerlo?
Disqus is a great tool, I have it on many of my blogs already. It will only get better in the next few years I find Disqus a very good commenting plug-in. You can always check back your comments because Disqus compiles all your entries...so, it's easier to see and follow your comments.
Thanks a lot, it's amazing post I like it very much!
DISQUS allows the blogger to have greater control with comments. It's one of the useful tools that any blogger can have
A main reason many people were slow to adapt to a third party commenting system was that comments posted were not ours. Should something happen to the company, all your comments would be gone. Now DISQUS gives you the option to easily import or export comments.
Disqus is a great commenting plug-in and I think Disqus is going to be the next best thing in commenting. It's great at stopping spam!...Disqus is Rockssss
Disqus has always been my favorite commenting system. The speed of it always amazes me.Disqus is under active development.it is a listen to user feedback.
I think the most striking feature of DISQUS is how it perform in all the blogs I work on. Pretty fast for a commenting system
Disqus really rocks!! I'm already planning to set it up on my blogs and it is rocks! No blog commenting system can compete with disqus today.
Disqus Comments is my commenting application of choice. I have just added here and love the ease of integration and the way it looks.