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

Allow paging

Open norro opened this issue 9 years ago • 11 comments

Allow paging to receive results >20. Can be done with Google Scholar's search parameter 'start'.

norro avatar May 07 '15 15:05 norro

I thought after this patch iteration should be as easy as continuously calling querier.send_query(query) and updating query.start if len(querier.articles) == query.num_results and break otherwise. But that somehow lists results repeatedly up to a certain seemingly number...

Is there still a plan to implement iteration?

andreas-wilm avatar Aug 07 '15 04:08 andreas-wilm

:+1:

willwhitney avatar Feb 13 '16 22:02 willwhitney

I'd also like this feature

vext01 avatar Aug 02 '16 10:08 vext01

how should start parameter set? I am not familiar with python. I would be appreciated If you could help.

floweri avatar Aug 22 '16 17:08 floweri

In the PR #44 it is not possible via the command line, just in your own code. After initializing your Query you have to use the method set_start.

query = SearchScholarQuery()
query.set_start(20)

eknoes avatar Aug 23 '16 08:08 eknoes

thanks. this is apart of my code:

if options.cluster_id: query = ClusterScholarQuery(cluster=options.cluster_id) else: query = SearchScholarQuery() query.set_start(20) if options.author: query.set_author(options.author) if options.allw: query.set_words(options.allw) if options.some:

but it has this error:

searchscholarquery does'nt have any attribute 'set_start'

floweri avatar Aug 26 '16 05:08 floweri

Yes, that is because this Pull Request is not merged yet and so it is not included in the main branch. You have to get the code from #44

eknoes avatar Aug 26 '16 10:08 eknoes

Concerning the usage, @eknoes is right, SearchScholarQuery got the additional set_start() method. I usually first check, if paging is necessary:

if len(querier.articles) >= ScholarConf.MAX_PAGE_RESULTS:
  do_paging = True

and then, if paging is due:

query = SearchScholarQuery()
...
query.set_start(paging * ScholarConf.MAX_PAGE_RESULTS)

norro avatar Aug 29 '16 11:08 norro

I change to code according to commit and then add this number: query.set_start(100) MAX_PAGE_RESULTS = 100

but it find only 20 articles again.

floweri avatar Sep 02 '16 04:09 floweri

It will always find a maximum of 20 articles per page. You got article 100 to 120!

eknoes avatar Sep 03 '16 08:09 eknoes

No, i find only 20 articles at all.

floweri avatar Sep 03 '16 09:09 floweri