Sign in to follow this  
Followers 0
shEiD

InetGet without filename

6 posts in this topic

#1 ·  Posted (edited)

I want to download files from RSS feed.

If I use InetGet I need to define a filename, but I want to define ONLY the directory where to put the files, as I want them to keep the "source" names. How do I do that? I tried defining only directory - doesn't work :(

Edited by shEiD

Share this post


Link to post
Share on other sites



As far as I know there is no build in functionality, but to use Inetget you have to know the filename. You can look for the last "/" in the url and whatever is to the right of that is the filename.

Something like this:

$url = "http://www.test.com/folder/subfolder/filename.jpg" ;source
$folder = "C:\somefolder\" ;destination folder
InetGet($url,$folder & StringTrimLeft($url,StringInStr($url,"/",Default,-1))) ;stringinstr finds the last "/". Stringtrimleft trims all but the filename.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

That would be the obvious solution, but the problem is, the links are in php format, ie: "http://site.com/download.php?id=..."

There is no filename in the link :/

Edited by shEiD

Share this post


Link to post
Share on other sites

That would be the obvious solution, but the problem is, the links are in php format, ie: "http://site.com/download.php?id=..."

There is no filename in the link :/

Is there a filename on the site? maybe use _inetgetsource to retrieve the filename & then use inetget to download.?

Cant you simply save the files as 001.jpg or 002.pdf etc ? Or you need filenames from server?


My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

Is there a filename on the site? maybe use _inetgetsource to retrieve the filename & then use inetget to download.?

Cant you simply save the files as 001.jpg or 002.pdf etc ? Or you need filenames from server?

Like I said before, there is NO filename in the link/source.

It is a RSS feed of nzb files from NZBMatrix. The links to files are in the format:

I have replaced my API key with ***:

<item>
    <title>Breaking Bad S03E04 720p WEB DL DD5 1 H 264 RTARHD</title>
    <guid>http://nzbmatrix.com/api-nzb-download.php?id=620895&amp;username=shEiD&amp;apikey=**********</guid>
    <link>http://nzbmatrix.com/api-nzb-download.php?id=620895&amp;username=shEiD&amp;apikey=**********</link>
    <description><![CDATA[<b>Name:</b> Breaking Bad S03E04 720p WEB DL DD5 1 H 264 RTARHD<br /><b>Category:</b> TV: HD<br /><b>Size:</b> 1561.46MB<br /><b>Added:</b> 2010-04-16 05:32:49]]></description>
    <category>TV: HD</category>
    <cattext>tv.hd</cattext>
    <categoryid>41</categoryid>
    <enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=620895&amp;username=shEiD&amp;apikey=**********" length="1637309480" type="application/x-nzb" />
</item>
<item>
    <title>Justified S01E05 The Lord of War and Thunder 720p WEB DL DD5 1 h 264 EbP</title>
    <guid>http://nzbmatrix.com/api-nzb-download.php?id=620894&amp;username=shEiD&amp;apikey=**********</guid>
    <link>http://nzbmatrix.com/api-nzb-download.php?id=620894&amp;username=shEiD&amp;apikey=**********</link>
    <description><![CDATA[<b>Name:</b> Justified S01E05 The Lord of War and Thunder 720p WEB DL DD5 1 h 264 EbP<br /><b>Category:</b> TV: HD<br /><b>Size:</b> 1516.32MB<br /><b>Added:</b> 2010-04-16 05:31:44]]></description>
    <category>TV: HD</category>
    <cattext>tv.hd</cattext>
    <categoryid>41</categoryid>
    <enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=620894&amp;username=shEiD&amp;apikey=**********" length="1589976760" type="application/x-nzb" />
</item>
<item>
    <title>V 2009 S01E07 John May 720p WEB DL DD5 1 h 264 TjHD</title>
    <guid>http://nzbmatrix.com/api-nzb-download.php?id=620892&amp;username=shEiD&amp;apikey=**********</guid>
    <link>http://nzbmatrix.com/api-nzb-download.php?id=620892&amp;username=shEiD&amp;apikey=**********</link>
    <description><![CDATA[<b>Name:</b> V 2009 S01E07 John May 720p WEB DL DD5 1 h 264 TjHD<br /><b>Category:</b> TV: HD<br /><b>Size:</b> 1707.47MB<br /><b>Added:</b> 2010-04-16 05:30:52]]></description>
    <category>TV: HD</category>
    <cattext>tv.hd</cattext>
    <categoryid>41</categoryid>
    <enclosure url="http://nzbmatrix.com/api-nzb-download.php?id=620892&amp;username=shEiD&amp;apikey=**********" length="1790412062" type="application/x-nzb" />
</item>

Yes, I know, there are "titles" that I could use as a file name, but I can't do that. The main reason I'm writing this script is that I need to download the files with their source names (scene names), and the way to do this is using the api. I can't use the names in the feed and then manipulate/replace/whatever strings, as some files have group names, some don't and there is no reliable way to sort this out and it is pointless, as API provides a switch "&scenename=1" which I add to the end of url and I get a file in it's proper scene name format.

The problem is how do I use InetGet() without knowing filename before hand? Is there another way? Pardon my ignorance in general programming, but any web browser or any rss addon in torrent clients or in my case AltBinz rss handler can download files somehow and save them with their "source" name. That is what I want to do: simply set the download folder and save files with their "source" names in it.

Share this post


Link to post
Share on other sites

Would like to ask again, could anyone, please, at least tell me the direction in which I should look for a solution to this?

I have no programming knowledge accept some autoit scripting. I tried googling for hours and hours and it gave me nothing, coz I pretty much have no idea what I'm looking for. All I understand is, that it's obviously possible to get the file info from the server, as browsers always get source file name and location, when they ask you where you want to save the downloaded file. But how do they communicate this information and how to do it in AutoIt or maybe using some other tool, I have no idea.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0