Help needed - URL parsing in the address bar of Firefox

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
imacronewbie
Posts: 3
Joined: Sat Dec 14, 2013 11:11 am

Help needed - URL parsing in the address bar of Firefox

Post by imacronewbie » Sat Dec 14, 2013 4:13 pm

Hello Experts of this forum!

Thank You all for providing and attempting to provide solutions for the various problems raised in this thread - iMacros for Firefox.

I am very new to iMacros and wish to use it extensively.

Before getting started, I would like the Experts here to provide a solution for a simple problem I face:

A proxy website I visit always attaches some random characters in the address bar, while visiting the actual url.

Here is the url displayed:

Code: Select all

http://www.PROXYSITE.com/GO/ABC123/www.example.com/thePage.html/XYZ456
In the above, I wish to get rid of all of the " http://www.PROXYSITE.com/GO/ABC123/ " part as well as the " /XYZ456 " part, so that I am left only with the pure url www.example.com/thePage.html

Thanks to user srawcliffe's post at http://forum.imacros.net/viewtopic.php?f=11&t=7084 , I was able to get rid of the " /XYZ456 " part by using the code newurl = oldurl.replace("/XYZ456", " "); in the lsfre.js macro on the given example at http://forum.imacros.net/viewtopic.php?f=11&t=7084 ..

Using the same logic, I would like to get rid of the " http://www.PROXYSITE.com/GO/ABC123/ " part too.

My question is, how to accomplish it?

Please note the ' ABC123 ' is the only part that is different for every site loaded (along with, of course, the /www.example.com/thePage.html part) while the 3 other parts viz., http://www.PROXYSITE.com, /GO/ and XYZ456 remain the same across all sites visited.

The solution is probably very simple; only thing is I am unaware of the exact syntax, etc. to proceed, because I came across iMacros just 2 days back, and am yet to go through the knowledgebase, tutorials, etc.

Since the problem is somewhat of a little urgent nature, I am posting the question here before I begin study about iMacros.

My Other details:

VERSION BUILD=8601111 RECORDER=FX

Windows 7

Mozilla Firefox v26.0

Any suggestion on the same would be highly appreciated, especially if you can give the full line(s) of code. :mrgreen:

Thanks in advance!
chivracq
Posts: 8720
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Help needed - URL parsing in the address bar of Firefox

Post by chivracq » Sat Dec 14, 2013 8:45 pm

Congratulations on the way you posted your Question with all required Info and what you tried and where you got stuck...

The Solution you found from the Thread you mentioned is from 2009 and the same Result could be now more easily achieved using EVAL (which was not available in 2009) within one single .iim Macro. (So no need for a .js Script calling several .iim Macros and handling the JavaScript Computing in the .js Script...)

You will find a thorough Example in this Thread (both for the first and the second part of your Question...):
http://forum.imacros.net/viewtopic.php?f= ... 861#p55746
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
imacronewbie
Posts: 3
Joined: Sat Dec 14, 2013 11:11 am

Re: Help needed - URL parsing in the address bar of Firefox

Post by imacronewbie » Sun Dec 15, 2013 1:33 am

Thank You chivracq for your quick answer.

However, being very new to iMacros, I am yet to take time to understand those codes.

On a test run, I find that the code outputs 2 message boxes.

However, what I require is, after running my query, I NEED TO BE TAKEN to my url " http://www.example.com/thePage.html " [ using probably " url goto ={{finalurl}} " ] . (sorry I didn't mention this in my earlier post - thinking the codes were self-explanatory.)

Since the problem is somewhat of a little urgent nature, I am posting the question here before I begin study about iMacros.

Am I asking too much when I say " ...especially if you can give the full line(s) of code " ? I was expecting a solution similar to what srawcliffe has posted at http://forum.imacros.net/viewtopic.php?f=11&t=7084 ....

That single post has been very useful for me after 4 years; similarly your precise answer could be useful to someone in the future too! :wink:

Thanks!
User avatar
bobis
Posts: 364
Joined: Sat Sep 11, 2010 3:34 pm
Contact:

Re: Help needed - URL parsing in the address bar of Firefox

Post by bobis » Sun Dec 15, 2013 6:21 pm

try this:

Code: Select all

var oldurl="http://www.PROXYSITE.com/GO/ABC123/www.example.com/thePage.html";
var newurl2 = oldurl.replace("http://www.PROXYSITE.com/GO/","");
var index=newurl2.indexOf("/"); 
newurl2 = newurl2.substring(index+1);
Get Best iMacros scripts at http://imacrosbot.com/
imacronewbie
Posts: 3
Joined: Sat Dec 14, 2013 11:11 am

Re: Help needed - URL parsing in the address bar of Firefox

Post by imacronewbie » Sun Dec 15, 2013 7:40 pm

Thank You bobis for your code.

I had stated "Since the problem is somewhat of a little urgent nature...." in both my above posts, and since I could not get a reply on my expected time (probably due to weekend), I had to look for alternative solution.

I am glad I have found one that works exceptionally well for my needs.

For anyone who is interested, it is the bookmarklet found at urlparser dot com slash bookmarklet . Combined with the 'Text Link' extension for firefox which I was already using, it is almost THE solution I was looking for. (I just had to enable another option for the context menu in its settings.)

Thanks for all who replied and who thought of replying.

(I didn't try the above code by bobis because of the above reason, however I think it may not work, considering the value of " ABC123 " is different in every url visited. Excuse me if I am wrong, my knowledge on the same is extremely limited. Any member is free to comment on its validity - so that it might be useful for the others.)
chivracq
Posts: 8720
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Help needed - URL parsing in the address bar of Firefox

Post by chivracq » Mon Dec 16, 2013 2:00 am

Interesting Add-on this URL-Parser that you mentioned, I just installed it on Firefox (had to disable 'extensions.checkCompatibility' because last Version, obviously not compatible with FF26, thanks to https://addons.mozilla.org/en-US/firefo ... atibility/) and glad you found a Solution that is working...

Hope you'll be using iMacros anyway (great for automating any Tasks on Web-Sites) and that you'll come back on the Forum because I quite liked your clever and creative way of tackling a "problem"...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
abassihedi
Posts: 4
Joined: Mon Oct 12, 2015 11:40 pm
Contact:

Re: Help needed - URL parsing in the address bar of Firefox

Post by abassihedi » Mon Oct 12, 2015 11:44 pm

Blackwaleed is a free proxy site, enabling you to bypass internet restrictions imposed by censorship and unblock access the whole internet anonymously and securely.
Post Reply