node-google icon indicating copy to clipboard operation
node-google copied to clipboard

Search Videos

Open pokatomnik opened this issue 8 years ago • 3 comments

Very useful module, thank you for it! How can I find videos only? I know that I have to add tbm=vid in GET like a google.requestOptions = { qs : {'tbm' : 'vid'} }; But It is not working.

pokatomnik avatar Apr 04 '16 12:04 pokatomnik

Hi @pokatomnik !

I don't know if you are still interested, but the solution is a little bit silly hahaha

open this file ../node-modules/google/lib/google.js in your app, then change the link in the following line:

var URL = 'https://www.google.%s/search?hl=%s&q=%s&start=%s&sa=N&num=%s&ie=UTF-8&oe=UTF-8&gws_rd=ssl'

Including the type of search that you want to perform in the end of the url like that:

var URL = 'https://www.google.%s/search?hl=%s&q=%s&start=%s&sa=N&num=%s&ie=UTF-8&oe=UTF-8&gws_rd=ssl&tbm=vid'

Here are the codes: For video searches, include: &tbm=vid For News: &tbm=nws (you will have also to change the variable descSel from 'div.s' to 'div.st' in this case)

For Images, Maps and others, I do not know, at least not yet!

Good Luck! :+1:

talysl avatar May 05 '16 14:05 talysl

Thank you, talysl, I've already solved this same way. I was looking for more clear way, I did not want to hack this module. But what done is done. @jprichardson you may close the issue as you need.

pokatomnik avatar May 05 '16 19:05 pokatomnik

@pokatomnik - you have to close the issue since you opened it. Please close it when you can to clear up the issues backlog. Thanks!

knoxcard avatar Oct 04 '18 19:10 knoxcard