ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.38k stars 9.96k forks source link

Format exported Files .json .xml .description #7434

Closed elsakuh closed 8 years ago

elsakuh commented 8 years ago

Using --write-description Write video description to a .description file --write-info-json Write video metadata to a .info.json file --write-annotations to an xml file

question here: Is it possible to influence the export format inside the files.

Example: .json output is 1 line with a huge count of informations:

{"upload_date": "20141231", "extractor": "youtube", "format_note": "hd720", "height": 720, "thumbnail": "https://i.ytimg.com/vi/8tfcoD5VRRo/maxresdefault.jpg", "like_count": 594, "duration": 534, "fulltitle": "ZMR250, still not that impressed", "playlist_index": 101, "view_count": 35186, "playlist": "Uploads from RC Model Reviews", "title": "ZMR250, still not that impressed", "_filename": "D:\Youtube\RCModelReviews\ZMR250, still not that impressed.mp4", "tags": ["RC plane", "mini quadcopter", "FPV", "first person view", "FPV racing", "drone", "ZMR250", "Blackout Mini H", "QAV250", "MXP230", "Mini Mamba"], "is_live": null, "id": "8tfcoD5VRRo", "dislike_count": 56, "average_rating": 4.65538454056, "filesize": null, "fps": null, "age_limit": 0, "annotations": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>", "webpage_url_basename": "8tfcoD5VRRo", "acodec": "avc1.64001F", "display_id": "8tfcoD5VRRo", "automatic_captions": {}, "description": "I had reservations about the ZMR250 miniquad when I reviewed it and I have to say that after flying it hard for several months, I'm still not in love with this machine.\n\nI've been through several arms which have failed in relatively unspectacular crashes and now the spacers are stripping out because the screws are too short.\n\nYes, it is a great-priced frame and yes, it does fly okay -- but to be brutally honest, it is my least-favorite miniquad and the one which takes most work to keep in the air. In fact, it's the only one which has suffered any major structural failures at all.\n\nOkay ZMR250 fans, let me have it with both barrels :-)", "format": "22 - 1280x720 (hd720)", "start_time": null, "tbr": null, "categories": ["Science & Technology"], "playlist_id": "UUahqHsTaADV8MMmj2D5i1Vw", "uploader": "RCModelReviews", "format_id": "22", "uploader_id": "RCModelReviews", "subtitles": {}, "playlist_title": "Uploads from RC Model Reviews", "thumbnails": [{"url": "https://i.ytimg.com/vi/8tfcoD5VRRo/maxresdefault.jpg", "id": "0"}], "url": "https://r9---sn-4g57kndr.googlevideo.com/videoplayback?mime=video%2Fmp4&sparams=dur%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&itag=22&requiressl=yes&nh=IgpwcjAzLmZyYTE1KgkxMjcuMC4wLjE&key=yt6&pl=16&ipbits=0&initcwndbps=1015000&ratebypass=yes&expire=1446213606&lmt=1435410306207654&upn=DVAHszg4pcE&ip=84.164.11.119&sver=3&mn=sn-4g57kndr&mm=31&dur=533.339&id=o-AI8e5ta7i53VJ4d_aFnxU1IJWzhnMPaPwCHKQMad9Adq&mv=m&signature=80DCA947F88A09F4F75A161A214887F0CC787D4A.0C6E1FE13E364D7F4F558B1EE3568E62C7B671B2&mt=1446191967&ms=au&fexp=9408710%2C9414764%2C9415435%2C9416126%2C9416985%2C9417055%2C9417707%2C9419445%2C9419543%2C9420994%2C9421294%2C9422191%2C9422596%2C9423038%2C9423358&source=youtube", "extractor_key": "Youtube", "vcodec": " mp4a.40.2", "httpheaders": {"Accept-Charset": "ISO-8859-1,utf-8;q=0.7,;q=0.7", "Accept-Language": "en-us,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/20.0 (Chrome)"}, "player_url": null, "ext": "mp4", "end_time": null, "webpage_url": "https://www.youtube.com/watch?v=8tfcoD5VRRo", "formats": [{"httpheaders": {"Accept-Charset": "ISO-8859-1,utf-8;q=0.7,;q=0.7", "Accept-Language": "en-us,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/20.0 (Chrome)"}, "tbr": 51.952, "format": "249 - audio only (DASH audio)", "url": "https://r9---sn-4g57kndr.googlevideo.com/videoplayback?mime=audio%2Fwebm&keepalive=yes&sparams=clen%2Cdur%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&itag=249&requiressl=yes&nh=IgpwcjAzLmZyYTE1KgkxMjcuMC4wLjE&key=yt6&pl=16&ipbits=0&initcwndbps=1015000&expire=1446213606&lmt=1420177478860350&upn=DVAHszg4pcE&ip=84.164.11.119&sver=3&mn=sn-4g57kndr&gir=yes&mm=31&dur=533.281&id=o-AI8e5ta7i53VJ4d_aFnxU1IJWzhnMPaPwCHKQMad9Adq&mv=m&signature=65193C6AC4F8D6C70B8881FE3AD6750507472806.906C690745BADDA92EAE13EB78B0E3D9A6E30A6A&mt=1446191967&ms=au&fexp=9408710%2C9414764%2C9415435%2C9416126%2C9416985%2C9417055%2C9417707%2C9419445%2C9419543%2C9420994%2C9421294%2C9422191%2C9422596%2C9423038%2C9423358&source=youtube&clen=3284295&ratebypass=yes", "vcodec": "none", "format_note": "DASH audio", "abr": 50, "preference": -50, "height": null, "width": null, "ext": "webm", "filesize": 3284295, "fps": null, "format_id": "249", "player_url": null, "acodec": "opus"}, {"httpheaders": {"Accept-Charset": "ISO-8859-1,utf-8;q=0.7,;q=0.7", "Accept-Language": "en-us,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,_/*;q=0.8", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/20.0 (Chrome)"}, "tbr": 63.671, "format": "250 - audio only (DASH audio)", "url": "https://r9---sn-4g57kndr.googlevideo.com/videoplayback?mime=audio%2Fwebm&keepalive=yes&sparams=clen%2Cdur%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&itag=250&requiressl=yes&nh=IgpwcjAzLmZyYTE1KgkxMjcuMC4wLjE&key=yt6&pl=16&ipbits=0&initcwndbps=1015000&expire=1446213606&lmt=1420177460237391&upn=DVAHszg4pcE&ip=84.164.11.119&sver=3&mn=sn-4g57kndr&gir=yes&mm=31&dur=533.281&id=o-AI8e5ta7i53VJ4d_aFnxU1IJWzhnMPaPwCHKQMad9Adq&mv=m&signature=16069AD1A996622446AFB22FA291F6E74DC84C3C.47FF016EB47E2CE28E475402C0B0F973F4B00BB0&mt=1446191967&ms=au&fexp=9408710%2C9414764%2C9415435%2C9416126%2C9416985%2C9417055%2C9417707%2C9419445%2C9419543%2C9420994%2C9421294%2C9422191%2C9422596%2C9423038%2C9423358&source=youtube&clen=3754673&ratebypass=yes", "vcodec": "none", "format_note": "DASH audio", "abr": 70, "preference": -50, "height": null, "width": null, "ext": "webm", "filesize": 3754673, "fps": null, "format_id": "250", "player_url": null, "acodec": "opus"}, {"asr": 44100, "tbr": 94, "format": "171 - audio only (DASH audio)", "url": ...

What I wanted to achive is to get out a certain formatted information that can be used by another program in my case I want to create an output formatted file like Kodi "movie.nfo"

...wanted to copy and paste the nfo in xml format but it gets sensless interpreted by this side :-) so here is what i ment :http://kodi.wiki/view/NFO_files/Movies

to organize my downloaded videos in Kodi with the decent Informations inside

"So can I change the output format of supported files mentioned at the top?"

If not as an workaround: As I am not an Python expert (just try to start) may be there is a program.py that analyze the .json or the other files and can pull and export it in a Kodi readable way

Thanks in advance

dstftw commented 8 years ago

That is not possible. You should consume JSON output and produce one you need based on it.

elsakuh commented 8 years ago

ok thanks! try to learn Python to write a program that does so ;-)