Need Help With String Extract Function

Discuss RoboTask here
desception
Posts: 13
Joined: Fri Jan 28, 2011 3:09 pm
Location: United Kingdom

Need Help With String Extract Function

Post by desception »

Hello Oleg,

I have a simple problem, I'm trying to automate a task,
here is an example of what I want to do:

I am trying to copy embed codes from various source types
such as megavideo, myspace, veoh, facebook and more, I
want to insert it into my wordpress "add-new" post area.
Here is an example:

URL: view-source:http://www.animefushigi.com/aria-the-
origination-episode-7

Here is the embed code:

<embed type="application/x-shockwave-flash"
allowfullscreen="true" wmode="transparent" width="100%"
height="450"
src="http://wwwstatic.megavideo.com/mv_player.swf?
image=http://www.animefushigi.com/images/splash-
mega.jpg&v=5DX2KENP" /></embed>

I want to extract only "5DX2KENP" and insert it into my
coding in my wordpress like this:

[megavideo 5DX2KENP]

How can I accomplish this??
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Need Help With String Extract Function

Post by Oleg »

See this example, please.
It extracts the image code from the URL.

BTW: the char "&" is written as "&" in the page code. Therefore this task searches the string between strings:
/images/splash-mega.jpg]&v=
and
"
desception
Posts: 13
Joined: Fri Jan 28, 2011 3:09 pm
Location: United Kingdom

Need Help With String Extract Function

Post by desception »

Hello Oleg,
Thanks for the code, I now have a basic idea of how it works, however I want to know if it's possible for it to automatically grab the entire source and put it in the Set Variable STR function??
If not would I have to manually enter the entire source per page?
Also one other thing, each source type is different and requires different parts of each code to work, how would i go about configuring robotask to know each source type depending on the STR I set?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Need Help With String Extract Function

Post by Oleg »

You can use "Download file" action
It can download HTML page as well as some binary file
Use URL
http://www.animefushigi.com/aria-the-or ... -episode-7
and save it as some TXT or HTML file.

Next, you can use system variable {TextFile(c:\SomeTextFile.txt)} in order to retrieve the text content.
desception
Posts: 13
Joined: Fri Jan 28, 2011 3:09 pm
Location: United Kingdom

Need Help With String Extract Function

Post by desception »

Thanks Oleg, That Worked Great!
I'm having another minor issue with this example:
URL: http://www.animefushigi.com/letter-bee- ... episode-17
This source type is facebook, the code looks like this:
PART 1:
<embed src= "http://static.ak.fbcdn.net/rsrc.php/z4O ... kbs3nb.swf ?thumb_url=http://www.animefushigi.com/images/splash-flb.jpg &video_owner_name=MIHAWK&video_owner_href=http://www .animefushigi.com&highqual_is_on=1&video_src=http:// video.ak.fbcdn.net/cfs-ak-ash1/79097/952/122548787818676_346 13.mp4&video_title=ANIMEFUSHIGI_OWNS&v=1337" width="100%" height="365" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent"></embed>
PART 2:
</center></p><p><center><embed src= "http://static.ak.fbcdn.net/rsrc.php/z4O ... kbs3nb.swf ?thumb_url=http://www.animefushigi.com/images/splash-flb.jpg &video_owner_name=MIHAWK&video_owner_href=http://www .animefushigi.com&highqual_is_on=1&video_src=http:// video.ak.fbcdn.net/cfs-ak-ash1/79139/989/122549054485316_158 16.mp4&video_title=ANIMEFUSHIGI_OWNS&v=1337" width="100%" height="365" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent"></embed>
There are two different variables here, how do I go about entering this in the string?
I want my end result to be:
Part 1 : http://video.ak.fbcdn.net/cfs-ak-ash1/7 ... 2548787818 676_34613.mp4
Part 2: http://video.ak.fbcdn.net/cfs-ak-ash1/7 ... 2549054485 316_15816.mp4
Please help, Thanks :)
desception
Posts: 13
Joined: Fri Jan 28, 2011 3:09 pm
Location: United Kingdom

Need Help With String Extract Function

Post by desception »

Oleg, I was able to improvise on the string to extract both parts! :) Thank you so much for your help, I will be posting again if I have any problems. :)
desception
Posts: 13
Joined: Fri Jan 28, 2011 3:09 pm
Location: United Kingdom

Need Help With String Extract Function

Post by desception »

Hello Again Oleg,

I am still having the same issue with part 1 and part 2 of
a source, sometimes the coding is so similar that it doesn't pickup the second part. How can I grab both
variables without duplicating the first one?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Need Help With String Extract Function

Post by Oleg »

I think that you need create separate task (template) for each site you need.

Regarding to part1 and part1:
you need extract string between
http://video.ak.fbcdn.net/cfs-ak-ash1/
and
.mp4

Suppose you assign the result to MyVar.
So the whole address will be
http://video.ak.fbcdn.net/cfs-ak-ash1/{MyVar}.mp4
Last edited by Oleg on Sun Jan 30, 2011 5:41 am, edited 1 time in total.
desception
Posts: 13
Joined: Fri Jan 28, 2011 3:09 pm
Location: United Kingdom

Need Help With String Extract Function

Post by desception »

Thanks For The Idea, however the problem is the strings chosen change often for example:http://video.ak.fbcdn.net/cfs-ak-ash1/ 


would sometimes change to this:
http://video.l3.fbcdn.net/cfs-ak-ash2/
The Entire URL from http:// to .mp4 changes on a regular, also some sources are from myspace and not facebook. Any other ideas?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Need Help With String Extract Function

Post by Oleg »

This means that you should check both (all possible) variants.
Post Reply