Zoter Connector: Bug when detecting URL
Hello, I tested a translator on WanFang Medical, this is a demo link: https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK
This is the log from Zotero Connector when opening the demo link.
(3)(+0025153): Connector_Browser: onActivated for https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK
(3)(+0001834): HTTP GET moz-extension://69a3dbe3-db1b-4c79-8623-9dbcca705bc6/utilities/resource/dateFormats.json
******************** A unexpected URL is detected
(3)(+0000283): Connector_Browser: onFrameLoaded for https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK; https://medad.med.wanfangdata.com.cn/www/delivery/afr.php?zoneid=74&cb=INSERT_RANDOM_NUMBER_HERE
************************************
(3)(+0000000): Translators: Looking for translators for https://medad.med.wanfangdata.com.cn/www/delivery/afr.php?zoneid=74&cb=INSERT_RANDOM_NUMBER_HERE
(3)(+0000000): Not injecting. No translators found for [tab.url, url]: https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK , https://medad.med.wanfangdata.com.cn/www/delivery/afr.php?zoneid=74&cb=INSERT_RANDOM_NUMBER_HERE
(3)(+0000852): Translators: Looking for translators for https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK
(4)(+0000045): Translate: Binding sandbox to https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK
Zotero Connector found an ad iframe on the page, and use this ad URL(https://medad.med.wanfangdata.com.cn) to find available translators. However, the correct target URL is https://med.wanfangdata.com.cn/Paper/Detail?id.
I just search code in the Zotero Connector repo, it seems like an iframe URL popups when this iframe is activated.
This is the log from Zotero Connector when opening the demo link.
(3)(+0025153): Connector_Browser: onActivated for https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK
(3)(+0001834): HTTP GET moz-extension://69a3dbe3-db1b-4c79-8623-9dbcca705bc6/utilities/resource/dateFormats.json
******************** A unexpected URL is detected
(3)(+0000283): Connector_Browser: onFrameLoaded for https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK; https://medad.med.wanfangdata.com.cn/www/delivery/afr.php?zoneid=74&cb=INSERT_RANDOM_NUMBER_HERE
************************************
(3)(+0000000): Translators: Looking for translators for https://medad.med.wanfangdata.com.cn/www/delivery/afr.php?zoneid=74&cb=INSERT_RANDOM_NUMBER_HERE
(3)(+0000000): Not injecting. No translators found for [tab.url, url]: https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK , https://medad.med.wanfangdata.com.cn/www/delivery/afr.php?zoneid=74&cb=INSERT_RANDOM_NUMBER_HERE
(3)(+0000852): Translators: Looking for translators for https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK
(4)(+0000045): Translate: Binding sandbox to https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK
Zotero Connector found an ad iframe on the page, and use this ad URL(https://medad.med.wanfangdata.com.cn) to find available translators. However, the correct target URL is https://med.wanfangdata.com.cn/Paper/Detail?id.
I just search code in the Zotero Connector repo, it seems like an iframe URL popups when this iframe is activated.
/Paper/Detail?id
URL as well. That just doesn't match the current target regex in the WanFang Data translator.Target regex: "^https?://[a-z]+\\.wanfangdata\\.com\\.cn"
Wan Fang Medical URL like: https://med.wanfangdata.com.cn/Paper/Detail?id=PeriodicalPaper_zhyfyx200202011&dbid=WF_QK
This translator works on a page only if its
getItemId()
function returns truthy on the doc. This is not the case with the document I received at the URL. In addition the old export "endpoint" doesn't respond anymore.I am trying to update Wanfang Data.js in https://github.com/l0o0/translators_CN/blob/d1eb5ecbf75ff57876aee82d95756d453bb5920c/translators/Wanfang Data.js#L4
The target regex is updated and works well. After days of testing, I will make a pr to Zotero repo.