What can I do to retrieve a video from an HTML page by using wget?
-
I am trying to download some videos from a website using `wget`. It requires `username` and `password`. I provided it with all the required details. When I entered the command to the start download, all I got was an `HTML` file. The command is as follows: wget --user=//user-name// --password='password' //some URL ending with "/download.mp4?video_id=5"// The problem is that it is downloading an `HTML` file. However, when I right click on this link in the website and select `Save target as`, I get the video file which I want to save. Similarily, when I click on the link, it shows a video file that can be saved or opened. I tried the following command but to no avail:- wget -O vid.mp4 --user=//user-name// --password='password' //some URL ending with "/download.mp4?video_id=5"// It created a `.mp4` file but it didn't have any video in it. The size of this file was also equal to the size of the `HTML` file that was created before.
-
Answer:
I'll be writing a solution for a simpler problem. The problem posted above seems to have a lot complexities. Also, the problem depends on whether the userid-password combo is being asked by an HTML form or by an HTML-AUTH service. In the case of former, we don't need userid-password combo. I don't know how to solve the latter case. In the former, all we need to do is look for http-headers. Whenever we click on the video link, there is activity in the browser console. In this activity, the actual link of the video is given. Just copy it and paste it after wget command. However, I would like to to mention that this method becomes quite tedious when downloading more that 10 videos because I couldn't find of anyway to automate this process ( copy the link->parse the page for the link->use that link to download the video ). So, if you want to download multiple videos you can follow the above method required number of times and copy all the links in .txt files. Save that file and use it with wget to get the videos. The steps are :- Go to the required link containing the video. Check for the http-headers for the actual link that points to the video file. Go to browser console. Click on the link in the window from where you want to download ( and not on any link in the console ). When you do so, you will find a link in the console. Copy this link and paste it either on the terminal or in a .txt file. If the links are pasted in a .txt file, use the command:- wget --content-disposition --trust-server-names -i <filename>.txt This would give you the names of the files by which they should be named. In the case of a simple link, just paste it in the following format:- wget -O <filename>.<format> <link> ( note the captital O ). This should see you through. It should be noted that this technique can applied for any type of file you want to download. Just change the extensions accordingly. References:- http://unix.stackexchange.com/questions/61132/how-do-i-use-wget-with-a-list-of-urls-and-their-corresponding-output-files contains more tips on solving the naming part in this problem.
Kunal Suri at Quora Visit the source
Other answers
you need a program(existing library/program will do) which does web scrapping. you can call this program or libray a 'parser'. parser is a component of a compiler actually which has the ability to understand the syntax. In this case, its HTML. run a loop which matches 'source' tag with attribute 'src'. extract that value of that attribute and pass it to wget -C.
Rihan Pereira
Related Q & A:
- What can I use to clean a DVD?Best solution by Yahoo! Answers
- What is a bachelor of Science degree, and what can I do with such a degree?Best solution by Yahoo! Answers
- How can I get pictures from a video?Best solution by Yahoo! Answers
- Can I rip audio from a video?Best solution by Yahoo! Answers
- How can I get sound on a video?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.