scholar.py icon indicating copy to clipboard operation
scholar.py copied to clipboard

Bibtex not working

Open rafed opened this issue 7 years ago β€’ 9 comments

Is the extracting bibtex working? I've been trying for a few days and it doesnt seem to work. Any suggestions?

rafed avatar Jan 04 '18 11:01 rafed

same issue

soreana avatar Feb 09 '18 21:02 soreana

same issue

MooersLab avatar Feb 13 '18 16:02 MooersLab

What worked for me was changing line 485 from:

self.article['url_citation'] = self._path2url(tag.get('href'))

to:

self.article['url_citation'] = tag.get('href')

EthanS94 avatar Feb 13 '18 22:02 EthanS94

Thank EthaS94.

This change did not work for me.

I got back a blank line.

On Tue, Feb 13, 2018 at 4:50 PM, EthanS94 [email protected] wrote:

What worked for me was changing line 485 from:

self.article['url_citation'] = self._path2url(tag.get('href'))

to:

self.article['url_citation'] = tag.get('href')

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ckreibich/scholar.py/issues/102#issuecomment-365432480, or mute the thread https://github.com/notifications/unsubscribe-auth/AOeSCyce0U2FfEDqJcADXRnadrIdHTTlks5tUhHBgaJpZM4RS304 .

-- Best regards,

Blaine

Blaine Mooers, Ph.D. Associate Professor Department of Biochemistry and Molecular Biology College of Medicine University of Oklahoma Health Sciences Center S.L. Young Biomedical Research Center Rm. 466 975 NE 10th Street https://maps.google.com/?q=975+NE+10th+Street&entry=gmail&source=g, BRC 466 Oklahoma City, OK 73104-5419

office: (405) 271-8300 lab: (405) 271-8313

Faculty webpage http://tinyurl.com/ouhscMooers X-ray lab (LBSF) http://research.ouhsc.edu/CoreFacilities/LaboratoryofBiomolecularStructureandFunction.aspx COBRE in Structural Biology http://structuralbiology.ou.edu/ SSRL UEC Facebook Page https://www.facebook.com/ssrluec/ SSRL UEC https://www-ssrl.slac.stanford.edu/content/about-ssrl/advisory-panels/ssrl-users-organization/members/ssrluo-2016-executive-committee-members SSRL SAC https://www-ssrl.slac.stanford.edu/content/about-ssrl/scientific-advisory-committee LCLS UEC https://www-ssrl.slac.stanford.edu/lcls-resources/lcls-users-organization-executive-committee

EasyPyMOL https://github.com/MooersLab/EasyPyMOL Molecular Graphics https://www.oumedicine.com/docs/default-source/ad-biochemistry-workfiles/moleculargraphicslinks.html

https://www.oumedicine.com/docs/default-source/ad-biochemistry-workfiles/MolecularGraphicsLinks.html Small Angle Scattering http://www.oumedicine.com/docs/default-source/ad-biochemistry-workfiles/small-angle-scattering-links-27aug2014.html?sfvrsn=0 office: (405) 271-8300 lab: (405) 271-8313 e-mail: [email protected] (or [email protected])

MooersLab avatar Feb 14 '18 13:02 MooersLab

Sorry, this went along with a change from @portalgun's comment on issue #101. I also changed line 985.

tag = soup.find(name='form', attrs={'id': 'gs_settings_form'}) to tag = soup.find(name='form', attrs={'id': 'gs_bdy_frm'})

Try adding this change along with mine and see if it works.

EthanS94 avatar Feb 14 '18 15:02 EthanS94

That's working πŸ‘ Thanks :)

soreana avatar Feb 14 '18 19:02 soreana

scholar.py is now working for me too.

Many thank yous for the help getting the script to run and many thank yous for developing this useful tool!

On Wed, Feb 14, 2018 at 1:53 PM, soreana [email protected] wrote:

That's working πŸ‘

β€” You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ckreibich/scholar.py/issues/102#issuecomment-365725327, or mute the thread https://github.com/notifications/unsubscribe-auth/AOeSC6hDj9A_-J9xF5e2FANhzUJjyylZks5tUzmigaJpZM4RS304 .

-- Best regards,

Blaine

Blaine Mooers, Ph.D. Associate Professor Department of Biochemistry and Molecular Biology College of Medicine University of Oklahoma Health Sciences Center S.L. Young Biomedical Research Center Rm. 466 975 NE 10th Street https://maps.google.com/?q=975+NE+10th+Street&entry=gmail&source=g, BRC 466 Oklahoma City, OK 73104-5419

office: (405) 271-8300 lab: (405) 271-8313

Faculty webpage http://tinyurl.com/ouhscMooers X-ray lab (LBSF) http://research.ouhsc.edu/CoreFacilities/LaboratoryofBiomolecularStructureandFunction.aspx COBRE in Structural Biology http://structuralbiology.ou.edu/ SSRL UEC Facebook Page https://www.facebook.com/ssrluec/ SSRL UEC https://www-ssrl.slac.stanford.edu/content/about-ssrl/advisory-panels/ssrl-users-organization/members/ssrluo-2016-executive-committee-members SSRL SAC https://www-ssrl.slac.stanford.edu/content/about-ssrl/scientific-advisory-committee LCLS UEC https://www-ssrl.slac.stanford.edu/lcls-resources/lcls-users-organization-executive-committee

EasyPyMOL https://github.com/MooersLab/EasyPyMOL Molecular Graphics https://www.oumedicine.com/docs/default-source/ad-biochemistry-workfiles/moleculargraphicslinks.html

https://www.oumedicine.com/docs/default-source/ad-biochemistry-workfiles/MolecularGraphicsLinks.html Small Angle Scattering http://www.oumedicine.com/docs/default-source/ad-biochemistry-workfiles/small-angle-scattering-links-27aug2014.html?sfvrsn=0 office: (405) 271-8300 lab: (405) 271-8313 e-mail: [email protected] (or [email protected])

MooersLab avatar Feb 14 '18 20:02 MooersLab

so I applied the suggested patches like this:

$ git diff
diff --git a/scholar.py b/scholar.py
index 13ccd43..2133d67 100755
--- a/scholar.py
+++ b/scholar.py
@@ -482,7 +482,7 @@ class ScholarArticleParser(object):
-        self.article['url_citation'] = self._path2url(tag.get('href'))
+        self.article['url_citation'] = tag.get('href')

@@ -982,7 +982,7 @@ class ScholarQuerier(object):
-        tag = soup.find(name='form', attrs={'id': 'gs_settings_form'})
+        tag = soup.find(name='form', attrs={'id': 'gs_bdy_frm'})

but trying to run the example command throws the following errors:

$ python scholar.py -c 1 --author "albert einstein" --phrase "quantum theory" --citation bt
Traceback (most recent call last):
File "scholar.py", line 1310, in <module>
    sys.exit(main())
File "scholar.py", line 1300, in main
    citation_export(querier)
File "scholar.py", line 1145, in citation_export
    print(art.as_citation() + '\n')
TypeError: can't concat str to bytes
$ 

So I removed the + '\n' from line 1145:

@@ -1142,7 +1142,7 @@ def citation_export(querier):
-        print(art.as_citation() + '\n')
+        print(art.as_citation())

then the Google API blocked me, but I saw this work once…

mcnesium avatar Nov 28 '18 11:11 mcnesium

I needed to apply both changes from issue #101,

tag = soup.find(name='form', attrs={'id': 'gs_settings_form'}) to tag = soup.find(name='form', attrs={'id': 'gs_bdy_frm'})

and

print(art.as_citation() + '\n') to art.as_citation().decode("utf-8") + "\n"

Together with the fix from @EthanS94 it finally worked for me to use the --citation bt option :-) Even though the output is not as nicely formatted as the example in the README.

SvennoNito avatar Jan 18 '20 23:01 SvennoNito