gojiplus / tuber

:sweet_potato: Access YouTube from R
http://gojiplus.github.io/tuber
Other
183 stars 55 forks source link

length of search output not constrained by "max_results" #64

Open ctlamb opened 5 years ago

ctlamb commented 5 years ago

Just a heads up:

search1 <- yt_search(term="drone") nrow(search1) [1] 572

search2 <- yt_search(term="drone",max_results=50) nrow(search2) [1] 572

Also, if there is the length of returned searches always constrained near 500? Some searches that I expect 1000's of hits ("wildlife, or "cats") only seem to produce 450, or 550 results?

soodoku commented 5 years ago

thanks for flagging this. will issue a patch soon.

ctlamb commented 5 years ago

Great thanks.

I have a quick question regarding more complex searches. I get comparable results in Tuber, YouTube API, and on the YouTube GUI when I search a single word. But when I want something more complex ( like “bear AND drone”) the Tuber results are much different (even if I try “bear drone”, “bear and drone”). Can you comment on this?

soodoku commented 5 years ago

When you say YouTube GUI, do you mean searching right on YouTube.com? If so, that is perfectly understandable. Google there is trying to think about user intent and likely has a ML model. In the API, it is generally doing is this phrase there or not. But let's do this step by step.

ctlamb commented 5 years ago

OK thanks for the clarification. Yes I means YouTube.com. That makes sense about the ML model.

But we should expect the Tuber and API results to always be comparable? If I search “bead drone” I should get comparable results in each?

Are Boolean operators allowed? AND, OR?

soodoku commented 5 years ago

Good q. See the API documentation here: https://developers.google.com/youtube/v3/docs/search/list

"Your request can also use the Boolean NOT (-) and OR (|) operators to exclude videos or to find videos that are associated with one of several search terms. For example, to search for videos matching either "boating" or "sailing", set the q parameter value to boating|sailing. Similarly, to search for videos matching either "boating" or "sailing" but not "fishing", set the q parameter value to boating|sailing -fishing. Note that the pipe character must be URL-escaped when it is sent in your API request. The URL-escaped value for the pipe character is %7C."

ctlamb commented 5 years ago

Excellent! This is very helpful. Thanks. Will try when I’m back at my computer and report back. Thanks again.

ctlamb commented 5 years ago

Thanks, this works well. Now what about "&" or "and". I understand from the API documentation I can get boating or sailing with boating|sailing, but what if I want boating and sailing?

With "boating and sailing", the API returns titles with boating (or boat) and sailing in the title. Tuber doesn't seem to, just titles that have one of the words, or none, maybe sailing in the title.

j1wonkim commented 5 years ago

I am wondering about the same thing about "&".