Kinny
Kinny

Reputation: 9

HTML download attribute change file name

Hello I have this link to download video from youtube but the title always videoplayback.

    <a href="https://r6---sn-8qj-nboel.googlevideo.com/videoplayback?lmt=1415862562106007&sparams=clen,dur,ei,expire,gir,id,initcwndbps,ip,ipbits,ipbypass,itag,lmt,mime,mip,mm,mn,ms,mv,pcm2cms,pl,ratebypass,requiressl,source&gir=yes&ei=b5aaWaKKJo2JogPHyZi4AQ&pl=20&source=youtube&ip=128.199.110.176&mime=video%2Fmp4&requiressl=yes&expire=1503324879&id=o-AA6Urpa1sgtfqOlTXbz1blhIvhLx6nwj59PsaSTT-8rE&ipbits=0&ratebypass=yes&key=cms1&itag=18&clen=103379173&signature=4D159BDA63DDB2B51AB01764231F3EDC23DED64A.0FB2A9C367CC3CA54F9F0456703FDECB51674235&dur=5096.547&title=%EA%B9%80%ED%98%95%EB%B0%B1%EC%9D%98%20%EC%97%91%EC%85%80%20%EA%B0%95%EC%A2%8C%20%20%EC%B4%88%EA%B8%89%ED%8E%B8&redirect_counter=1&req_id=2e16a9417f6da3ee&cms_redirect=yes&ipbypass=yes&mip=14.187.139.219&mm=31&mn=sn-8qj-nboel&ms=au&mt=1503303128&mv=m&pcm2cms=yes?title="filename.mp4" download="filename.mp4">download</a>

I tried to use ?title="filename.mp4" and downlaod="filename.mp4". Both not work. Any idea?

Upvotes: 0

Views: 5833

Answers (3)

Top Top
Top Top

Reputation: 201

You cannot change the filename from the frontend.

We can change the filename to this.

Content-Disposition: attachment; filename=filename Youtube server made like this So we cannot change the file name from the frontend.

Upvotes: 0

swogat
swogat

Reputation: 1

the inverted comma in the href is not complete. I mean the inverted comma is started but not ended. the code you have written should have 6 inverted commas (3 starting and 3 ending ) but it has 5 (3 starting and 2 ending) there should be another ending inverted comma.

Refer this link Change name of download in javascript here it says from client side the name cannot be changed.

Upvotes: 0

Quentin
Quentin

Reputation: 944528

?title="filename.mp4 has two problems.

First, it depends on the server to recognise the query string value and use it as part of a suitable content-disposition HTTP response header. Presumably the server you are making the request to does not support that.

Second, if you want to put quote marks in the URL (and you probably don't) then you can't use the same quote marks as you use to delimit the HTML attribute value without escaping them. The first " will make the end of the href attribute.


downlaod="filename.mp4" has two problems.

First: download is not spelt with the a before the o.

Second: Some browsers only support the download attribute for same origin requests. You are making a cross-origin request.


YouType are in the business of streaming videos to people while displaying adverts. They are not going to support you directly downloading the video files.

Upvotes: 2

Related Questions