jacobwb / hashover

Free and Open Source PHP Comment System

Home Page:http://tildehash.com/?page=hashover

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Transferring Disqus comments (from export) to Hashover

q2apro opened this issue · comments

It would be interesting if somebody has written a converter that reads the disqus XML scheme and arranges the data to the hashover XML.

Example Disqus:

<thread dsq:id="568987623">
<id />
<forum>echteinfachtv</forum>
<category dsq:id="1298300" />
<link>http://www.test.com/trigonometrie/</link>
<title>Page Sinus und Kosinus </title>
<message />
<createdAt>2012-02-08T17:02:32Z</createdAt>
<author>
<email>mail@test.com</email>
<name>Super User V</name>
<isAnonymous>false</isAnonymous>
<username>superuserv</username>
</author>
<ipAddress>44.430.49.124</ipAddress>
<isClosed>false</isClosed>
<isDeleted>false</isDeleted>
</thread>

Example Hashover:

<?xml version="1.0" encoding="UTF-8"?>
<comment likes="0" notifications="yes" ipaddr="">
    <name>Marko</name>
    <passwd></passwd>
    <email></email>
    <encryption></encryption>
    <website></website>
    <date>01/02/2015 - 12:00am</date>

    <body>Geniale Seite, danke dafür!</body>
</comment>

Note: I am still sure, that date tag of hashover should be changed to the international format, e.g. 2012-02-08T17:02:32Z.

Furthermore, comparing the data from disqus, maybe the IP should be saved as well in the xml?

This is planned.

IP addresses can be stored by setting the $ip_addrs variable in settings.php to 'yes'

I have imported comments from Disqus using the following (dirty) code:

https://gist.github.com/jacmoe/e9d1ffdbd10c6022f71e394458c46da6

I assumes that the body of the comments is clean - which it should be, since it is from Disqus.
The script saves the comments as xml files named after the timestamp - then it is a small matter of sorting them and renaming them 1, 2, 3, ..

I hope it will serve as a starting point :)

Also, a proper encryption key (from settings) should be inserted into it :)
I am running the script in the shell.

The script does not check if the thread url is wrong - which it can be, if you accidentally use the Disqus code on localhost or other sites (forgot to change the script) - I just went through the exported xml and removed the erroneous threads.

If a thread url is wrong, it usually means that there are duplicate thread id's, which will (maybe) create problems.

Anyway: I hope this helps.

Thank you for the code @jacmoe!

There will be a way to import Disqus comments into HashOver eventually, but the format of the HashOver comment files/database needs to be finalized before the import code can/should be written.

In HashOver 2.0 some progress has been made in allowing a script to "emulate" posting a comment, so as long as there is a way to sort the Disqus comments than they will automatically be imported in the proper 1, 2, 3 naming scheme. This work isn't done, though, it needs to be made easier to allow importing comments from any other kind of comment system.