ckreibich / scholar.py

A parser for Google Scholar, written in Python
2.1k stars 777 forks source link

Bibtex not working #102

Open rafed opened 6 years ago

rafed commented 6 years ago

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

soreana commented 6 years ago

same issue

MooersLab commented 6 years ago

same issue

EthanS94 commented 6 years ago

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')

MooersLab commented 6 years ago

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 notifications@github.com 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: blaine-mooers@ouhsc.edu (or bmooers1@gmail.com)

EthanS94 commented 6 years ago

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.

soreana commented 6 years ago

That's working πŸ‘ Thanks :)

MooersLab commented 6 years ago

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 notifications@github.com 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: blaine-mooers@ouhsc.edu (or bmooers1@gmail.com)

mcnesium commented 5 years ago

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…

SvennoNito commented 4 years ago

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.