Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Link in Web Browser
#1
If i open up my Youtube account and start the QM Web Browser..
can QM click the links in my account?

And if so, how can i click all links like that with qm browser?

Code:
Copy      Help
<a id="video-from-username-BBOHOXNXhE4" onmousedown="" href="/user/user1234">user1234</a>

(user1234 is any username)
#2
In web browser control? To find and click links, you can use html element functions. The same as with Internet Explorer.
#3
I tried the following..

But there are errors wich i dont understand, because i used QM help to build the code.

Function Friendfinder
Code:
Copy      Help
str html
IntGetFile("http://www.youtube.com/results?search_query=handy&suggested_categories=28%2C24%2C1%2C23%2C26&page=2" html)

str videofromuser
str pattern="<a id="video-from-username(.*)>.*<\/\1>"
ARRAY(str) a
findrx (html pattern 0 4 a)
int i
for(i 0 a.len)
,out "submatch=%s, whole=%s" a[1 i] a[0 i]
#4
I see these errors:

1. " not escaped in pattern string.
2. Space before function name and (.

Macro Macro1438
Code:
Copy      Help
str html
IntGetFile("http://www.youtube.com/results?search_query=handy&suggested_categories=28%2C24%2C1%2C23%2C26&page=2" html)

str videofromuser
str pattern="<a id=''video-from-username(.*)>.*<\/\1>"
ARRAY(str) a
findrx(html pattern 0 4 a)
int i
for(i 0 a.len)
,out "submatch=%s, whole=%s" a[1 i] a[0 i]

3. The regular expression may not work. Not sure.
#5
Thanks Gin!

Shouldnt this code show all Links when i type "out a" on the end of the script?
It says nothing.. :?:

Even with "out i" it says only 0.
#6
Change regular expression.

Macro Macro1438
Code:
Copy      Help
;out
str html
IntGetFile("http://www.youtube.com/results?search_query=handy&suggested_categories=28%2C24%2C1%2C23%2C26&page=2" html)
;out html; ret

str videofromuser
str pattern="<a id=''video-from-username(.*?)>"
ARRAY(str) a
if(!findrx(html pattern 0 4 a)) out "not found"; ret
int i
for(i 0 a.len)
,out "submatch=%s, whole=%s" a[1 i] a[0 i]
#7
That almost works!

Is the pattern wrong, or why cant i extract a complete link?

To klick the link (when it works) i use this one:

Code:
Copy      Help
Htm el=htm("LINK" "id" "" "Quick Macros" 0 0 0x221)
el.Click
And id is the Tag of the link. Web Browser is QM :?:
#8
It extracts links.

submatch=-9DXv8qnr8nI" onmousedown="" href="/user/samsontech", whole=<a id="video-from-username-9DXv8qnr8nI" onmousedown="" href="/user/samsontech">
submatch=-DL4s6YdBXzI" onmousedown="" href="/user/s2pandapple", whole=<a id="video-from-username-DL4s6YdBXzI" onmousedown="" href="/user/s2pandapple">
submatch=-alLJUlO7IOc" onmousedown="" href="/user/fobohem", whole=<a id="video-from-username-alLJUlO7IOc" onmousedown="" href="/user/fobohem">
submatch=-14A32E7AE17A4001" onmousedown="" href="/user/manko1989", whole=<a id="video-from-username-14A32E7AE17A4001" onmousedown="" href="/user/manko1989">
submatch=-VVfiyjVBass" onmousedown="" href="/user/SirAnaxagoras", whole=<a id="video-from-username-VVfiyjVBass" onmousedown="" href="/user/SirAnaxagoras">
submatch=-oVkV6UKl7Mw" onmousedown="" href="/user/gshoes04", whole=<a id="video-from-username-oVkV6UKl7Mw" onmousedown="" href="/user/gshoes04">
submatch=-vb3wiRanBpc" onmousedown="" href="/user/RandomDCE", whole=<a id="video-from-username-vb3wiRanBpc" onmousedown="" href="/user/RandomDCE">
submatch=-kLToDBvHTWQ" onmousedown="" href="/user/s2pandapple", whole=<a id="video-from-username-kLToDBvHTWQ" onmousedown="" href="/user/s2pandapple">
submatch=-2EfHhYt_jV8" onmousedown="" href="/user/RoosterTeeth", whole=<a id="video-from-username-2EfHhYt_jV8" onmousedown="" href="/user/RoosterTeeth">
submatch=-p1rH0fFiD4U" onmousedown="" href="/user/WorksLikeThis", whole=<a id="video-from-username-p1rH0fFiD4U" onmousedown="" href="/user/WorksLikeThis">
submatch=-w4D6cHLRLUk" onmousedown="" href="/user/mattthebrat89", whole=<a id="video-from-username-w4D6cHLRLUk" onmousedown="" href="/user/mattthebrat89">
submatch=-Z7kg1yZ1pPY" onmousedown="" href="/user/CmereNoStay", whole=<a id="video-from-username-Z7kg1yZ1pPY" onmousedown="" href="/user/CmereNoStay">
submatch=-3AqnmXVzx9k" onmousedown="" href="/user/maximotv", whole=<a id="video-from-username-3AqnmXVzx9k" onmousedown="" href="/user/maximotv">
submatch=-0hcwECtoZ6U" onmousedown="" href="/user/jacksfilms", whole=<a id="video-from-username-0hcwECtoZ6U" onmousedown="" href="/user/jacksfilms">
submatch=-viNmZK5WERU" onmousedown="" href="/user/SomethingGood", whole=<a id="video-from-username-viNmZK5WERU" onmousedown="" href="/user/SomethingGood">
submatch=-g-hEZ_oefLE" onmousedown="" href="/user/RandomDCE", whole=<a id="video-from-username-g-hEZ_oefLE" onmousedown="" href="/user/RandomDCE">
submatch=-tKYE7nUoMOE" onmousedown="" href="/user/4BetaMale2", whole=<a id="video-from-username-tKYE7nUoMOE" onmousedown="" href="/user/4BetaMale2">
submatch=-OE0xAayzCRM" onmousedown="" href="/user/CmereNoStay", whole=<a id="video-from-username-OE0xAayzCRM" onmousedown="" href="/user/CmereNoStay">
submatch=-oTxeI1P6mB8" onmousedown="" href="/user/RandomDCE", whole=<a id="video-from-username-oTxeI1P6mB8" onmousedown="" href="/user/RandomDCE">
submatch=--ECaWMY19pQ" onmousedown="" href="/user/TheProductTester", whole=<a id="video-from-username--ECaWMY19pQ" onmousedown="" href="/user/TheProductTester">
submatch=-wMB-ohgtVag" onmousedown="" href="/user/GunniZ", whole=<a id="video-from-username-wMB-ohgtVag" onmousedown="" href="/user/GunniZ">
submatch=-4F59E623A0B9A4C6" onmousedown="" href="/user/Huongii22", whole=<a id="video-from-username-4F59E623A0B9A4C6" onmousedown="" href="/user/Huongii22">
#9
Yes, you are right, but how can i extract the information as it stands in "whole=" ?
when i only output whole i dont get a complete link.

Maybe i need to ask otherwise:

How can i click these links now? :lol:
#10
Macro Macro1438
Code:
Copy      Help
out
str html
IntGetFile("http://www.youtube.com/results?search_query=handy&suggested_categories=28%2C24%2C1%2C23%2C26&page=2" html)
;out html; ret

str videofromuser
str pattern="<a id=''video-from-username-.+? href=''(.*?)''>"
ARRAY(str) a
if(!findrx(html pattern 0 4 a)) out "not found"; ret
int i
for(i 0 a.len)
,str url.from("http://www.youtube.com" a[1 i])
,out url
,;now IntGetFile(url html) or HtmlDoc hd.InitFromWeb(url)
#11
Thank you for the support Gintaras! Smile

I hope to learn QM within the next weeks.
Then i dont need to ask every day. :lol:
#12
Is this link convertet correctly?

Macro 919274632
Code:
Copy      Help
"<a href=''#'' onclick=''add_friend((.*?)); return false;''>Als Freund hinzufügen</a>"

Before this link looked like this:
Code:
Copy      Help
<a href="#" onclick="add_friend('username123'); return false;">Als Freund hinzufügen</a>
#13
If it is used as regular expression, need to escape special characters of regular expressions.
These characters are () and maybe #. Nothing wrong if you escape all nonalphanumeric characters.
To escape a character, add \ before.
\(
\)
\#
#14
Yes, i want to use it in a expression

I think i understand now.
Macro 9435623
Code:
Copy      Help
"<a href=''\#'' onclick=''add_friend\(.*?\); return false;''>Als Freund hinzufügen</a>"

So this should work now?
And the .*? is a wildcard that can contain any string? Or is this a special kind of wildcard?
#15
I think you should read about regular expressions in QM help. Also you can use floating toolbar -> more tools -> reg expr menu.


Forum Jump:


Users browsing this thread: 1 Guest(s)