0

After having refactored my site disqus comments do not match with their original nodes (despites they share the same path alias) and I am considering leaving disqus, as I didn't manage to fix the problem.

I would like to migrate from disqus to drupal and although I have seen that disqus offers an export feature that generates a xml file (https://help.disqus.com/customer/portal/articles/472149-comments-export). Unfortunately I haven't been able to import that file into drupal, as the disqus module had this functionallity on D6 only and this sandbox project is abandoned and does not work (I guess disqus changed their API)

Maybe migrate module or feeds module could handle that, but I haven't found any documentation on how to proceed.

Any help would be appreciated. Thanks.

EDIT: The following code shows disqus' xml structure:

<?xml version="1.0" encoding="utf-8"?>
<disqus xmlns="http://disqus.com" xmlns:dsq="http://disqus.com/disqus-internals" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://disqus.com/api/schemas/1.0/disqus.xsd http://disqus.com/api/schemas/1.0/disqus-internals.xsd">
    <!-- First defines the threads = drupal nodes -->
    <thread dsq:id="3225849642">
        <id>node/400</id> <!-- This nid has changed after migration--> 
        <forum>carloscamara</forum>
        <category dsq:id="670543" />
        <link>http://carloscamara.es/blog/2014/11/15/experiencia-como-usuario-de-un-fairphone</link><!-- This path is the same after migration--> 
        <title>Experiencia como usuario de un Fairphone</title>
        <message />
        <createdAt>2014-11-14T23:52:16Z</createdAt>
        <author>
            <email>some email</email>
            <name>some name</name>
            <isAnonymous>false</isAnonymous>
            <username>ccamara</username>
        </author>
        <ipAddress>some IP</ipAddress>
        <isClosed>false</isClosed>
        <isDeleted>false</isDeleted>
    </thread>

    <!-- Posts are like drupal comments are later defined and related to threads referencing their thread dsq:id -->

    <post dsq:id="2247159473">
        <id />
        <message><![CDATA[<p>Estoy muy interesada en comprarme el Fairphonr 1, y espero no llegar tarde. ¿Dónde puedo comprarlo?</p>]]></message>
        <createdAt>2015-09-10T23:05:08Z</createdAt>
        <isDeleted>false</isDeleted>
        <isSpam>false</isSpam>
        <author>
            <email>Another email</email>
            <name>Another name</name>
            <isAnonymous>true</isAnonymous>
        </author>
        <ipAddress>Another IP</ipAddress>
        <thread dsq:id="3225849642" />
    </post>

    <!-- This comment is a child of another comment -->
    <post dsq:id="2247642804">
        <id />
        <message><![CDATA[<p>Hola, pues siento decirte que los Fairphone 1 se agotaron y no van a hacer más, así que me temo que solo quedan dos opciones: o comprar el Fairphone 2 (mucho mejor, pero también más caro) o comprar uno de segunda mano.</p>]]></message>
        <createdAt>2015-09-11T07:45:30Z</createdAt>
        <isDeleted>false</isDeleted>
        <isSpam>false</isSpam>
        <author>
            <email>some email</email>
            <name>some name</name>
            <isAnonymous>false</isAnonymous>
            <username>ccamara</username>
        </author>
        <ipAddress>some IP</ipAddress>
        <thread dsq:id="3225849642" /> <!-- This is the parent's node -->
        <parent dsq:id="2247159473" /> <!-- This is the parent's comment -->
    </post>
</disqus>
5
  • does this xml file give you the Node ID (nid) of each comment?
    – No Sssweat
    Dec 30, 2015 at 9:13
  • yes, it provides both node/id and path alias. Why are you asking that?
    – ccamara
    Dec 30, 2015 at 9:15
  • because it's crucial.
    – No Sssweat
    Dec 30, 2015 at 10:06
  • Could you be so kind to explain why is so crucial and what can I do with it?
    – ccamara
    Dec 30, 2015 at 10:14
  • It's crucial because it tells you what comment belongs to what node (article).
    – No Sssweat
    Dec 30, 2015 at 10:15

1 Answer 1

1

You will need Feeds Comment Processor and Feeds XPath Parser because your xml does not use the typical rss title, author, and url tags.

Here is an example on how to set up the xpath parser.

10
  • Thank you! I did what you suggested, although I didn't succeed with it, most likely because I never worked with xpath parser and I might have not made a correct mapping (or processor's configuration). That's my processor configuration: pastebin.com/7N3tR3pQ (I'm not sure with lines 24-30) and here's the xml defintion: help.disqus.com/customer/portal/articles/472149-comments-export Can you find any errors on my mapping or configuration?
    – ccamara
    Dec 30, 2015 at 15:47
  • 1
    it's not working because you haven't set a Context in your XPATH PARSER SETTINGS. Try using /disqus as your Context.
    – No Sssweat
    Dec 31, 2015 at 0:06
  • your name needs to be like this, thread/author/name & post/author/name
    – No Sssweat
    Dec 31, 2015 at 0:10
  • also change post/dsq:id to post/@dsq:id
    – No Sssweat
    Dec 31, 2015 at 0:19
  • 1
    I wouldn't worry about comment id (cid) as feeds will auto generate one. So which one is the node id? <thread>1</thread>? or <id>3</id> or <post dsq:id="2"> I cannot tell by just looking at the example that you provided.
    – No Sssweat
    Dec 31, 2015 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.