Presentation Screenshots Download Support Development Forum    
   

Welcome to the Community Forum.

Here you can discuss with other users or with the author, suggest new features, report bugs, ask for filters creation or correction, etc. Select the forum you wish to read or post below :

Forum
Forum > Filters repository > Filter based on Url parameter

Pages : [1] 2 3 Add a reply
User info Filter based on Url parameter
hiteshsathawane
Avatar
Jan 30 2012, 6:31 pm

I have few documents on some server and I can download those by passing the URL mentioned below in the Firefox browser.
All the documents which are downloaded from server are of name “getdocstrem” without any extension

http://abc.com/xyz/servlet/getdoc?docExt=tif&Option=DocView&PageNo=1&DocId=176361668

I want to automatically create a folder with name “DocId=176361668” or “176361668” and save the document in it.
Please help me what filter expression I should use in domain and folder path so that I can achieve it.

Regards
Hitesh
Post #1
Edit
Cyan
Avatar
Jan 31 2012, 9:40 am
Hello,

I'm sorry, it's a lot of text, but please take the time to read it.

If you want the filter without reading, check the bottom of my post.
Though, it might not work on your fist try.

=======

First of all, there might be some restrictions to make this filter works.


I don't know how to access the clicked element on the page to get all the link's informations myself, I'm using the data provided by the save dialog (the "What Firefox should do with this file?").

This dialog provide the real file's URL (where it's hosted) and not the link's text string.


So, to make a filter based on a redirection script (?getfile_id=xxxxx), you have two choices:

1 - Use right-click to save the file (right-click with ASF have a problem finding the real link. It's a bug you can take advantage of)
2 - Reload that link in a new tab (for example middle-click the link to open it in a new tab) and quickly switch to that tab.
3 - Copy paste the link in a new tab manually.


=============

You can check the difference with single-click and left-click in the Console window (Ctrl+Shift+J).
When you download a file, you have the link it's using to check the downloaded file against the filters.

Example with downloading one of ASF add-on from the download page:

Quote : Single-click
Automatic Save Folder :
These data will be used to verify the filters :
Filename: automatic_save_folder-1.0.4.xpi
Domain test order: 1,5,3
1 - File's domain: http://asf.mangaheart.org
2 - File's URL: http://asf.mangaheart.org/xpi/
3 - Full file's URL: http://asf.mangaheart.org/xpi/automatic_save_folder-1.0.4.xpi
4 - Tab's domain: http://asf.mangaheart.org
5 - Tab's URL: http://asf.mangaheart.org/?menu=2&sub=1


Quote : Right-Click
Automatic Save Folder :
These data will be used to verify the filters :
Filename: download.php
Domain test order: 1,5,3
1 - File's domain: http://asf.mangaheart.org
2 - File's URL: http://asf.mangaheart.org/
3 - Full file's URL: http://asf.mangaheart.org/download.php?id=35
4 - Tab's domain: http://asf.mangaheart.org
5 - Tab's URL: http://asf.mangaheart.org/?menu=2&sub=1


Like you see, the domain type 3 is the one you want to use, but it's only available on right-clicking.

You can choose to always use right-click and Domain type 3, or copy-paste the link to a new tab and use Domain Type 5.

==========

Making the filter:

First, go into the settings > options > page 2 > verify that you have "1,5" or "1,3" or "1,3,5" in the domain checking type. The domain type you want to use should be present.



If this is your only website with "DocId=" in the URL, you can make a filter based on the presence of this string.

This will find any link containing DocId=
.*DocId=.*$

To add a capture for a number located after docID=, you add parentheses around it:
.*DocId=(1234567).*$

You can tell the filter to use any number string by using "\d"
.*DocId=(\d+).*$

\d+ = at least 1 number, no maximum.
\d* = 0 to infinite numbers
\d{5,8} = 5 to 8 numbers.


Filters Domain
All    
= Regexp.
File name
All    
= Regexp.
Local folder


You can add DocId in the local path:
D:\download\DocId$1d\
if will save into "D:\download\DocId1234567"



======

I hope to find a way to get the clicked element on the page by myself, it will allow more flexible filters.
Post #2
Edit
hiteshsathawane
Avatar
Feb 2 2012, 2:33 pm
Hi Thankyou verymuch for reply.

I could Identify the url of the image is
http://abc.com/xyz/servlet/getdoc?docExt=tif&Option=DocView&PageNo=1&DocId=176361668
As the image is generated internally by the website depending on parameters.
I tryied keeping various combination of Domain test order: 1,5,3

I used

Domain filter .*DocId=(\d+).*$
File Fileter All
and folder location D:\download\$1d\




The document is getting downloaded to last saved location.

I am not able to trace out what is going wrong
please help me it is urgent
Post #3
Edit
Cyan
Avatar
Feb 2 2012, 6:27 pm
Hi :)


I'm not sure if you used the correct filter or not, because in your screenshot the filter is wrong.


You used * in parentheses, but * means "all characters" only if you don't use regular expression.

While using regular expression, "all characters" is .* (you forgot the dot).

so you should use this filter:
.*DocId=(.*)$


Do not use (.*).*$
You won't get an error, but it's making two times the same thing: the first (.*) will capture everything up to the end, so the second .* is unnecessary.



I'm more familiar with regular expression, but I guess you can create your filter without using the regular expression:

Filters Domain
All    
= Regexp.
File name
All    
= Regexp.
Local folder


That's all. This one should work.
Post #4
Edit
hiteshsathawane
Avatar
Feb 2 2012, 7:28 pm
Thanks for quick reply.

I dont know what mistake I am making but even after following the steps mentioned my document bypases the filter. the filter doesnot seems to work. Is it a issue with version of firefox. I am using firefox 3.6.
It seems that domain filter fails to filter domain url as the document is saved in path "if filter doesnot match" folder.

Your help would be verymuch appreciated.

Regards
Hitesh S Sathawane


Post #5
Edit
Cyan
Avatar
Feb 3 2012, 8:46 am
Hi,

Firefox 3.6 should work fine.
I didn't change anything important since 3.5.

I don't understand why it's not working.

You said it's a generated image, so I guess you are downloading it only with right-click>save image as...
Be sure you have enabled both options related to right-click in options page1.



First, try to make the filter without capturing anything.
Put only DocId in the domain field and see if the filter is triggered and the folder changed.



Did you check the downloaded informations in the console?

If it's still not working, could you copy/paste here the ASF logs?
The one with domain info, and the one relevant to your download for matching/not matching filters.



Edit:
Could you make a second filter, and place it at the top?
Maybe there's a bug if there is only one filter.

There were a bug once, but I think I fixed it already.
Post #6
Edit
hiteshsathawane
Avatar
Feb 3 2012, 5:10 pm
Hi Greetings,

Thanks again for the reply

I will provide you exact url that I hit in browser
http://192.9.200.217/omnidocs/servlet/getdocstream?ImgCabinetName=HUTCHMUM&JtsIpAdd=10.87.129.70&JtsPort=3333&VolId=31&SiteId=3&ImageId=3421678&docExt=tif&Option=DocView&PageNo=1&FolderId=55143203&DocId=176361668

This is a intranet url, this is giving me the document to download. I do not right click and perform any sort of Manuel action to download the document after hitting the url

It seems that putting just DocId in filter do not save my document in different path, I guess it means the filter is not getting triggered.
I try to follow the steps with 2nd filter also it did not work.

Can you let me know where I can find ASF logs so that I can share it to you through email.



Also can I close the tab after the download is complete using ASF.


Regards
Hitesh Sathawane
Post #7
Edit
Cyan
Avatar
Feb 4 2012, 10:48 am
You can close the empty tab manually after the file is downloaded.
ASF is not closing it for you, ASF has no background process. ASF is only run before the file browser is opened, and before the file is saved. It's used to change the saved path before Firefox start saving the file.


Are you copy-pasting in a new tab, or using middle-click to open the new tab?
ASF is checking the currently displayed tab's URL, so you need to be on the correct tab for the filter to work.
(I wish I could find all the URL from the link, and not depends on firefox's elements)


I thought you used right-click because you said it was a generated picture.
The picture can't be downloaded when clicking on them, you need to select "save image as...".
But maybe the picture is not displayed on the webpage, it's only created and downloaded when you click the link.


The logs are displayed in the console window. access it by going to:
tools/developer tools/error console (or Ctrl+Shift+J)

Clean the current console's log just before downloading your file, and you will see what ASF will use as URL, and which filter it finds, if no filter is found it will tell you so.
You need to copy/paste each line one by one.



What I would like to see is the differences with both single-click and right-click methods (like I show you on my previous post), and see if it says "no filter matched" or if there's an error.

Then, see which number can be used by ASF, and use that number in the "domain test order" input field.
If you are not sure, you can place all domain type "1,2,3,4,5" to check them all.


I'm sorry the filter didn't work for you on the first try :(
It should be easy to create a filter by looking at the log.
Maybe I should make a tutorial.
Post #8
Edit
hiteshsathawane
Avatar
Feb 4 2012, 1:37 pm
Hi,

Thanks for the precious reply.

I do not right click or use mouse middle button. I simply login to the server and open a new tab , then i paste this URL http://192.9.200.217/omnidocs/servlet/getdocstream?ImgCabinetName=HUTCHMUM&JtsIpAdd=10.87.129.70&JtsPort=3333&VolId=31&SiteId=3&ImageId=3421678&docExt=tif&Option=DocView&PageNo=1&FolderId=55143203&DocId=176361668 , This downloads me a document named "getdocstream" without any extension.
when i right click on downloads to find URL of the document it is same as given above.

Following are the logs

Automatic Save Folder :
These data will be used to verify the filters :
Filename: getdocstream
Domain test order: 1,2,3,4,5
1 - File's domain: http://192.9.200.217
2 - File's URL: http://192.9.200.217/omnidocs/servlet/
3 - Full file's URL: http://192.9.200.217/omnidocs/servlet/getdocstream
4 - Tab's domain: http://192.9.200.217
5 - Tab's URL: http://192.9.200.217/omnidocs/servlet/


Automatic Save Folder :
No filter matched both domain and filename. These data will be used instead :
Folder: C:\kolkatta_omnidocs\Export\
%asf_d%: 192.9.200.217
%asf_f%: getdocstream


Following are the errors

Error: dialog is null
Source File: file:///C:/Program%20Files%20(x86)/Mozilla%20Firefox/components/nsHelperAppDlg.js
Line: 505

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface]" nsresult: "0x80004002 (NS_NOINTERFACE)" location: "JS frame :: file:///C:/Program%20Files%20(x86)/Mozilla%20Firefox/extensions/ietab@ip.cn/components/nsIeTabWatchFactory.js :: anonymous :: line 216" data: no]

I am bit confused about and connot understand this error.


Post #9
Edit
Cyan
Avatar
Feb 4 2012, 9:32 pm
Thank you for the log :)


So, first :
The error you found in the log is not caused by my Addon, it's related to IEtab add-on.


Now, about your filter:
Like you see, when you download, ASF is using this values to check your filter :

1 - File's domain: http://192.9.200.217
2 - File's URL: http://192.9.200.217/omnidocs/servlet/
3 - Full file's URL: http://192.9.200.217/omnidocs/servlet/getdocstream
4 - Tab's domain: http://192.9.200.217
5 - Tab's URL: http://192.9.200.217/omnidocs/servlet/


It seems there's a problem with reading the Tab's URL content.
The "5" is like "2". It shouldn't be like that.
Maybe I have an error in my add-on, let me verify the source code.


Edit:
I think I know the problem.

Could you try version 1.0.2? (but it's not working on Firefox 7.0.1+)
I changed the way the Tab's URL content is read just after V1.0.2
I'm now using the official way to read a tab's value, but it seems Firefox is not sending the correct data.

I'll put back my old method to fix it.



Edit2:
Well, maybe it won't work either :/
I'll have to check why it's not working correctly with tab's content.
Pasting an URL in a new tab it still considered "about:blank" because there's no content loaded in the webpage.

I'm sorry it's not working for you :(


In the meantime, if you want to sort the files in multiple folders to prevent overwriting the existing files always named "getdoctream", you can make a filter to create a sub-folder based on the date and time.
Post #10
Edit
Pages : [1] 2 3 Add a reply

Return to top