Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to see the direct link?
#1
Hi I was trying to download the midi files from this website.https://www.midiworld.com/search/1/?q=pop  But however I could download the midi files directly by clicking the links or mouse-right click and save link as.... , My question is if there is any method to directly retrieve the direct link to the midi file. just like www.blablablabla.com/bla/bla.mid 

another question is how to put the downloaded file to a prepared folder. for instance , C:/test/midi  

Thank you so much.
 
Code:
Copy      Help
[code]var w = wnd.find(1, "Pop MIDI Files - Download for free :: MIDIWORLD.COM :: 2 - Google Chrome", "Chrome_WidgetWin_1");
foreach (var e in w.Elm["web:LINK", "download"].FindAll()) {
    print.it(e.Value);
    e.Invoke();
    2.s();
}

[/code]
#2
Code:
Copy      Help
var destDir = @"C:/test/midi";
filesystem.createDirectory(destDir);
var w = wnd.find(1, "Pop MIDI Files - * - Google Chrome", "Chrome_WidgetWin_1");
foreach (var e in w.Elm["web:LINK", "download"].FindAll()) {
    print.it(e.Value);
    var r = internet.http.Get(e.Value, true);
    //print.it(r);
    var filename = r.Content.Headers.ContentDisposition.FileName;
    print.it(filename);
    filesystem.saveBytes(destDir + "\\" + filename, r.Bytes());
    break;
}
#3
Hi Gintaras,

Thank you so much for your reply, 
Code:
Copy      Help
[code]var r = internet.http.Get(e.Value, true);
    print.it(r);
    var filename = r.Content.Headers.ContentDisposition.FileName;

[/code]
could you please explain a little bit of these two row codes. It is so strange to me. I couldn't catch them very clearly.
#4
`internet.http.Get` starts downloading from the URL (which is the direct download URL, although without ".mid"). Then you can print the response headers etc. The headers contains the filename. The response body contains the midi file.
#5
Thank you so much!


Forum Jump:


Users browsing this thread: 1 Guest(s)