Can't download and save srt file using DownloadFile - vb.net

I want to download a srt (subtitles) file from subtitles4free.net but I can't understand how I am supposed to do it.
I tried downloading it using
My.Computer.Network.DownloadFile("http://www.getsubtitle.com/webService/download_subtitle.php?cod_bsplayer=38187011&post_date=11-06-2015", "C:\Users\User1\Downloads\subs.srt")
but the file that gets downloaded is a srt file containing some weird text, probably because it has to be a direct download url with a file extension. Is there any way to get this to work and if not, is there any other way of doing this?

The file format you are downloading is ZIP, not SRT. Save it as a .zip file. Extract it and you'll get the .srt file.

Related

How to check if a file is in a zip file before uploading to a webpage

I'm using TypeScript to write an upload utility. Basically, it's just a div listening for a drop event.
Uploading uncompressed files or zip files works fine, but when a user drags and drops a file from within a zip file to my upload area, the uploaded file is corrupted (i.e. not decompressed).
Is there a way to determine if the file to be uploaded resides in a zip file? It would be nice to perform a check in my drop event before executing the actual upload. I can't find anything in the dataTransfer object.

Dropzone with struts to upload files

With struts, the uploaded files will be saved as tmp first, how to guarantee the uploaded files are in sequence, since I have to save them with the original file names?

I cannot install PhpWord Yii

I have tried to install PhpWord to yii. I have downloaded zip file and extracted it into extentions folder:
extenstions
--PHPWord
--PHPWord.php
However, I cannot make it to run. I got following error:
include(PHPWord.php): failed to open stream: No such file or directory
How can i solve it?
After extracting the file in extension folder, you have to import that file in controller.
Yii::import('ext.phpword.PHPWord');
First of all, you didn't say if it's Yii 1 or 2. They have different autoloading methods.
Second, you have extracted it into extension folder, and I assume your file where you want to include it is in a completely different folder.
You should do it like this
include('/full/path/to/PHPWord.php');
You need either absolute or a relative path to the file (I suggest using abosulte path (the one I used as an example).
Relative path means the path to the file you want to include compared to where your file, in which you are including it, is.

How to download a file through a link with its extension type with scrapy

I am using scrapy to scrape a website and I can download the file from the page, however everything that is being download is a plain text file. How do I download it with it's extension type? I am downloading scripts and as such, having the proper extension type on my download is necessary.
For example, if I am downloading exploits from exploit-db, the link that I go to to download them would be for example: https://www.exploit-db.com/exploits/19832/
and the link i would extract from there to download from is https://www.exploit-db.com/download/19832 which will, if I click on it normally, download a ruby file. But through scrapy it gets saved as a text file. Is there a way to download it as a .rb through scrapy?
Just save it as filename.rb. All files are text/binary files. Extension is there just to tell your operating system what to use to understand that file.
(In some operating systems extension isn't even required since files have headers at the beginning of the file telling what they are)
You can do try this:
scrapy shell https://www.exploit-db.com/download/19832
Then in the shell or your spider just do:
with open('ruby_file.rb', 'wb') as ruby_file:
ruby_file.write(response.body)

automatically place downloaded files in folder bsed on downloads extension suffix

I’m making a simple web browser for work eeh, what I’d like to know is if its possible to save a file of a particular extension to a particular file.
I currently use google chrome when downloading a file it places this (regardless of extension) in a downloads folder without asking where I ant to download this too.
I want to achieve the same except that downloads with the extension .dwg are placed automatically in a folder named DWG DOWNLOADS…
How to achieve this in vb.net?
In any browser you have a config section.
In Firefox you have browser.download.useDownloadDir;true and browser.download.folderList;1
you can add your own config to allow different saved folder paths and dynamically modify them depending on the extension of the file you uploaded.
See a complete list of the web browser config with about:config in address bar.
Not real sure what you are asking, but if you are actually making a web browser just check the extension of the file you are requesting to download. If the extension is ".dwg" then save the file to the folder you want.
If you are wanting to automatically move Google Chrome downloads to a different directory, you can use a FileSystemWatcher to monitor for new files in Chrome's download directory and move them to another folder based on each file's extension.