How can I retrieve first youtube url from google video search results? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
my-lord
Posts: 45
Joined: 01 Apr 2018, 15:12

How can I retrieve first youtube url from google video search results?

19 Apr 2018, 05:24

I want to retrieve the first URL from google video search results.
I can do it with Java in the following way:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


But I don't know how can I retrieve the first youtube URL from google video search results in AutoHotkey.
User avatar
tank
Posts: 2328
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY
Contact:

Re: How can I retrieve first youtube url from google video search results?  Topic is solved

19 Apr 2018, 09:50

Code: [Select all] [Download] GeSHi © Codebox Plus

search := "jolene"
google := "https://www.google.com/search?tbm=vid&hl=en-TR&source=hp&biw=&bih=&q="
(pwb := ComObjCreate("InternetExplorer.Application")).Visible:=True
pwb.navigate(google search)
while pwb.busy
sleep 15
msgbox % pwb.document.querySelectorAll("#ires a")[0].href
pwb.quit()
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
my-lord
Posts: 45
Joined: 01 Apr 2018, 15:12

Re: How can I retrieve first youtube url from google video search results?

21 Apr 2018, 07:22

tank wrote:

Code: [Select all] [Download] GeSHi © Codebox Plus

search := "jolene"
google := "https://www.google.com/search?tbm=vid&hl=en-TR&source=hp&biw=&bih=&q="
(pwb := ComObjCreate("InternetExplorer.Application")).Visible:=True
pwb.navigate(google search)
while pwb.busy
sleep 15
msgbox % pwb.document.querySelectorAll("#ires a")[0].href
pwb.quit()

Thanks.But my script ended with a wrong URL on my browser "http://%22https//www.google.com/search?tbm... "
I tried to fix with StrReplace function like this but It didn't work.
pwb.navigate(StrReplace(google,"http://%22",""))
How can I fix that?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

swagfag
Posts: 1084
Joined: 11 Jan 2017, 17:59

Re: How can I retrieve first youtube url from google video search results?

21 Apr 2018, 08:28

unlearn traditional syntax

Code: [Select all] [Download] GeSHi © Codebox Plus

google := "https://www.google.com/search?tbm=vid&hl=en-TR&source=hp&biw=&bih=&q=" . Clipboard
my-lord
Posts: 45
Joined: 01 Apr 2018, 15:12

Re: How can I retrieve first youtube url from google video search results?

21 Apr 2018, 08:46

swagfag wrote:unlearn traditional syntax

Code: [Select all] [Download] GeSHi © Codebox Plus

google := "https://www.google.com/search?tbm=vid&hl=en-TR&source=hp&biw=&bih=&q=" . Clipboard

Thanks,It works :superhappy:

Return to “Ask For Help”

Who is online

Users browsing this forum: FidoGooL, kirby, scriptors and 58 guests