Can someone help to write a web translator of the www.soopat.com

I have try to learn the JavaScript for a while, but my wrote translator still running fail and I can not find out the problems.

Can some geeks of programming help to write one? Great thanks!
  • Feel free to post your translator on https://gist.github.com and link to it here. I can't really load that page properly (I think it times out for the most part, so all I get is the top bar), so I won't be writing a translator, but I can take a look at what you have.
  • Great thanks Aurimas! Please check the follow link

    https://github.com/raycth/Zotero-web-translator-for-Soopat.com/tree/master
  • I think that problem is the following line
    if (doc.location.href.match("ViewSearch")) {
    which is at least in my test case http://www.soopat.com/Patent/200510038782 wrong. This leads that the following code will not be processed and therefore the error "No Title" is occuring.

    However, there are more issues which we should look at and you should try to work with test cases as early as possible. @aurimas: Any thoughts?
  • Can you be more specific about what's not working? Is the URL bar icon not showing up? (it may not, since you're returning "Patent" instead of "patent" from detectWeb)

    If the icon is showing up, please provide more specific error messages when importing.
  • Hi, the follow is my run doweb:

    18:22:47 [
    "0": "http://www.soopat.com/Patent/201510180712#this"
    ]
    18:22:47 finished.
    18:22:47 Translation using Soopat failed:
    string => Error: No title specified for item
    stack => Zotero.Translate.Sandbox.Web._itemDone@chrome://zotero/content/xpcom/translation/translate.js:590:32
    Zotero.Translate.SandboxManager.prototype.importObject/attachTo[localKey]<@chrome://zotero/content/xpcom/translation/translate_firefox.js:527:29
    @chrome://zotero/content/xpcom/translation/translate_firefox.js:433:66
    Zotero.Item.prototype.complete@chrome://zotero/content/xpcom/translation/translate_firefox.js:491:277
    scrape@Soopat:91:2
    Zotero.Utilities.Translate.prototype.processDocuments@chrome://zotero/content/xpcom/utilities_translate.js:260:4
    Zotero.Translate.SandboxManager.prototype.importObject/attachTo[localKey]<@chrome://zotero/content/xpcom/translation/translate_firefox.js:527:29
    @chrome://zotero/content/xpcom/translation/translate_firefox.js:433:66
    doWeb@Soopat:117:2
    Zotero.Translate.Base.prototype._translateTranslatorLoaded@chrome://zotero/content/xpcom/translation/translate.js:1218:4
    Zotero.Translate.Web.prototype._translateTranslatorLoaded@chrome://zotero/content/xpcom/translation/translate.js:1807:3
    Zotero.Translate.Base.prototype.translate/<@chrome://zotero/content/xpcom/translation/translate.js:1185:58
    Zotero.Translate.Base.prototype._loadTranslator@chrome://zotero/content/xpcom/translation/translate.js:1570:16
    Zotero.Translate.Base.prototype.translate@chrome://zotero/content/xpcom/translation/translate.js:1185:4
    Zotero.Translate.Web.prototype.translate@chrome://zotero/content/xpcom/translation/translate.js:1798:2
    _run@chrome://scaffold/content/scaffold.js:408:4
    run@chrome://scaffold/content/scaffold.js:352:4
    oncommand@chrome://scaffold/content/scaffold.xul:1:1

    url => http://www.soopat.com/Patent/201510180712#this
    downloadAssociatedFiles => true
    automaticSnapshots => true
  • the icon is showing up

    can you provide a template for me to modify?

    this is a patent website.

    Thanks!
  • Okay, as I suspected above the if-statement is false and therefore the code inside will not be executed. It should work when you simply delete the line
    if (doc.location.href.match("ViewSearch")) {
    and the corresponding closing bracket. Can you confirm that it works without this test? What is the reason for this test anyway?

    @aurimasv commented also on your code, see https://github.com/raycth/Zotero-web-translator-for-Soopat.com/commit/677069f630a1e1045253fc0c747090392a505a4b
  • @zuphilip it works while delete the codes but there still some errors

    I am trying to revise

    thanks!
Sign In or Register to comment.