calling proxyToProper in a translator?

6 views
Skip to first unread message

Lynda Howell

unread,
Feb 13, 2012, 1:59:58 PM2/13/12
to zotero-dev
I'm writing a web translator for a site that lists proxied URLs, but I
want to save the un-proxied versions in Zotero so that bibliographic
citations generated from the references include the generic version.
Is there a standard way to de-proxy URLs from within a web translator?

I see references in the Firefox console to
Zotero.Proxies.proxyToProper, which looks like it does exactly what I
want when Zotero is searching for an appropriate translator to apply
to a page. Is it possible to call this from within my translator?
I've tried something like newItem.url =
Zotero.Proxies.proxyToProper(theBadURL); but that tells me
Zotero.Proxies is undefined. What am I missing?

I could manually de-proxy the URLs, but that requires me to hard code
formats I'd rather let Zotero handle if I can.

Lynda.

Avram Lyon

unread,
Feb 13, 2012, 2:04:23 PM2/13/12
to zoter...@googlegroups.com
I thought this was being done automatically by Zotero-- can you
confirm that it isn't? It's possible that the proxies aren't being
stripped out when you use Scaffold, but I think it works in normal
usage.

Avram

> --
> You received this message because you are subscribed to the Google Groups "zotero-dev" group.
> To post to this group, send email to zoter...@googlegroups.com.
> To unsubscribe from this group, send email to zotero-dev+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/zotero-dev?hl=en.
>

Lynda Howell

unread,
Feb 13, 2012, 2:49:38 PM2/13/12
to zoter...@googlegroups.com
I've just reconfirmed that I'm getting the proxied version of the URL saved in the Zotero reference.  I'm not using Scaffold, just Firefox 10.0.1 and Zotero 3.0.1 on Windows 7.  (I've disabled all other add-ons.)

The site I'm working with (http://clientcenter.serialssolutions.com) is a little different from most I've written translators for because the site itself is not proxied, but many of the URLs it lists are.  I've uploaded my draft translator to https://gist.github.com/1818789 (line 132 is where it's dealing with the URL).  In most cases, the URL I'm saving is not the URL of the page being scraped.

When I load a page on http://search.ebscohost.com (for example) in Firefox, Zotero automatically redirects me to the login page for my proxy (http://www.myunion.edu/library-login.aspx?url=http://search.ebscohost.com).  The site I'm working with is giving URLs in the format http://www.myunion.edu/library-login.aspx?url=http://search.ebscohost.com, and I'm hoping to have my translator save http://search.ebscohost.com.

Thanks for your help.

Lynda.

Simon

unread,
Feb 13, 2012, 6:52:21 PM2/13/12
to zotero-dev
On Feb 13, 2:49 pm, Lynda Howell <howel...@gmail.com> wrote:
> I've just reconfirmed that I'm getting the proxied version of the URL saved
> in the Zotero reference.  I'm not using Scaffold, just Firefox 10.0.1 and
> Zotero 3.0.1 on Windows 7.  (I've disabled all other add-ons.)
>
> The site I'm working with (http://clientcenter.serialssolutions.com) is a
> little different from most I've written translators for because the site
> itself is not proxied, but many of the URLs it lists are.  I've uploaded my
> draft translator tohttps://gist.github.com/1818789(line 132 is where it's
> dealing with the URL).  In most cases, the URL I'm saving is not the URL of
> the page being scraped.
>
> When I load a page onhttp://search.ebscohost.com(for example) in Firefox,
> Zotero automatically redirects me to the login page for my proxy (http://www.myunion.edu/library-login.aspx?url=http://search.ebscohost...).
> The site I'm working with is giving URLs in the formathttp://www.myunion.edu/library-login.aspx?url=http://search.ebscohost...,
> and I'm hoping to have my translator savehttp://search.ebscohost.com.
>
> Thanks for your help.
>
> Lynda.
>
>
>
>
>
>
>
> On Mon, Feb 13, 2012 at 2:04 PM, Avram Lyon <ajl...@gmail.com> wrote:
> > I thought this was being done automatically by Zotero-- can you
> > confirm that it isn't? It's possible that the proxies aren't being
> > stripped out when you use Scaffold, but I think it works in normal
> > usage.
>
> > Avram
>
> > On Mon, Feb 13, 2012 at 10:59 AM, Lynda Howell <howel...@gmail.com> wrote:
> > > I'm writing a web translator for a site that lists proxied URLs, but I
> > > want to save the un-proxied versions in Zotero so that bibliographic
> > > citations generated from the references include the generic version.
> > > Is there a standard way to de-proxy URLs from within a web translator?
>
> > > I see references in the Firefox console to
> > > Zotero.Proxies.proxyToProper, which looks like it does exactly what I
> > > want when Zotero is searching for an appropriate translator to apply
> > > to a page.  Is it possible to call this from within my translator?
> > > I've tried something like newItem.url =
> > > Zotero.Proxies.proxyToProper(theBadURL); but that tells me
> > > Zotero.Proxies is undefined.  What am I missing?
>
> > > I could manually de-proxy the URLs, but that requires me to hard code
> > > formats I'd rather let Zotero handle if I can.
>
> > > Lynda.

Few functions are exposed to the translator sandbox.
Zotero.Proxies.proxyToProper() is not one of them, and the solution
isn't as easy as exposing it to translators, because connectors use a
very different system for detecting proxies.

We should automatically deproxying URLs on save, but if this worked
before I probably broke it during refactoring for the connectors in
3.0. I will fix it, but the fix is non-trivial and probably won't land
before Zotero 3.5.

Simon

Avram Lyon

unread,
Feb 14, 2012, 1:23:17 AM2/14/12
to zoter...@googlegroups.com
On Mon, Feb 13, 2012 at 3:52 PM, Simon <si...@simonster.com> wrote:
>> The site I'm working with (http://clientcenter.serialssolutions.com) is a
>> little different from most I've written translators for because the site
>> itself is not proxied, but many of the URLs it lists are.  I've uploaded my
>> draft translator tohttps://gist.github.com/1818789(line 132 is where it's
>> dealing with the URL).  In most cases, the URL I'm saving is not the URL of
>> the page being scraped.
>>
>> When I load a page onhttp://search.ebscohost.com(for example) in Firefox,
>> Zotero automatically redirects me to the login page for my proxy (http://www.myunion.edu/library-login.aspx?url=http://search.ebscohost...).
>> The site I'm working with is giving URLs in the formathttp://www.myunion.edu/library-login.aspx?url=http://search.ebscohost...,
>> and I'm hoping to have my translator savehttp://search.ebscohost.com.
[..]

Simon wrote:
> We should automatically deproxying URLs on save, but if this worked
> before I probably broke it during refactoring for the connectors in
> 3.0. I will fix it, but the fix is non-trivial and probably won't land
> before Zotero 3.5.

I don't think Lynda's situation actually worked before, since Zotero
only deproxies when the page itself was received through a proxy--
here, the page being scraped was not retrieved via proxy, but the
links have proxy information in them.

Avram

Reply all
Reply to author
Forward
0 new messages