More search results?
for-coursera opened this issue · 11 comments
For some reason, ytools-search
always returns me exactly 12 results. Is there a way to increase that number?
The limit for search results is set here:
ytools/src/cmd/ytools-search/main.go
Line 13 in 5289cdb
Did you compile ytools
yourself? If so, you can simply increase this number and rebuild. You won't be able to get more than ~20 results, though, because that's how many results are available in the loaded HTML. Does that help you?
I usually use ytools
to search for specific videos, instead of browsing through many search results. That's why I didn't bother to implement search result paging or something similar...
So, I cloned the repository, edited src/cmd/ytools-search/main.go
to set max_results
to 15, let's say. Then go get ./...
and make all
. Then I cd to bin
for the newly build binaries, run ./ytools-search test
, and still get exactly 12 results :)
Hmm, that's weird, because it works without a problem for me. Could you delete bin/ytools-search
first, to make sure it's actually built? Are there any errors when you call make all
?
Now, that's indeed weird. Yeah, I tried deleting bin
or make clean
. Same result :).
Here's a full fresh log:
~/Desktop> git clone https://github.com/codesoap/ytools.git && cd ytools/
Cloning into 'ytools'...
remote: Enumerating objects: 273, done.
remote: Counting objects: 100% (273/273), done.
remote: Compressing objects: 100% (155/155), done.
remote: Total 273 (delta 89), reused 258 (delta 74), pack-reused 0
Receiving objects: 100% (273/273), 36.31 KiB | 482.00 KiB/s, done.
Resolving deltas: 100% (89/89), done.
ytools> ed src/cmd/ytools-search/main.go
2418
/const max_results = 12
const max_results = 12
c
const max_results = 15
w
2423
q
ytools> dir
total 8
drwxr-xr-x 8 s 272 May 2 21:58 ./
drwxr-xr-x+ 10 s 340 May 2 21:58 ../
drwxr-xr-x 12 s 408 May 2 21:58 .git/
-rw-r--r-- 1 s 2397 May 2 21:58 README.md
-rw-r--r-- 1 s 1640 May 2 21:58 makefile
drwxr-xr-x 3 s 102 May 2 21:58 man/
drwxr-xr-x 16 s 544 May 2 21:58 porcelain/
drwxr-xr-x 4 s 136 May 2 21:58 src/
ytools> go get ./...
go get: no install location for directory /Users/s/Desktop/ytools/src/cmd/ytools-comments outside GOPATH
For more details see: 'go help gopath'
go get: no install location for directory /Users/s/Desktop/ytools/src/cmd/ytools-info outside GOPATH
For more details see: 'go help gopath'
go get: no install location for directory /Users/s/Desktop/ytools/src/cmd/ytools-pick outside GOPATH
For more details see: 'go help gopath'
go get: no install location for directory /Users/s/Desktop/ytools/src/cmd/ytools-recommend outside GOPATH
For more details see: 'go help gopath'
go get: no install location for directory /Users/s/Desktop/ytools/src/cmd/ytools-search outside GOPATH
For more details see: 'go help gopath'
go get: no install location for directory /Users/s/Desktop/ytools/src/ytools outside GOPATH
For more details see: 'go help gopath'
ytools> make all
go build -o bin/ytools-search github.com/codesoap/ytools/src/cmd/ytools-search
go build -o bin/ytools-pick github.com/codesoap/ytools/src/cmd/ytools-pick
go build -o bin/ytools-info github.com/codesoap/ytools/src/cmd/ytools-info
go build -o bin/ytools-recommend github.com/codesoap/ytools/src/cmd/ytools-recommend
go build -o bin/ytools-comments github.com/codesoap/ytools/src/cmd/ytools-comments
ytools> cd bin
bin> ./ytools-search test
1: Johnny Test LIVE STREAM - The Good, The Bad & The Johnny // Rock-a-bye Johnny
2: What type of person are you really? This pick one personality test will reveal who you truly are
3: Only the Most Attentive 4% Will Pass This Test
4: IELTS LISTENING PRACTICE TEST 2019 WITH ANSWERS | 30.04.2019
5: How To Crash Test A $2 Million Koenigsegg Hypercar - www.APEX.one
6: If You Can Pass This Test, You Have Unique Eyesight. Can You?
7: IELTS LISTENING PRACTICE TEST 2019 WITH ANSWERS | 29.04.2019
8: A Color Test That Can Tell Your Mental Age
9: What's Your True Spirit Animal? Personality Test
10: How Good Are Your Eyes? Cool and Quick Test
11: Seth Rogen and Charlize Theron Take a Lie Detector Test | Vanity Fair
12: The Chemical Brothers - The Test (2003 - Remaster)
:)
Maybe you should do go get ./...
before making the change in src/cmd/ytools-search/main.go
. Could you verify, that your changes are still there by executing head -n 20 src/cmd/ytools-search/main.go
? If it's still there, I'm starting to run out of ideas :/
Maybe you should do
go get ./...
before making the change insrc/cmd/ytools-search/main.go
.
Tried that now. Also, verified that change was there (it sure was). Same result :).
OK, it's not a big deal, of course. Just strange :)
Alright, I'm afraid I can't do much more right now. Could you tell me your operating system? Maybe I'll try to recreate the issue later.
A bit of oldie, OSX 10.8.5 :)
Ok, I'm not sure if I'm going to get my hands on an Apple anytime soon.
I've just gotten one more idea: You didn't clone the project into your go-source directory, like README.md states. Maybe go get ./...
cloned it again and built from there. I'm not sure where the default GOPATH on OSX is, but maybe you can find ytools
here: $HOME/go/src/github.com/codesoap/ytools
?
Damn right you are! Sorry, I don't know much about Go, never thought it could clone the repo into some freshly created dir (not to say that I haven't got any $HOME/go
prior to that).
Now it works, thanks :).
Excellent!