Greetings,
I’ve just setup Discourse but I would like to import my comments from Disqus. I noticed there’s a lovely import script, however it doesn’t seem to be working for me.
UPDATE #2: Ok, it seems I had some malformed XML, so I am now having the same issue as noted here. The issue is that Disqus no longer includes the email address in the XML exports and in fact “hides” them in their dashboard. So maybe it just won’t be possible to import the comments unless if you add some additional code to also make up email addresses on the fly for the create_users
function.
UPDATE: Actually I guess I should step back for a second. Without adjusting the frozen_string_literal
item at the top of the script I get:
Traceback (most recent call last):
6: from script/import_scripts/disqus.rb:228:in `<main>'
5: from script/import_scripts/disqus.rb:228:in `new'
4: from script/import_scripts/disqus.rb:21:in `initialize'
3: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.10/lib/nokogiri/xml/sax/parser.rb:104:in `parse_file'
2: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.10/lib/nokogiri/xml/sax/parser.rb:104:in `parse_with'
1: from script/import_scripts/disqus.rb:176:in `characters'
script/import_scripts/disqus.rb:195:in `record': can't modify frozen String (FrozenError)
So, maybe that issue should be resolved first (before digging into the below)?
root@discourse:/var/www/discourse# su discourse -c "bundle exec ruby script/import_scripts/disqus.rb"
Loading existing groups...
Loading existing users...
Loading existing categories...
Loading existing posts...
Loading existing topics...
importing users...
importing topics...
Updating topic status
Updating bumped_at on topics
Updating last posted at on users
Updating last seen at on users
Updating first_post_created_at...
Updating user post_count...
Updating user topic_count...
Updating topic users
Updating post timings
Updating featured topic users
Updating featured topics in categories
4 / 4 (100.0%) [3222 items/min] n]
Resetting topic counters
Done (00h 00min 00sec)
I don’t know a whole lot of Ruby - actually I don’t know any, but I do know enough to try to add some debugging like puts "#{id}"
to see if anything is getting fetched and stuff. For example I added above line 190 - puts "#{target}"
or puts "#{str}"
so I can see it’s definitely reading the file.
I know enough of the script is working that IMPORT_FILE
and IMPORT_CATEGORY
have been set properly.
Any ideas on what else I do to troubleshoot/debug?
Thanks!