Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacement of forward slash in URL #99

Open
tardigradus opened this issue Nov 26, 2021 · 6 comments
Open

Replacement of forward slash in URL #99

tardigradus opened this issue Nov 26, 2021 · 6 comments

Comments

@tardigradus
Copy link

With Python 3.6.8 and habanero 0.7.4, the / in the DOI-part of the field url is replaced by %2F, e.g.
the bibtex entry returned by www.doi2bib.org for the DOI 10.1021/acs.jpcc.0c05161 has the element

url = {https://doi.org/10.1021/acs.jpcc.0c05161}

However, when I run

bibtex_string = habanero.cn.content_negotiation(ids = doi)

with that DOI, the string I obtain contains

url = {https://doi.org/10.1021%2Facs.jpcc.0c05161}

Is this supposed to happen?

@sckott
Copy link
Owner

sckott commented Nov 26, 2021

Thanks for the issue. Can you show a complete example? including whats returned

if you do a curl request in bash/etc. the url is already like that, so it's not habanero

curl -L -H "Accept: application/x-bibtex" "https://doi.org/10.1021/acs.jpcc.0c05161"
@article{Shao_2020,
	doi = {10.1021/acs.jpcc.0c05161},
	url = {https://doi.org/10.1021%2Facs.jpcc.0c05161},
	year = 2020,
	month = {oct},
	publisher = {American Chemical Society ({ACS})},
	volume = {124},
	number = {43},
	pages = {23479--23489},
	author = {Jingjing Shao and Vincent Pohl and Lukas Eugen Marsoner Steinkasserer and Beate Paulus and Jean Christophe Tremblay},
	title = {Electronic Current Mapping of Transport through Defective Zigzag Graphene Nanoribbons},
	journal = {The Journal of Physical Chemistry C}
}

@tardigradus
Copy link
Author

Thanks for looking at this. An MWE is

import habanero
bibtex_string = habanero.cn.content_negotiation(ids='10.1021/acs.jpcc.0c05161')
print(bibtex_string)

which results in

@article{Shao_2020,
        doi = {10.1021/acs.jpcc.0c05161},
        url = {https://doi.org/10.1021%2Facs.jpcc.0c05161},
        year = 2020,
        month = {oct},
        publisher = {American Chemical Society ({ACS})},
        volume = {124},
        number = {43},
        pages = {23479--23489},
        author = {Jingjing Shao and Vincent Pohl and Lukas Eugen Marsoner Steinkasserer and Beate Paulus and Jean Christophe Tremblay},
        title = {Electronic Current Mapping of Transport through Defective Zigzag Graphene Nanoribbons},
        journal = {The Journal of Physical Chemistry C}
}

I was comparing this with the output on the page

https://www.doi2bib.org/bib/10.1021/acs.jpcc.0c05161

but this comparison is obviously invalid. Am I just stuck with what Crossref returns and have to tweak the string myself, or are there some knobs I can turn when I access the API?

@sckott
Copy link
Owner

sckott commented Nov 30, 2021

Thanks for the example.

Looks like an easy fix is to do:

import habanero
bibtex_string = habanero.cn.content_negotiation(ids='10.1021/acs.jpcc.0c05161')
from urllib.parse import unquote
unquote(bibtex_string)

I may put something like this in habanero, but I'm waiting to hear back to see if it can be fixed on their side

@tardigradus
Copy link
Author

Thanks, WFM!

@sckott
Copy link
Owner

sckott commented Jan 12, 2022

issue https://gitlab.com/crossref/issues/-/issues/1612

its in their backlog for now, will keep this open until fixed

@sckott
Copy link
Owner

sckott commented Feb 5, 2023

still in the backlog, seems like it's not getting fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants