123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526 |
- <!-- Creator : groff version 1.22.3 -->
- <!-- CreationDate: Thu Dec 31 02:05:01 2015 -->
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta name="generator" content="groff -Thtml, see www.gnu.org">
- <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
- <meta name="Content-Style" content="text/css">
- <style type="text/css">
- p { margin-top: 0; margin-bottom: 0; vertical-align: top }
- pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
- table { margin-top: 0; margin-bottom: 0; vertical-align: top }
- h1 { text-align: center }
- </style>
- <title>YOUTUBE−DL</title>
- </head>
- <body>
- <h1 align="center">YOUTUBE−DL</h1>
- <a href="#NAME">NAME</a><br>
- <a href="#SYNOPSIS">SYNOPSIS</a><br>
- <a href="#DESCRIPTION">DESCRIPTION</a><br>
- <a href="#OPTIONS">OPTIONS</a><br>
- <a href="#CONFIGURATION">CONFIGURATION</a><br>
- <a href="#OUTPUT TEMPLATE">OUTPUT TEMPLATE</a><br>
- <a href="#FORMAT SELECTION">FORMAT SELECTION</a><br>
- <a href="#VIDEO SELECTION">VIDEO SELECTION</a><br>
- <a href="#FAQ">FAQ</a><br>
- <a href="#DEVELOPER INSTRUCTIONS">DEVELOPER INSTRUCTIONS</a><br>
- <a href="#EMBEDDING YOUTUBE−DL">EMBEDDING YOUTUBE−DL</a><br>
- <a href="#BUGS">BUGS</a><br>
- <a href="#COPYRIGHT">COPYRIGHT</a><br>
- <hr>
- <h2>NAME
- <a name="NAME"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em">youtube−dl
- − download videos from youtube.com or other video
- platforms</p>
- <h2>SYNOPSIS
- <a name="SYNOPSIS"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em"><b>youtube−dl</b>
- [OPTIONS] URL [URL...]</p>
- <h2>DESCRIPTION
- <a name="DESCRIPTION"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em"><b>youtube−dl</b>
- is a small command−line program to download videos
- from YouTube.com and a few more sites. It requires the
- Python interpreter, version 2.6, 2.7, or 3.2+, and it is not
- platform specific. It should work on your Unix box, on
- Windows or on Mac OS X. It is released to the public domain,
- which means you can modify it, redistribute it or use it
- however you like.</p>
- <h2>OPTIONS
- <a name="OPTIONS"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em"><b>−h,
- −−help</b></p>
- <p style="margin-left:22%;">Print this help text and
- exit</p>
- <p style="margin-left:11%;"><b>−−version</b></p>
- <p style="margin-left:22%;">Print program version and
- exit</p>
- <p style="margin-left:11%;"><b>−U,
- −−update</b></p>
- <p style="margin-left:22%;">Update this program to latest
- version. Make sure that you have sufficient permissions (run
- with sudo if needed)</p>
- <p style="margin-left:11%;"><b>−i,
- −−ignore−errors</b></p>
- <p style="margin-left:22%;">Continue on download errors,
- for example to skip unavailable videos in a playlist</p>
- <p style="margin-left:11%;"><b>−−abort−on−error</b></p>
- <p style="margin-left:22%;">Abort downloading of further
- videos (in the playlist or the command line) if an error
- occurs</p>
- <p style="margin-left:11%;"><b>−−dump−user−agent</b></p>
- <p style="margin-left:22%;">Display the current browser
- identification</p>
- <p style="margin-left:11%;"><b>−−list−extractors</b></p>
- <p style="margin-left:22%;">List all supported
- extractors</p>
- <p style="margin-left:11%;"><b>−−extractor−descriptions</b></p>
- <p style="margin-left:22%;">Output descriptions of all
- supported extractors</p>
- <p style="margin-left:11%;"><b>−−force−generic−extractor</b></p>
- <p style="margin-left:22%;">Force extraction to use the
- generic extractor</p>
- <p style="margin-left:11%;"><b>−−default−search</b>
- <i>PREFIX</i></p>
- <p style="margin-left:22%;">Use this prefix for unqualified
- URLs. For example "gvsearch2:" downloads two
- videos from google videos for youtube−dl "large
- apple". Use the value "auto" to let
- youtube−dl guess ("auto_warning" to emit a
- warning when guessing). "error" just throws an
- error. The default value "fixup_error" repairs
- broken URLs, but emits an error if this is not possible
- instead of searching.</p>
- <p style="margin-left:11%;"><b>−−ignore−config</b></p>
- <p style="margin-left:22%;">Do not read configuration
- files. When given in the global configuration file /etc
- /youtube−dl.conf: Do not read the user configuration
- in ~/.config/youtube− dl/config
- (%APPDATA%/youtube−dl/config.txt on Windows)</p>
- <p style="margin-left:11%;"><b>−−flat−playlist</b></p>
- <p style="margin-left:22%;">Do not extract the videos of a
- playlist, only list them.</p>
- <p style="margin-left:11%;"><b>−−no−color</b></p>
- <p style="margin-left:22%;">Do not emit color codes in
- output</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Network
- Options: <br>
- −−proxy</b> <i>URL</i></p>
- <p style="margin-left:22%;">Use the specified HTTP/HTTPS
- proxy. Pass in an empty string (−−proxy
- "") for direct connection</p>
- <p style="margin-left:11%;"><b>−−socket−timeout</b>
- <i>SECONDS</i></p>
- <p style="margin-left:22%;">Time to wait before giving up,
- in seconds</p>
- <p style="margin-left:11%;"><b>−−source−address</b>
- <i>IP</i></p>
- <p style="margin-left:22%;">Client−side IP address to
- bind to (experimental)</p>
- <p style="margin-left:11%;"><b>−4,
- −−force−ipv4</b></p>
- <p style="margin-left:22%;">Make all connections via IPv4
- (experimental)</p>
- <p style="margin-left:11%;"><b>−6,
- −−force−ipv6</b></p>
- <p style="margin-left:22%;">Make all connections via IPv6
- (experimental)</p>
- <p style="margin-left:11%;"><b>−−cn−verification−proxy</b>
- <i>URL</i></p>
- <p style="margin-left:22%;">Use this proxy to verify the IP
- address for some Chinese sites. The default proxy specified
- by −−proxy (or none, if the options is not
- present) is used for the actual downloading.
- (experimental)</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Video
- Selection: <br>
- −−playlist−start</b> <i>NUMBER</i></p>
- <p style="margin-left:22%;">Playlist video to start at
- (default is 1)</p>
- <p style="margin-left:11%;"><b>−−playlist−end</b>
- <i>NUMBER</i></p>
- <p style="margin-left:22%;">Playlist video to end at
- (default is last)</p>
- <p style="margin-left:11%;"><b>−−playlist−items</b>
- <i>ITEM_SPEC</i></p>
- <p style="margin-left:22%;">Playlist video items to
- download. Specify indices of the videos in the playlist
- separated by commas like:
- "−−playlist−items 1,2,5,8" if
- you want to download videos indexed 1, 2, 5, 8 in the
- playlist. You can specify range:
- "−−playlist−items
- 1−3,7,10−13", it will download the videos
- at index 1, 2, 3, 7, 10, 11, 12 and 13.</p>
- <p style="margin-left:11%;"><b>−−match−title</b>
- <i>REGEX</i></p>
- <p style="margin-left:22%;">Download only matching titles
- (regex or caseless sub−string)</p>
- <p style="margin-left:11%;"><b>−−reject−title</b>
- <i>REGEX</i></p>
- <p style="margin-left:22%;">Skip download for matching
- titles (regex or caseless sub−string)</p>
- <p style="margin-left:11%;"><b>−−max−downloads</b>
- <i>NUMBER</i></p>
- <p style="margin-left:22%;">Abort after downloading NUMBER
- files</p>
- <p style="margin-left:11%;"><b>−−min−filesize</b>
- <i>SIZE</i></p>
- <p style="margin-left:22%;">Do not download any videos
- smaller than SIZE (e.g. 50k or 44.6m)</p>
- <p style="margin-left:11%;"><b>−−max−filesize</b>
- <i>SIZE</i></p>
- <p style="margin-left:22%;">Do not download any videos
- larger than SIZE (e.g. 50k or 44.6m)</p>
- <p style="margin-left:11%;"><b>−−date</b>
- <i>DATE</i></p>
- <p style="margin-left:22%;">Download only videos uploaded
- in this date</p>
- <p style="margin-left:11%;"><b>−−datebefore</b>
- <i>DATE</i></p>
- <p style="margin-left:22%;">Download only videos uploaded
- on or before this date (i.e. inclusive)</p>
- <p style="margin-left:11%;"><b>−−dateafter</b>
- <i>DATE</i></p>
- <p style="margin-left:22%;">Download only videos uploaded
- on or after this date (i.e. inclusive)</p>
- <p style="margin-left:11%;"><b>−−min−views</b>
- <i>COUNT</i></p>
- <p style="margin-left:22%;">Do not download any videos with
- less than COUNT views</p>
- <p style="margin-left:11%;"><b>−−max−views</b>
- <i>COUNT</i></p>
- <p style="margin-left:22%;">Do not download any videos with
- more than COUNT views</p>
- <p style="margin-left:11%;"><b>−−match−filter</b>
- <i>FILTER</i></p>
- <p style="margin-left:22%;">Generic video filter
- (experimental). Specify any key (see help for −o for a
- list of available keys) to match if the key is present, !key
- to check if the key is not present,key > NUMBER (like
- "comment_count > 12", also works with >=,
- <, <=, !=, =) to compare against a number, and &
- to require multiple matches. Values which are not known are
- excluded unless you put a question mark (?) after the
- operator.For example, to only match videos that have been
- liked more than 100 times and disliked less than 50 times
- (or the dislike functionality is not available at the given
- service), but who also have a description, use
- −−match−filter "like_count > 100
- & dislike_count <? 50 & description" .</p>
- <p style="margin-left:11%;"><b>−−no−playlist</b></p>
- <p style="margin-left:22%;">Download only the video, if the
- URL refers to a video and a playlist.</p>
- <p style="margin-left:11%;"><b>−−yes−playlist</b></p>
- <p style="margin-left:22%;">Download the playlist, if the
- URL refers to a video and a playlist.</p>
- <p style="margin-left:11%;"><b>−−age−limit</b>
- <i>YEARS</i></p>
- <p style="margin-left:22%;">Download only videos suitable
- for the given age</p>
- <p style="margin-left:11%;"><b>−−download−archive</b>
- <i>FILE</i></p>
- <p style="margin-left:22%;">Download only videos not listed
- in the archive file. Record the IDs of all downloaded videos
- in it.</p>
- <p style="margin-left:11%;"><b>−−include−ads</b></p>
- <p style="margin-left:22%;">Download advertisements as well
- (experimental)</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Download
- Options: <br>
- −r, −−rate−limit</b>
- <i>LIMIT</i></p>
- <p style="margin-left:22%;">Maximum download rate in bytes
- per second (e.g. 50K or 4.2M)</p>
- <p style="margin-left:11%;"><b>−R,
- −−retries</b> <i>RETRIES</i></p>
- <p style="margin-left:22%;">Number of retries (default is
- 10), or "infinite".</p>
- <p style="margin-left:11%;"><b>−−buffer−size</b>
- <i>SIZE</i></p>
- <p style="margin-left:22%;">Size of download buffer (e.g.
- 1024 or 16K) (default is 1024)</p>
- <p style="margin-left:11%;"><b>−−no−resize−buffer</b></p>
- <p style="margin-left:22%;">Do not automatically adjust the
- buffer size. By default, the buffer size is automatically
- resized from an initial value of SIZE.</p>
- <p style="margin-left:11%;"><b>−−playlist−reverse</b></p>
- <p style="margin-left:22%;">Download playlist videos in
- reverse order</p>
- <p style="margin-left:11%;"><b>−−xattr−set−filesize</b></p>
- <p style="margin-left:22%;">Set file xattribute
- ytdl.filesize with expected filesize (experimental)</p>
- <p style="margin-left:11%;"><b>−−hls−prefer−native</b></p>
- <p style="margin-left:22%;">Use the native HLS downloader
- instead of ffmpeg (experimental)</p>
- <p style="margin-left:11%;"><b>−−external−downloader</b>
- <i>COMMAND</i></p>
- <p style="margin-left:22%;">Use the specified external
- downloader. Currently supports
- aria2c,axel,curl,httpie,wget</p>
- <p style="margin-left:11%;"><b>−−external−downloader−args</b>
- <i>ARGS</i></p>
- <p style="margin-left:22%;">Give these arguments to the
- external downloader</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Filesystem
- Options: <br>
- −a, −−batch−file</b> <i>FILE</i></p>
- <p style="margin-left:22%;">File containing URLs to
- download ('−' for stdin)</p>
- <table width="100%" border="0" rules="none" frame="void"
- cellspacing="0" cellpadding="0">
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="6%">
- <p><b>−−id</b></p></td>
- <td width="5%"></td>
- <td width="46%">
- <p>Use only video ID in file name</p></td>
- <td width="32%">
- </td></tr>
- </table>
- <p style="margin-left:11%;"><b>−o,
- −−output</b> <i>TEMPLATE</i></p>
- <p style="margin-left:22%;">Output filename template. Use
- %(title)s to get the title, %(uploader)s for the uploader
- name, %(uploader_id)s for the uploader nickname if
- different, %(autonumber)s to get an automatically
- incremented number, %(ext)s for the filename extension,
- %(format)s for the format description (like "22 −
- 1280x720" or "HD"), %(format_id)s for the
- unique id of the format (like YouTube's itags:
- "137"), %(upload_date)s for the upload date
- (YYYYMMDD), %(extractor)s for the provider (youtube,
- metacafe, etc), %(id)s for the video id, %(playlist_title)s,
- %(playlist_id)s, or %(playlist)s (=title if present, ID
- otherwise) for the playlist the video is in,
- %(playlist_index)s for the position in the playlist.
- %(height)s and %(width)s for the width and height of the
- video format. %(resolution)s for a textual description of
- the resolution of the video format. %% for a literal
- percent. Use − to output to stdout. Can also be used
- to download to a different directory, for example with
- −o '/my/downloads/%(uploader)s
- /%(title)s−%(id)s.%(ext)s' .</p>
- <p style="margin-left:11%;"><b>−−autonumber−size</b>
- <i>NUMBER</i></p>
- <p style="margin-left:22%;">Specify the number of digits in
- %(autonumber)s when it is present in output filename
- template or −−auto−number option is
- given</p>
- <p style="margin-left:11%;"><b>−−restrict−filenames</b></p>
- <p style="margin-left:22%;">Restrict filenames to only
- ASCII characters, and avoid "&" and spaces in
- filenames</p>
- <p style="margin-left:11%;"><b>−A,
- −−auto−number</b></p>
- <p style="margin-left:22%;">[deprecated; use −o
- "%(autonumber)s−%(title)s.%(ext)s" ] Number
- downloaded files starting from 00000</p>
- <p style="margin-left:11%;"><b>−t,
- −−title</b></p>
- <p style="margin-left:22%;">[deprecated] Use title in file
- name (default)</p>
- <p style="margin-left:11%;"><b>−l,
- −−literal</b></p>
- <p style="margin-left:22%;">[deprecated] Alias of
- −−title</p>
- <p style="margin-left:11%;"><b>−w,
- −−no−overwrites</b></p>
- <p style="margin-left:22%;">Do not overwrite files</p>
- <p style="margin-left:11%;"><b>−c,
- −−continue</b></p>
- <p style="margin-left:22%;">Force resume of partially
- downloaded files. By default, youtube−dl will resume
- downloads if possible.</p>
- <p style="margin-left:11%;"><b>−−no−continue</b></p>
- <p style="margin-left:22%;">Do not resume partially
- downloaded files (restart from beginning)</p>
- <p style="margin-left:11%;"><b>−−no−part</b></p>
- <p style="margin-left:22%;">Do not use .part files −
- write directly into output file</p>
- <p style="margin-left:11%;"><b>−−no−mtime</b></p>
- <p style="margin-left:22%;">Do not use the
- Last−modified header to set the file modification
- time</p>
- <p style="margin-left:11%;"><b>−−write−description</b></p>
- <p style="margin-left:22%;">Write video description to a
- .description file</p>
- <p style="margin-left:11%;"><b>−−write−info−json</b></p>
- <p style="margin-left:22%;">Write video metadata to a
- .info.json file</p>
- <p style="margin-left:11%;"><b>−−write−annotations</b></p>
- <p style="margin-left:22%;">Write video annotations to a
- .annotations.xml file</p>
- <p style="margin-left:11%;"><b>−−load−info</b>
- <i>FILE</i></p>
- <p style="margin-left:22%;">JSON file containing the video
- information (created with the
- "−−write−info−json"
- option)</p>
- <p style="margin-left:11%;"><b>−−cookies</b>
- <i>FILE</i></p>
- <p style="margin-left:22%;">File to read cookies from and
- dump cookie jar in</p>
- <p style="margin-left:11%;"><b>−−cache−dir</b>
- <i>DIR</i></p>
- <p style="margin-left:22%;">Location in the filesystem
- where youtube−dl can store some downloaded information
- permanently. By default $XDG_CACHE_HOME /youtube−dl or
- ~/.cache/youtube−dl . At the moment, only YouTube
- player files (for videos with obfuscated signatures) are
- cached, but that may change.</p>
- <p style="margin-left:11%;"><b>−−no−cache−dir</b></p>
- <p style="margin-left:22%;">Disable filesystem caching</p>
- <p style="margin-left:11%;"><b>−−rm−cache−dir</b></p>
- <p style="margin-left:22%;">Delete all filesystem cache
- files</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Thumbnail
- images: <br>
- −−write−thumbnail</b></p>
- <p style="margin-left:22%;">Write thumbnail image to
- disk</p>
- <p style="margin-left:11%;"><b>−−write−all−thumbnails</b></p>
- <p style="margin-left:22%;">Write all thumbnail image
- formats to disk</p>
- <p style="margin-left:11%;"><b>−−list−thumbnails</b></p>
- <p style="margin-left:22%;">Simulate and list all available
- thumbnail formats</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Verbosity /
- Simulation Options: <br>
- −q, −−quiet</b></p>
- <p style="margin-left:22%;">Activate quiet mode</p>
- <p style="margin-left:11%;"><b>−−no−warnings</b></p>
- <p style="margin-left:22%;">Ignore warnings</p>
- <p style="margin-left:11%;"><b>−s,
- −−simulate</b></p>
- <p style="margin-left:22%;">Do not download the video and
- do not write anything to disk</p>
- <p style="margin-left:11%;"><b>−−skip−download</b></p>
- <p style="margin-left:22%;">Do not download the video</p>
- <p style="margin-left:11%;"><b>−g,
- −−get−url</b></p>
- <p style="margin-left:22%;">Simulate, quiet but print
- URL</p>
- <p style="margin-left:11%;"><b>−e,
- −−get−title</b></p>
- <p style="margin-left:22%;">Simulate, quiet but print
- title</p>
- <p style="margin-left:11%;"><b>−−get−id</b></p>
- <p style="margin-left:22%;">Simulate, quiet but print
- id</p>
- <p style="margin-left:11%;"><b>−−get−thumbnail</b></p>
- <p style="margin-left:22%;">Simulate, quiet but print
- thumbnail URL</p>
- <p style="margin-left:11%;"><b>−−get−description</b></p>
- <p style="margin-left:22%;">Simulate, quiet but print video
- description</p>
- <p style="margin-left:11%;"><b>−−get−duration</b></p>
- <p style="margin-left:22%;">Simulate, quiet but print video
- length</p>
- <p style="margin-left:11%;"><b>−−get−filename</b></p>
- <p style="margin-left:22%;">Simulate, quiet but print
- output filename</p>
- <p style="margin-left:11%;"><b>−−get−format</b></p>
- <p style="margin-left:22%;">Simulate, quiet but print
- output format</p>
- <p style="margin-left:11%;"><b>−j,
- −−dump−json</b></p>
- <p style="margin-left:22%;">Simulate, quiet but print JSON
- information. See −−output for a description of
- available keys.</p>
- <p style="margin-left:11%;"><b>−J,
- −−dump−single−json</b></p>
- <p style="margin-left:22%;">Simulate, quiet but print JSON
- information for each command−line argument. If the URL
- refers to a playlist, dump the whole playlist information in
- a single line.</p>
- <p style="margin-left:11%;"><b>−−print−json</b></p>
- <p style="margin-left:22%;">Be quiet and print the video
- information as JSON (video is still being downloaded).</p>
- <p style="margin-left:11%;"><b>−−newline</b></p>
- <p style="margin-left:22%;">Output progress bar as new
- lines</p>
- <p style="margin-left:11%;"><b>−−no−progress</b></p>
- <p style="margin-left:22%;">Do not print progress bar</p>
- <p style="margin-left:11%;"><b>−−console−title</b></p>
- <p style="margin-left:22%;">Display progress in console
- titlebar</p>
- <p style="margin-left:11%;"><b>−v,
- −−verbose</b></p>
- <p style="margin-left:22%;">Print various debugging
- information</p>
- <p style="margin-left:11%;"><b>−−dump−pages</b></p>
- <p style="margin-left:22%;">Print downloaded pages encoded
- using base64 to debug problems (very verbose)</p>
- <p style="margin-left:11%;"><b>−−write−pages</b></p>
- <p style="margin-left:22%;">Write downloaded intermediary
- pages to files in the current directory to debug
- problems</p>
- <p style="margin-left:11%;"><b>−−print−traffic</b></p>
- <p style="margin-left:22%;">Display sent and read HTTP
- traffic</p>
- <p style="margin-left:11%;"><b>−C,
- −−call−home</b></p>
- <p style="margin-left:22%;">Contact the youtube−dl
- server for debugging</p>
- <p style="margin-left:11%;"><b>−−no−call−home</b></p>
- <p style="margin-left:22%;">Do NOT contact the
- youtube−dl server for debugging</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Workarounds:
- <br>
- −−encoding</b> <i>ENCODING</i></p>
- <p style="margin-left:22%;">Force the specified encoding
- (experimental)</p>
- <p style="margin-left:11%;"><b>−−no−check−certificate</b></p>
- <p style="margin-left:22%;">Suppress HTTPS certificate
- validation</p>
- <p style="margin-left:11%;"><b>−−prefer−insecure</b></p>
- <p style="margin-left:22%;">Use an unencrypted connection
- to retrieve information about the video. (Currently
- supported only for YouTube)</p>
- <p style="margin-left:11%;"><b>−−user−agent</b>
- <i>UA</i></p>
- <p style="margin-left:22%;">Specify a custom user agent</p>
- <p style="margin-left:11%;"><b>−−referer</b>
- <i>URL</i></p>
- <p style="margin-left:22%;">Specify a custom referer, use
- if the video access is restricted to one domain</p>
- <p style="margin-left:11%;"><b>−−add−header</b>
- <i>FIELD:VALUE</i></p>
- <p style="margin-left:22%;">Specify a custom HTTP header
- and its value, separated by a colon ':'. You can use this
- option multiple times</p>
- <p style="margin-left:11%;"><b>−−bidi−workaround</b></p>
- <p style="margin-left:22%;">Work around terminals that lack
- bidirectional text support. Requires bidiv or fribidi
- executable in PATH</p>
- <p style="margin-left:11%;"><b>−−sleep−interval</b>
- <i>SECONDS</i></p>
- <p style="margin-left:22%;">Number of seconds to sleep
- before each download.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Video Format
- Options: <br>
- −f, −−format</b> <i>FORMAT</i></p>
- <p style="margin-left:22%;">Video format code, see the
- "FORMAT SELECTION" for all the info</p>
- <p style="margin-left:11%;"><b>−−all−formats</b></p>
- <p style="margin-left:22%;">Download all available video
- formats</p>
- <p style="margin-left:11%;"><b>−−prefer−free−formats</b></p>
- <p style="margin-left:22%;">Prefer free video formats
- unless a specific one is requested</p>
- <p style="margin-left:11%;"><b>−F,
- −−list−formats</b></p>
- <p style="margin-left:22%;">List all available formats of
- requested videos</p>
- <p style="margin-left:11%;"><b>−−youtube−skip−dash−manifest</b></p>
- <p style="margin-left:22%;">Do not download the DASH
- manifests and related data on YouTube videos</p>
- <p style="margin-left:11%;"><b>−−merge−output−format</b>
- <i>FORMAT</i></p>
- <p style="margin-left:22%;">If a merge is required (e.g.
- bestvideo+bestaudio), output to given container format. One
- of mkv, mp4, ogg, webm, flv. Ignored if no merge is
- required</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Subtitle
- Options: <br>
- −−write−sub</b></p>
- <p style="margin-left:22%;">Write subtitle file</p>
- <p style="margin-left:11%;"><b>−−write−auto−sub</b></p>
- <p style="margin-left:22%;">Write automatically generated
- subtitle file (YouTube only)</p>
- <p style="margin-left:11%;"><b>−−all−subs</b></p>
- <p style="margin-left:22%;">Download all the available
- subtitles of the video</p>
- <p style="margin-left:11%;"><b>−−list−subs</b></p>
- <p style="margin-left:22%;">List all available subtitles
- for the video</p>
- <p style="margin-left:11%;"><b>−−sub−format</b>
- <i>FORMAT</i></p>
- <p style="margin-left:22%;">Subtitle format, accepts
- formats preference, for example: "srt" or
- "ass/srt/best"</p>
- <p style="margin-left:11%;"><b>−−sub−lang</b>
- <i>LANGS</i></p>
- <p style="margin-left:22%;">Languages of the subtitles to
- download (optional) separated by commas, use IETF language
- tags like 'en,pt'</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Authentication
- Options: <br>
- −u, −−username</b> <i>USERNAME</i></p>
- <p style="margin-left:22%;">Login with this account ID</p>
- <p style="margin-left:11%;"><b>−p,
- −−password</b> <i>PASSWORD</i></p>
- <p style="margin-left:22%;">Account password. If this
- option is left out, youtube−dl will ask
- interactively.</p>
- <p style="margin-left:11%;"><b>−2,
- −−twofactor</b> <i>TWOFACTOR</i></p>
- <p style="margin-left:22%;">Two−factor auth code</p>
- <p style="margin-left:11%;"><b>−n,
- −−netrc</b></p>
- <p style="margin-left:22%;">Use .netrc authentication
- data</p>
- <p style="margin-left:11%;"><b>−−video−password</b>
- <i>PASSWORD</i></p>
- <p style="margin-left:22%;">Video password (vimeo, smotri,
- youku)</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Post−processing
- Options: <br>
- −x, −−extract−audio</b></p>
- <p style="margin-left:22%;">Convert video files to
- audio−only files (requires ffmpeg or avconv and
- ffprobe or avprobe)</p>
- <p style="margin-left:11%;"><b>−−audio−format</b>
- <i>FORMAT</i></p>
- <p style="margin-left:22%;">Specify audio format:
- "best", "aac", "vorbis",
- "mp3", "m4a", "opus", or
- "wav"; "best" by default</p>
- <p style="margin-left:11%;"><b>−−audio−quality</b>
- <i>QUALITY</i></p>
- <p style="margin-left:22%;">Specify ffmpeg/avconv audio
- quality, insert a value between 0 (better) and 9 (worse) for
- VBR or a specific bitrate like 128K (default 5)</p>
- <p style="margin-left:11%;"><b>−−recode−video</b>
- <i>FORMAT</i></p>
- <p style="margin-left:22%;">Encode the video to another
- format if necessary (currently supported:
- mp4|flv|ogg|webm|mkv|avi)</p>
- <p style="margin-left:11%;"><b>−−postprocessor−args</b>
- <i>ARGS</i></p>
- <p style="margin-left:22%;">Give these arguments to the
- postprocessor</p>
- <p style="margin-left:11%;"><b>−k,
- −−keep−video</b></p>
- <p style="margin-left:22%;">Keep the video file on disk
- after the post− processing; the video is erased by
- default</p>
- <p style="margin-left:11%;"><b>−−no−post−overwrites</b></p>
- <p style="margin-left:22%;">Do not overwrite
- post−processed files; the post−processed files
- are overwritten by default</p>
- <p style="margin-left:11%;"><b>−−embed−subs</b></p>
- <p style="margin-left:22%;">Embed subtitles in the video
- (only for mkv and mp4 videos)</p>
- <p style="margin-left:11%;"><b>−−embed−thumbnail</b></p>
- <p style="margin-left:22%;">Embed thumbnail in the audio as
- cover art</p>
- <p style="margin-left:11%;"><b>−−add−metadata</b></p>
- <p style="margin-left:22%;">Write metadata to the video
- file</p>
- <p style="margin-left:11%;"><b>−−metadata−from−title</b>
- <i>FORMAT</i></p>
- <p style="margin-left:22%;">Parse additional metadata like
- song title / artist from the video title. The format syntax
- is the same as −−output, the parsed parameters
- replace existing values. Additional templates: %(album)s,
- %(artist)s. Example:
- −−metadata−from−title
- "%(artist)s − %(title)s" matches a title
- like "Coldplay − Paradise"</p>
- <p style="margin-left:11%;"><b>−−xattrs</b></p>
- <p style="margin-left:22%;">Write metadata to the video
- file's xattrs (using dublin core and xdg standards)</p>
- <p style="margin-left:11%;"><b>−−fixup</b>
- <i>POLICY</i></p>
- <p style="margin-left:22%;">Automatically correct known
- faults of the file. One of never (do nothing), warn (only
- emit a warning), detect_or_warn (the default; fix file if we
- can, warn otherwise)</p>
- <p style="margin-left:11%;"><b>−−prefer−avconv</b></p>
- <p style="margin-left:22%;">Prefer avconv over ffmpeg for
- running the postprocessors (default)</p>
- <p style="margin-left:11%;"><b>−−prefer−ffmpeg</b></p>
- <p style="margin-left:22%;">Prefer ffmpeg over avconv for
- running the postprocessors</p>
- <p style="margin-left:11%;"><b>−−ffmpeg−location</b>
- <i>PATH</i></p>
- <p style="margin-left:22%;">Location of the ffmpeg/avconv
- binary; either the path to the binary or its containing
- directory.</p>
- <p style="margin-left:11%;"><b>−−exec</b>
- <i>CMD</i></p>
- <p style="margin-left:22%;">Execute a command on the file
- after downloading, similar to find's −exec syntax.
- Example: −−exec 'adb push {} /sdcard/Music/
- && rm {}'</p>
- <p style="margin-left:11%;"><b>−−convert−subtitles</b>
- <i>FORMAT</i></p>
- <p style="margin-left:22%;">Convert the subtitles to other
- format (currently supported: srt|ass|vtt)</p>
- <h2>CONFIGURATION
- <a name="CONFIGURATION"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em">You can
- configure youtube−dl by placing any supported command
- line option to a configuration file. On Linux, the system
- wide configuration file is located at
- <tt>/etc/youtube−dl.conf</tt> and the user wide
- configuration file at
- <tt>~/.config/youtube−dl/config</tt>. On Windows, the
- user wide configuration file locations are
- <tt>%APPDATA%\youtube−dl\config.txt</tt> or
- <tt>C:\Users\<user name>\youtube−dl.conf</tt>.
- For example, with the following configuration file
- youtube−dl will always extract the audio, not copy the
- mtime and use a proxy:</p>
- <pre style="margin-left:22%; margin-top: 1em">−−extract−audio
- −−no−mtime
- −−proxy 127.0.0.1:3128</pre>
- <p style="margin-left:11%; margin-top: 1em">You can use
- <tt>−−ignore−config</tt> if you want to
- disable the configuration file for a particular
- youtube−dl run.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Authentication
- with</b> <tt>.netrc</tt> <b>file</b> <br>
- You may also want to configure automatic credentials storage
- for extractors that support authentication (by providing
- login and password with <tt>−−username</tt> and
- <tt>−−password</tt>) in order not to pass
- credentials as command line arguments on every
- youtube−dl execution and prevent tracking plain text
- passwords in the shell command history. You can achieve this
- using a <tt>.netrc</tt> file
- (http://stackoverflow.com/tags/.netrc/info) on per extractor
- basis. For that you will need to create a<tt>.netrc</tt>
- file in your <tt>$HOME</tt> and restrict permissions to
- read/write by you only:</p>
- <pre style="margin-left:22%; margin-top: 1em">touch $HOME/.netrc
- chmod a−rwx,u+rw $HOME/.netrc</pre>
- <p style="margin-left:11%; margin-top: 1em">After that you
- can add credentials for extractor in the following format,
- where <i>extractor</i> is the name of extractor in
- lowercase:</p>
- <pre style="margin-left:22%; margin-top: 1em">machine <extractor> login <login> password <password></pre>
- <p style="margin-left:11%; margin-top: 1em">For
- example:</p>
- <pre style="margin-left:22%; margin-top: 1em">machine youtube login myaccount@gmail.com password my_youtube_password
- machine twitch login my_twitch_account_name password my_twitch_password</pre>
- <p style="margin-left:11%; margin-top: 1em">To activate
- authentication with the <tt>.netrc</tt> file you should pass
- <tt>−−netrc</tt> to youtube−dl or place it
- in the configuration file (#configuration).</p>
- <p style="margin-left:11%; margin-top: 1em">On Windows you
- may also need to setup the <tt>%HOME%</tt> environment
- variable manually.</p>
- <h2>OUTPUT TEMPLATE
- <a name="OUTPUT TEMPLATE"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em">The
- <tt>−o</tt> option allows users to indicate a template
- for the output file names. The basic usage is not to set any
- template arguments when downloading a single file, like in
- <tt>youtube−dl −o funny_video.flv "http://some/video"</tt>.
- However, it may contain special sequences that will be
- replaced when downloading each video. The special sequences
- have the format <tt>%(NAME)s</tt>. To clarify, that is a
- percent symbol followed by a name in parentheses, followed
- by a lowercase S. Allowed names are:</p>
- <table width="100%" border="0" rules="none" frame="void"
- cellspacing="0" cellpadding="0">
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>id</tt>: The sequence will be replaced by the video
- identifier.</p> </td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>url</tt>: The sequence will be replaced by the video
- URL.</p> </td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>uploader</tt>: The sequence will be replaced by the
- nickname of the person who uploaded the video.</p></td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>upload_date</tt>: The sequence will be replaced by
- the upload date in YYYYMMDD format.</p></td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>title</tt>: The sequence will be replaced by the
- video title.</p></td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>ext</tt>: The sequence will be replaced by the
- appropriate extension (like flv or mp4).</p></td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>epoch</tt>: The sequence will be replaced by the
- Unix epoch when creating the file.</p></td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>autonumber</tt>: The sequence will be replaced by a
- five−digit number that will be increased with each
- download, starting at zero.</p></td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>playlist</tt>: The sequence will be replaced by the
- name or the id of the playlist that contains the video.</p></td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>playlist_index</tt>: The sequence will be replaced
- by the index of the video in the playlist padded with
- leading zeros according to the total length of the
- playlist.</p> </td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>format_id</tt>: The sequence will be replaced by the
- format code specified by <tt>−−format</tt>.</p></td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p><tt>duration</tt>: The sequence will be replaced by the
- length of the video in seconds.</p></td></tr>
- </table>
- <p style="margin-left:11%; margin-top: 1em">The current
- default template is
- <tt>%(title)s−%(id)s.%(ext)s</tt>.</p>
- <p style="margin-left:11%; margin-top: 1em">In some cases,
- you don't want special characters such as ä¸,
- spaces, or &, such as when transferring the downloaded
- filename to a Windows system or the filename through an
- 8bit−unsafe channel. In these cases, add the
- <tt>−−restrict−filenames</tt> flag to get
- a shorter title:</p>
- <pre style="margin-left:22%; margin-top: 1em">$ youtube−dl −−get−filename −o "%(title)s.%(ext)s" BaW_jenozKc
- youtube−dl test video ''_äâð.mp4 # All kinds of weird characters
- $ youtube−dl −−get−filename −o "%(title)s.%(ext)s" BaW_jenozKc −−restrict−filenames
- youtube−dl_test_video_.mp4 # A simple file name</pre>
- <h2>FORMAT SELECTION
- <a name="FORMAT SELECTION"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em">By default
- youtube−dl tries to download the best quality, but
- sometimes you may want to download in a different format.
- The simplest case is requesting a specific format, for
- example <tt>−f 22</tt>. You can get the list of
- available formats using
- <tt>−−list−formats</tt>, you can also use
- a file extension (currently it supports aac, m4a, mp3, mp4,
- ogg, wav, webm) or the special names <tt>best</tt>,
- <tt>bestvideo</tt>, <tt>bestaudio</tt> and
- <tt>worst</tt>.</p>
- <p style="margin-left:11%; margin-top: 1em">If you want to
- download multiple videos and they don't have the same
- formats available, you can specify the order of preference
- using slashes, as in <tt>−f 22/17/18</tt>. You
- can also filter the video results by putting a condition in
- brackets, as in
- <tt>−f "best[height=720]"</tt> (or
- <tt>−f "[filesize>10M]"</tt>). This
- works for filesize, height, width, tbr, abr, vbr, asr, and
- fps and the comparisons <, <=, >, >=, =, != and
- for ext, acodec, vcodec, container, and protocol and the
- comparisons =, != . Formats for which the value is not known
- are excluded unless you put a question mark (?) after the
- operator. You can combine format filters, so
- <tt>−f "[height <=? 720][tbr>500]"</tt>
- selects up to 720p videos (or videos where the height is not
- known) with a bitrate of at least 500 KBit/s. Use commas to
- download multiple formats, such as
- <tt>−f 136/137/mp4/bestvideo,140/m4a/bestaudio</tt>.
- You can merge the video and audio of two formats into a
- single file using
- <tt>−f <video−format>+<audio−format></tt>
- (requires ffmpeg or avconv), for example
- <tt>−f bestvideo+bestaudio</tt>. Format selectors
- can also be grouped using parentheses, for example if you
- want to download the best mp4 and webm formats with a height
- lower than 480 you can use
- <tt>−f '(mp4,webm)[height<480]'</tt>.</p>
- <p style="margin-left:11%; margin-top: 1em">Since the end
- of April 2015 and version 2015.04.26 youtube−dl uses
- <tt>−f bestvideo+bestaudio/best</tt> as default
- format selection (see #5447, #5456). If ffmpeg or avconv are
- installed this results in downloading <tt>bestvideo</tt> and
- <tt>bestaudio</tt> separately and muxing them together into
- a single file giving the best overall quality available.
- Otherwise it falls back to <tt>best</tt> and results in
- downloading the best available quality served as a single
- file. <tt>best</tt> is also needed for videos that don't
- come from YouTube because they don't provide the audio and
- video in two different files. If you want to only download
- some dash formats (for example if you are not interested in
- getting videos with a resolution higher than 1080p), you can
- add
- <tt>−f bestvideo[height<=?1080]+bestaudio/best</tt>
- to your configuration file. Note that if you use
- youtube−dl to stream to <tt>stdout</tt> (and most
- likely to pipe it to your media player then), i.e. you
- explicitly specify output template as
- <tt>−o −</tt>, youtube−dl still uses
- <tt>−f best</tt> format selection in order to
- start content delivery immediately to your player and not to
- wait until <tt>bestvideo</tt> and <tt>bestaudio</tt> are
- downloaded and muxed.</p>
- <p style="margin-left:11%; margin-top: 1em">If you want to
- preserve the old format selection behavior (prior to
- youtube−dl 2015.04.26), i.e. you want to download the
- best available quality media served as a single file, you
- should explicitly specify your choice with
- <tt>−f best</tt>. You may want to add it to the
- configuration file (#configuration) in order not to type it
- every time you run youtube−dl.</p>
- <h2>VIDEO SELECTION
- <a name="VIDEO SELECTION"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em">Videos can be
- filtered by their upload date using the options
- <tt>−−date</tt>,
- <tt>−−datebefore</tt> or
- <tt>−−dateafter</tt>. They accept dates in two
- formats:</p>
- <table width="100%" border="0" rules="none" frame="void"
- cellspacing="0" cellpadding="0">
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p style="margin-top: 1em">•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p style="margin-top: 1em">Absolute dates: Dates in the
- format <tt>YYYYMMDD</tt>.</p></td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="86%">
- <p>Relative dates: Dates in the format
- <tt>(now|today)[+−][0−9](day|week|month|year)(s)?</tt></p> </td></tr>
- </table>
- <p style="margin-left:11%; margin-top: 1em">Examples:</p>
- <pre style="margin-left:22%; margin-top: 1em"># Download only the videos uploaded in the last 6 months
- $ youtube−dl −−dateafter now−6months
- # Download only the videos uploaded on January 1, 1970
- $ youtube−dl −−date 19700101
- $ # Download only the videos uploaded in the 200x decade
- $ youtube−dl −−dateafter 20000101 −−datebefore 20091231</pre>
- <h2>FAQ
- <a name="FAQ"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em"><b>How do I
- update youtube−dl?</b> <br>
- If you've followed our manual installation instructions
- (http://rg3.github.io/youtube-dl/download.html), you can
- simply run <tt>youtube−dl −U</tt> (or, on
- Linux,
- <tt>sudo youtube−dl −U</tt>).</p>
- <p style="margin-left:11%; margin-top: 1em">If you have
- used pip, a simple
- <tt>sudo pip install −U youtube−dl</tt>
- is sufficient to update.</p>
- <p style="margin-left:11%; margin-top: 1em">If you have
- installed youtube−dl using a package manager like
- <i>apt−get</i> or <i>yum</i>, use the standard system
- update mechanism to update. Note that distribution packages
- are often outdated. As a rule of thumb, youtube−dl
- releases at least once a month, and often weekly or even
- daily. Simply go to http://yt−dl.org/ to find out the
- current version. Unfortunately, there is nothing we
- youtube−dl developers can do if your distribution
- serves a really outdated version. You can (and should)
- complain to your distribution in their bugtracker or support
- forum.</p>
- <p style="margin-left:11%; margin-top: 1em">As a last
- resort, you can also uninstall the version installed by your
- package manager and follow our manual installation
- instructions. For that, remove the distribution's package,
- with a line like</p>
- <pre style="margin-left:22%; margin-top: 1em">sudo apt−get remove −y youtube−dl</pre>
- <p style="margin-left:11%; margin-top: 1em">Afterwards,
- simply follow our manual installation instructions
- (http://rg3.github.io/youtube-dl/download.html):</p>
- <pre style="margin-left:22%; margin-top: 1em">sudo wget https://yt−dl.org/latest/youtube−dl −O /usr/local/bin/youtube−dl
- sudo chmod a+x /usr/local/bin/youtube−dl
- hash −r</pre>
- <p style="margin-left:11%; margin-top: 1em">Again, from
- then on you'll be able to update with
- <tt>sudo youtube−dl −U</tt>.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>I'm getting
- an error</b> <tt><br>
- Unable to extract OpenGraph title</tt>
- on YouTube playlists</p>
- <p style="margin-left:11%; margin-top: 1em">YouTube changed
- their playlist format in March 2014 and later on, so you'll
- need at least youtube−dl 2014.07.25 to download all
- YouTube videos.</p>
- <p style="margin-left:11%; margin-top: 1em">If you have
- installed youtube−dl with a package manager, pip,
- setup.py or a tarball, please use that to update. Note that
- Ubuntu packages do not seem to get updated anymore. Since we
- are not affiliated with Ubuntu, there is little we can do.
- Feel free to report bugs
- (https://bugs.launchpad.net/ubuntu/+source/youtube-dl/+filebug)
- to the Ubuntu packaging guys
- (mailto:ubuntu-motu@lists.ubuntu.com?subject=outdated%20version%20of%20youtube-dl)
- − all they have to do is update the package to a
- somewhat recent version. See above for a way to update.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Do I always
- have to pass</b> <tt>−citw</tt><b>?</b> <br>
- By default, youtube−dl intends to have the best
- options (incidentally, if you have a convincing case that
- these should be different, please file an issue where you
- explain that (https://yt-dl.org/bug)). Therefore, it is
- unnecessary and sometimes harmful to copy long option
- strings from webpages. In particular, the only option out of
- <tt>−citw</tt> that is regularly useful is
- <tt>−i</tt>.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Can you
- please put the</b> <tt>−b</tt> <b>option back?</b>
- <br>
- Most people asking this question are not aware that
- youtube−dl now defaults to downloading the highest
- available quality as reported by YouTube, which will be
- 1080p or 720p in some cases, so you no longer need the
- <tt>−b</tt> option. For some specific videos, maybe
- YouTube does not report them to be available in a specific
- high quality format you're interested in. In that case,
- simply request it with the <tt>−f</tt> option and
- youtube−dl will try to download it.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>I get HTTP
- error 402 when trying to download a video. What's</b> <br>
- this?</p>
- <p style="margin-left:11%; margin-top: 1em">Apparently
- YouTube requires you to pass a CAPTCHA test if you download
- too much. We're considering to provide a way to let you
- solve the CAPTCHA
- (https://github.com/rg3/youtube-dl/issues/154), but at the
- moment, your best course of action is pointing a webbrowser
- to the youtube URL, solving the CAPTCHA, and restart
- youtube−dl.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Do I need
- any other programs?</b> <br>
- youtube−dl works fine on its own on most sites.
- However, if you want to convert video/audio, you'll need
- avconv (https://libav.org/) or ffmpeg
- (https://www.ffmpeg.org/). On some sites − most
- notably YouTube − videos can be retrieved in a higher
- quality format without sound. youtube−dl will detect
- whether avconv/ffmpeg is present and automatically pick the
- best option.</p>
- <p style="margin-left:11%; margin-top: 1em">Videos or video
- formats streamed via RTMP protocol can only be downloaded
- when rtmpdump (https://rtmpdump.mplayerhq.hu/) is installed.
- Downloading MMS and RTSP videos requires either mplayer
- (http://mplayerhq.hu/) or mpv (https://mpv.io/) to be
- installed.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>I have
- downloaded a video but how can I play it?</b> <br>
- Once the video is fully downloaded, use any video player,
- such as vlc (http://www.videolan.org) or mplayer
- (http://www.mplayerhq.hu/).</p>
- <p style="margin-left:11%; margin-top: 1em"><b>I extracted
- a video URL with</b> <tt>−g</tt><b>, but it does not
- play on</b> <br>
- another machine / in my webbrowser.</p>
- <p style="margin-left:11%; margin-top: 1em">It depends a
- lot on the service. In many cases, requests for the video
- (to download/play it) must come from the same IP address and
- with the same cookies. Use the
- <tt>−−cookies</tt> option to write the required
- cookies into a file, and advise your downloader to read
- cookies from that file. Some sites also require a common
- user agent to be used, use
- <tt>−−dump−user−agent</tt> to see
- the one in use by youtube−dl.</p>
- <p style="margin-left:11%; margin-top: 1em">It may be
- beneficial to use IPv6; in some cases, the restrictions are
- only applied to IPv4. Some services (sometimes only for a
- subset of videos) do not restrict the video URL by IP
- address, cookie, or user−agent, but these are the
- exception rather than the rule.</p>
- <p style="margin-left:11%; margin-top: 1em">Please bear in
- mind that some URL protocols are <b>not</b> supported by
- browsers out of the box, including RTMP. If you are using
- <tt>−g</tt>, your own downloader must support these as
- well.</p>
- <p style="margin-left:11%; margin-top: 1em">If you want to
- play the video on a machine that is not running
- youtube−dl, you can relay the video content from the
- machine that runs youtube−dl. You can use
- <tt>−o −</tt> to let youtube−dl
- stream a video to stdout, or simply allow the player to
- download the files written by youtube−dl in turn.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>ERROR: no
- fmt_url_map or conn information found in video info</b> <br>
- YouTube has switched to a new video info format in July 2011
- which is not supported by old versions of youtube−dl.
- See above (#how-do-i-update-youtube-dl) for how to update
- youtube−dl.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>ERROR:
- unable to download video</b> <br>
- YouTube requires an additional signature since September
- 2012 which is not supported by old versions of
- youtube−dl. See above (#how-do-i-update-youtube-dl)
- for how to update youtube−dl.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Video URL
- contains an ampersand and I'm getting some strange</b> <br>
- output <tt>[1] 2839</tt> or
- <tt>'v' is not recognized as an internal or external command</tt></p>
- <p style="margin-left:11%; margin-top: 1em">That's actually
- the output from your shell. Since ampersand is one of the
- special shell characters it's interpreted by the shell
- preventing you from passing the whole URL to
- youtube−dl. To disable your shell from interpreting
- the ampersands (or any other special characters) you have to
- either put the whole URL in quotes or escape them with a
- backslash (which approach will work depends on your
- shell).</p>
- <p style="margin-left:11%; margin-top: 1em">For example if
- your URL is
- https://www.youtube.com/watch?t=4&v=BaW_jenozKc you
- should end up with following command:</p>
- <p style="margin-left:11%; margin-top: 1em"><tt>youtube−dl 'https://www.youtube.com/watch?t=4&v=BaW_jenozKc'</tt></p>
- <p style="margin-left:11%; margin-top: 1em">or</p>
- <p style="margin-left:11%; margin-top: 1em"><tt>youtube−dl https://www.youtube.com/watch?t=4\&v=BaW_jenozKc</tt></p>
- <p style="margin-left:11%; margin-top: 1em">For Windows you
- have to use the double quotes:</p>
- <p style="margin-left:11%; margin-top: 1em"><tt>youtube−dl "https://www.youtube.com/watch?t=4&v=BaW_jenozKc"</tt></p>
- <p style="margin-left:11%; margin-top: 1em"><b>ExtractorError:
- Could not find JS function u'OF'</b> <br>
- In February 2015, the new YouTube player contained a
- character sequence in a string that was misinterpreted by
- old versions of youtube−dl. See above
- (#how-do-i-update-youtube-dl) for how to update
- youtube−dl.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>HTTP Error
- 429: Too Many Requests or 402: Payment Required</b> <br>
- These two error codes indicate that the service is blocking
- your IP address because of overuse. Contact the service and
- ask them to unblock your IP address, or − if you have
- acquired a whitelisted IP address already − use the
- <tt>−−proxy</tt> or
- <tt>−−source−address</tt> options
- (#network-options) to select another IP address.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>SyntaxError:
- Non−ASCII character</b> <br>
- The error</p>
- <pre style="margin-left:22%; margin-top: 1em">File "youtube−dl", line 2
- SyntaxError: Non−ASCII character '\x93' ...</pre>
- <p style="margin-left:11%; margin-top: 1em">means you're
- using an outdated version of Python. Please update to Python
- 2.6 or 2.7.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>What is this
- binary file? Where has the code gone?</b> <br>
- Since June 2012 (#342) youtube−dl is packed as an
- executable zipfile, simply unzip it (might need renaming to
- <tt>youtube−dl.zip</tt> first on some systems) or
- clone the git repository, as laid out above. If you modify
- the code, you can run it by executing the
- <tt>__main__.py</tt> file. To recompile the executable, run
- <tt>make youtube−dl</tt>.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>The exe
- throws a</b> <i>Runtime error from Visual C++</i> <br>
- To run the exe you need to install first the Microsoft
- Visual C++ 2008 Redistributable Package
- (http://www.microsoft.com/en-us/download/details.aspx?id=29).</p>
- <p style="margin-left:11%; margin-top: 1em"><b>On Windows,
- how should I set up ffmpeg and youtube−dl? Where
- should</b> <br>
- I put the exe files?</p>
- <p style="margin-left:11%; margin-top: 1em">If you put
- youtube−dl and ffmpeg in the same directory that
- you're running the command from, it will work, but that's
- rather cumbersome.</p>
- <p style="margin-left:11%; margin-top: 1em">To make a
- different directory work − either for ffmpeg, or for
- youtube−dl, or for both − simply create the
- directory (say, <tt>C:\bin</tt>, or
- <tt>C:\Users\<User name>\bin</tt>), put all the
- executables directly in there, and then set your PATH
- environment variable
- (https://www.java.com/en/download/help/path.xml) to include
- that directory.</p>
- <p style="margin-left:11%; margin-top: 1em">From then on,
- after restarting your shell, you will be able to access both
- youtube−dl and ffmpeg (and youtube−dl will be
- able to find ffmpeg) by simply typing
- <tt>youtube−dl</tt> or <tt>ffmpeg</tt>, no matter what
- directory you're in.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>How do I put
- downloads into a specific folder?</b> <br>
- Use the <tt>−o</tt> to specify an output template
- (#output-template), for example
- <tt>−o "/home/user/videos/%(title)s−%(id)s.%(ext)s"</tt>.
- If you want this for all of your downloads, put the option
- into your configuration file (#configuration).</p>
- <p style="margin-left:11%; margin-top: 1em"><b>How do I
- download a video starting with a</b>
- <tt>−</tt><b>?</b> <br>
- Either prepend <tt>http://www.youtube.com/watch?v=</tt> or
- separate the ID from the options with
- <tt>−−</tt>:</p>
- <pre style="margin-left:22%; margin-top: 1em">youtube−dl −− −wNyEUrxzFU
- youtube−dl "http://www.youtube.com/watch?v=−wNyEUrxzFU"</pre>
- <p style="margin-left:11%; margin-top: 1em"><b>How do I
- pass cookies to youtube−dl?</b> <br>
- Use the <tt>−−cookies</tt> option, for example
- <tt>−−cookies /path/to/cookies/file.txt</tt>.
- Note that the cookies file must be in Mozilla/Netscape
- format and the first line of the cookies file must be either
- <tt># HTTP Cookie File</tt> or
- <tt># Netscape HTTP Cookie File</tt>.
- Make sure you have correct newline format
- (https://en.wikipedia.org/wiki/Newline) in the cookies file
- and convert newlines if necessary to correspond with your
- OS, namely <tt>CRLF</tt> (<tt>\r\n</tt>) for Windows,
- <tt>LF</tt> (<tt>\n</tt>) for Linux and <tt>CR</tt>
- (<tt>\r</tt>) for Mac OS.
- <tt>HTTP Error 400: Bad Request</tt>
- when using <tt>−−cookies</tt> is a good sign of
- invalid newline format.</p>
- <p style="margin-left:11%; margin-top: 1em">Passing cookies
- to youtube−dl is a good way to workaround login when a
- particular extractor does not implement it explicitly.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Can you add
- support for this anime video site, or site which shows</b>
- <br>
- current movies for free?</p>
- <p style="margin-left:11%; margin-top: 1em">As a matter of
- policy (as well as legality), youtube−dl does not
- include support for services that specialize in infringing
- copyright. As a rule of thumb, if you cannot easily find a
- video that the service is quite obviously allowed to
- distribute (i.e. that has been uploaded by the creator, the
- creator's distributor, or is published under a free
- license), the service is probably unfit for inclusion to
- youtube−dl.</p>
- <p style="margin-left:11%; margin-top: 1em">A note on the
- service that they don't host the infringing content, but
- just link to those who do, is evidence that the service
- should <b>not</b> be included into youtube−dl. The
- same goes for any DMCA note when the whole front page of the
- service is filled with videos they are not allowed to
- distribute. A "fair use" note is equally
- unconvincing if the service shows copyright−protected
- videos in full without authorization.</p>
- <p style="margin-left:11%; margin-top: 1em">Support
- requests for services that <b>do</b> purchase the rights to
- distribute their content are perfectly fine though. If in
- doubt, you can simply include a source that mentions the
- legitimate purchase of content.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>How can I
- speed up work on my issue?</b> <br>
- (Also known as: Help, my important issue not being solved!)
- The youtube−dl core developer team is quite small.
- While we do our best to solve as many issues as possible,
- sometimes that can take quite a while. To speed up your
- issue, here's what you can do:</p>
- <p style="margin-left:11%; margin-top: 1em">First of all,
- please do report the issue at our issue tracker
- (https://yt-dl.org/bugs). That allows us to coordinate all
- efforts by users and developers, and serves as a unified
- point. Unfortunately, the youtube−dl project has grown
- too large to use personal email as an effective
- communication channel.</p>
- <p style="margin-left:11%; margin-top: 1em">Please read the
- bug reporting instructions (#bugs) below. A lot of bugs lack
- all the necessary information. If you can, offer proxy, VPN,
- or shell access to the youtube−dl developers. If you
- are able to, test the issue from multiple computers in
- multiple countries to exclude local censorship or
- misconfiguration issues.</p>
- <p style="margin-left:11%; margin-top: 1em">If nobody is
- interested in solving your issue, you are welcome to take
- matters into your own hands and submit a pull request (or
- coerce/pay somebody else to do so).</p>
- <p style="margin-left:11%; margin-top: 1em">Feel free to
- bump the issue from time to time by writing a small comment
- ("Issue is still present in youtube−dl version
- ...from France, but fixed from Belgium"), but please
- not more than once a month. Please do not declare your issue
- as <tt>important</tt> or <tt>urgent</tt>.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>How can I
- detect whether a given URL is supported by
- youtube−dl?</b> <br>
- For one, have a look at the list of supported sites
- (docs/supportedsites.md). Note that it can sometimes happen
- that the site changes its URL scheme (say, from
- http://example.com/video/1234567 to
- http://example.com/v/1234567 ) and youtube−dl reports
- an URL of a service in that list as unsupported. In that
- case, simply report a bug.</p>
- <p style="margin-left:11%; margin-top: 1em">It is
- <i>not</i> possible to detect whether a URL is supported or
- not. That's because youtube−dl contains a generic
- extractor which matches <b>all</b> URLs. You may be tempted
- to disable, exclude, or remove the generic extractor, but
- the generic extractor not only allows users to extract
- videos from lots of websites that embed a video from another
- service, but may also be used to extract video from a
- service that it's hosting itself. Therefore, we neither
- recommend nor support disabling, excluding, or removing the
- generic extractor.</p>
- <p style="margin-left:11%; margin-top: 1em">If you want to
- find out whether a given URL is supported, simply call
- youtube−dl with it. If you get no videos back, chances
- are the URL is either not referring to a video or
- unsupported. You can find out which by examining the output
- (if you run youtube−dl on the console) or catching an
- <tt>UnsupportedError</tt> exception if you run it from a
- Python program.</p>
- <h2>DEVELOPER INSTRUCTIONS
- <a name="DEVELOPER INSTRUCTIONS"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em">Most users do
- not need to build youtube−dl and can download the
- builds (http://rg3.github.io/youtube-dl/download.html) or
- get them from their distribution.</p>
- <p style="margin-left:11%; margin-top: 1em">To run
- youtube−dl as a developer, you don't need to build
- anything either. Simply execute</p>
- <pre style="margin-left:22%; margin-top: 1em">python −m youtube_dl</pre>
- <p style="margin-left:11%; margin-top: 1em">To run the
- test, simply invoke your favorite test runner, or execute a
- test file directly; any of the following work:</p>
- <pre style="margin-left:22%; margin-top: 1em">python −m unittest discover
- python test/test_download.py
- nosetests</pre>
- <p style="margin-left:11%; margin-top: 1em">If you want to
- create a build of youtube−dl yourself, you'll need</p>
- <table width="100%" border="0" rules="none" frame="void"
- cellspacing="0" cellpadding="0">
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p style="margin-top: 1em">•</p></td>
- <td width="2%"></td>
- <td width="14%">
- <p style="margin-top: 1em">python</p></td>
- <td width="72%">
- </td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="14%">
- <p>make</p></td>
- <td width="72%">
- </td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="14%">
- <p>pandoc</p></td>
- <td width="72%">
- </td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="14%">
- <p>zip</p></td>
- <td width="72%">
- </td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="14%">
- <p>nosetests</p></td>
- <td width="72%">
- </td></tr>
- </table>
- <p style="margin-left:11%; margin-top: 1em"><b>Adding
- support for a new site</b> <br>
- If you want to add support for a new site, you can follow
- this quick list (assuming your service is called
- <tt>yourextractor</tt>):</p>
- <table width="100%" border="0" rules="none" frame="void"
- cellspacing="0" cellpadding="0">
- <tr valign="top" align="left">
- <td width="12%"></td>
- <td width="3%">
- <p style="margin-top: 1em">1.</p></td>
- <td width="2%"></td>
- <td width="83%">
- <p style="margin-top: 1em">Fork this repository
- (https://github.com/rg3/youtube-dl/fork)</p> </td></tr>
- <tr valign="top" align="left">
- <td width="12%"></td>
- <td width="3%">
- <p>2.</p></td>
- <td width="2%"></td>
- <td width="83%">
- <p>Check out the source code with
- <tt>git clone git@github.com:YOUR_GITHUB_USERNAME/youtube−dl.git</tt></p> </td></tr>
- <tr valign="top" align="left">
- <td width="12%"></td>
- <td width="3%">
- <p>3.</p></td>
- <td width="2%"></td>
- <td width="83%">
- <p>Start a new git branch with
- <tt>cd youtube−dl; git checkout −b yourextractor</tt></p> </td></tr>
- <tr valign="top" align="left">
- <td width="12%"></td>
- <td width="3%">
- <p>4.</p></td>
- <td width="2%"></td>
- <td width="83%">
- <p>Start with this simple template and save it to
- <tt>youtube_dl/extractor/yourextractor.py</tt>:</p> </td></tr>
- </table>
- <pre style="margin-left:28%; margin-top: 1em"># coding: utf−8
- from __future__ import unicode_literals
- from .common import InfoExtractor
- class YourExtractorIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?yourextractor\.com/watch/(?P<id>[0−9]+)'
- _TEST = {
- 'url': 'http://yourextractor.com/watch/42',
- 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use −−test)',
- 'info_dict': {
- 'id': '42',
- 'ext': 'mp4',
- 'title': 'Video title goes here',
- 'thumbnail': 're:^https?://.*\.jpg$',
- # TODO more properties, either as:
- # * A value
- # * MD5 checksum; start the string with md5:
- # * A regular expression; start the string with re:
- # * Any Python type (for example int or float)
- }
- }
- def _real_extract(self, url):
- video_id = self._match_id(url)
- webpage = self._download_webpage(url, video_id)
- # TODO more code goes here, for example ...
- title = self._html_search_regex(r'<h1>(.+?)</h1>', webpage, 'title')
- return {
- 'id': video_id,
- 'title': title,
- 'description': self._og_search_description(webpage),
- 'uploader': self._search_regex(r'<div[^>]+id="uploader"[^>]*>([^<]+)<', webpage, 'uploader', fatal=False),
- # TODO more properties (see youtube_dl/extractor/common.py)
- }</pre>
- <table width="100%" border="0" rules="none" frame="void"
- cellspacing="0" cellpadding="0">
- <tr valign="top" align="left">
- <td width="12%"></td>
- <td width="3%">
- <p style="margin-top: 1em">5.</p></td>
- <td width="2%"></td>
- <td width="83%">
- <p style="margin-top: 1em">Add an import in
- <tt>youtube_dl/extractor/__init__.py</tt>
- (https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/__init__.py).</p> </td></tr>
- <tr valign="top" align="left">
- <td width="12%"></td>
- <td width="3%">
- <p>6.</p></td>
- <td width="2%"></td>
- <td width="83%">
- <p>Run
- <tt>python test/test_download.py TestDownload.test_YourExtractor</tt>.
- This <i>should fail</i> at first, but you can continually
- re−run it until you're done. If you decide to add more
- than one test, then rename <tt>_TEST</tt> to <tt>_TESTS</tt>
- and make it into a list of dictionaries. The tests will then
- be named <tt>TestDownload.test_YourExtractor</tt>,
- <tt>TestDownload.test_YourExtractor_1</tt>,
- <tt>TestDownload.test_YourExtractor_2</tt>, etc.</p></td></tr>
- <tr valign="top" align="left">
- <td width="12%"></td>
- <td width="3%">
- <p>7.</p></td>
- <td width="2%"></td>
- <td width="83%">
- <p>Have a look at <tt>youtube_dl/extractor/common.py</tt>
- (https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py)
- for possible helper methods and a detailed description of
- what your extractor should and may return
- (https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/common.py#L62-L200).
- Add tests and code for as many as you want.</p></td></tr>
- <tr valign="top" align="left">
- <td width="12%"></td>
- <td width="3%">
- <p>8.</p></td>
- <td width="2%"></td>
- <td width="83%">
- <p>If you can, check the code with flake8
- (https://pypi.python.org/pypi/flake8).</p> </td></tr>
- <tr valign="top" align="left">
- <td width="12%"></td>
- <td width="3%">
- <p>9.</p></td>
- <td width="2%"></td>
- <td width="83%">
- <p>When the tests pass, add
- (http://git-scm.com/docs/git-add) the new files and commit
- (http://git-scm.com/docs/git-commit) them and push
- (http://git-scm.com/docs/git-push) the result, like
- this:</p> </td></tr>
- </table>
- <pre style="margin-left:28%; margin-top: 1em">$ git add youtube_dl/extractor/__init__.py
- $ git add youtube_dl/extractor/yourextractor.py
- $ git commit −m '[yourextractor] Add new extractor'
- $ git push origin yourextractor</pre>
- <table width="100%" border="0" rules="none" frame="void"
- cellspacing="0" cellpadding="0">
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="4%">
- <p style="margin-top: 1em">10.</p></td>
- <td width="2%"></td>
- <td width="83%">
- <p style="margin-top: 1em">Finally, create a pull request
- (https://help.github.com/articles/creating-a-pull-request).
- We'll then review and merge it.</p></td></tr>
- </table>
- <p style="margin-left:11%; margin-top: 1em">In any case,
- thank you very much for your contributions!</p>
- <h2>EMBEDDING YOUTUBE−DL
- <a name="EMBEDDING YOUTUBE−DL"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em">youtube−dl
- makes the best effort to be a good command−line
- program, and thus should be callable from any programming
- language. If you encounter any problems parsing its output,
- feel free to create a report
- (https://github.com/rg3/youtube-dl/issues/new).</p>
- <p style="margin-left:11%; margin-top: 1em">From a Python
- program, you can embed youtube−dl in a more powerful
- fashion, like this:</p>
- <pre style="margin-left:22%; margin-top: 1em">from __future__ import unicode_literals
- import youtube_dl
- ydl_opts = {}
- with youtube_dl.YoutubeDL(ydl_opts) as ydl:
- ydl.download(['http://www.youtube.com/watch?v=BaW_jenozKc'])</pre>
- <p style="margin-left:11%; margin-top: 1em">Most likely,
- you'll want to use various options. For a list of what can
- be done, have a look at <tt>youtube_dl/YoutubeDL.py</tt>
- (https://github.com/rg3/youtube-dl/blob/master/youtube_dl/YoutubeDL.py#L121-L269).
- For a start, if you want to intercept youtube−dl's
- output, set a <tt>logger</tt> object.</p>
- <p style="margin-left:11%; margin-top: 1em">Here's a more
- complete example of a program that outputs only errors (and
- a short message after the download is finished), and
- downloads/converts the video to an mp3 file:</p>
- <pre style="margin-left:22%; margin-top: 1em">from __future__ import unicode_literals
- import youtube_dl
- class MyLogger(object):
- def debug(self, msg):
- pass
- def warning(self, msg):
- pass
- def error(self, msg):
- print(msg)
- def my_hook(d):
- if d['status'] == 'finished':
- print('Done downloading, now converting ...')
- ydl_opts = {
- 'format': 'bestaudio/best',
- 'postprocessors': [{
- 'key': 'FFmpegExtractAudio',
- 'preferredcodec': 'mp3',
- 'preferredquality': '192',
- }],
- 'logger': MyLogger(),
- 'progress_hooks': [my_hook],
- }
- with youtube_dl.YoutubeDL(ydl_opts) as ydl:
- ydl.download(['http://www.youtube.com/watch?v=BaW_jenozKc'])</pre>
- <h2>BUGS
- <a name="BUGS"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em">Bugs and
- suggestions should be reported at:
- <https://github.com/rg3/youtube-dl/issues>. Unless you
- were prompted so or there is another pertinent reason (e.g.
- GitHub fails to accept the bug report), please do not send
- bug reports via personal email. For discussions, join us in
- the IRC channel #youtube−dl
- (irc://chat.freenode.net/#youtube-dl) on freenode (webchat
- (http://webchat.freenode.net/?randomnick=1&channels=youtube-dl)).</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Please
- include the full output of youtube−dl when run
- with</b> <tt>−v, i.e. add −v flag to your
- command line, copy the</tt> <b>whole</b> <tt>output and post
- it in the issue body wrapped in ‘‘‘ for
- better formatting. It should look similar to this:</tt></p>
- <p style="margin-left:22%; margin-top: 1em"><tt>$ youtube−dl −v http://www.youtube.com/watch?v=BaW_jenozKcj
- <br>
- [debug] System config: [] <br>
- [debug] User config: [] <br>
- [debug] Command−line args: [u'−v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
- <br>
- [debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
- <br>
- [debug] youtube−dl version 2015.12.06
- <br>
- [debug] Git HEAD: 135392e <br>
- [debug] Python version 2.6.6 − Windows−2003Server−5.2.3790−SP2
- <br>
- [debug] exe versions: ffmpeg N−75573−g1d0487f, ffprobe N−75573−g1d0487f, rtmpdump 2.4
- <br>
- [debug] Proxy map: {} <br>
- ...</tt></p>
- <p style="margin-left:11%; margin-top: 1em"><b>Do not post
- screenshots of verbose log only plain text is
- acceptable.</b></p>
- <p style="margin-left:11%; margin-top: 1em">The output
- (including the first lines) contains important debugging
- information. Issues without the full output are often not
- reproducible and therefore do not get solved in short order,
- if ever.</p>
- <p style="margin-left:11%; margin-top: 1em">Please
- re−read your issue once again to avoid a couple of
- common mistakes (you can and should use this as a
- checklist):</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Is the
- description of the issue itself sufficient?</b> <br>
- We often get issue reports that we cannot really decipher.
- While in most cases we eventually get the required
- information after asking back multiple times, this poses an
- unnecessary drain on our resources. Many contributors,
- including myself, are also not native speakers, so we may
- misread some parts.</p>
- <p style="margin-left:11%; margin-top: 1em">So please
- elaborate on what feature you are requesting, or what bug
- you want to be fixed. Make sure that it's obvious</p>
- <table width="100%" border="0" rules="none" frame="void"
- cellspacing="0" cellpadding="0">
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p style="margin-top: 1em">•</p></td>
- <td width="2%"></td>
- <td width="64%">
- <p style="margin-top: 1em">What the problem is</p></td>
- <td width="22%">
- </td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="64%">
- <p>How it could be fixed</p></td>
- <td width="22%">
- </td></tr>
- <tr valign="top" align="left">
- <td width="11%"></td>
- <td width="1%">
- <p>•</p></td>
- <td width="2%"></td>
- <td width="64%">
- <p>How your proposed solution would look like</p></td>
- <td width="22%">
- </td></tr>
- </table>
- <p style="margin-left:11%; margin-top: 1em">If your report
- is shorter than two lines, it is almost certainly missing
- some of these, which makes it hard for us to respond to it.
- We're often too polite to close the issue outright, but the
- missing info makes misinterpretation likely. As a committer
- myself, I often get frustrated by these issues, since the
- only possible way for me to move forward on them is to ask
- for clarification over and over.</p>
- <p style="margin-left:11%; margin-top: 1em">For bug
- reports, this means that your report should contain the
- <i>complete</i> output of youtube−dl when called with
- the <tt>−v</tt> flag. The error message you get for
- (most) bugs even says so, but you would not believe how many
- of our bug reports do not contain this information.</p>
- <p style="margin-left:11%; margin-top: 1em">If your server
- has multiple IPs or you suspect censorship, adding
- <tt>−−call−home</tt> may be a good idea to
- get more diagnostics. If the error is
- <tt>ERROR: Unable to extract ...</tt>
- and you cannot reproduce it from multiple countries, add
- <tt>−−dump−pages</tt> (warning: this will
- yield a rather large output, redirect it to the file
- <tt>log.txt</tt> by adding
- <tt>>log.txt 2>&1</tt> to your
- command−line) or upload the <tt>.dump</tt> files you
- get when you add <tt>−−write−pages</tt>
- somewhere (https://gist.github.com/).</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Site support
- requests must contain an example URL</b>. An example URL is
- a URL you might want to download, like
- <tt>http://www.youtube.com/watch?v=BaW_jenozKc</tt>. There
- should be an obvious video present. Except under very
- special circumstances, the main page of a video service
- (e.g. <tt>http://www.youtube.com/</tt>) is <i>not</i> an
- example URL.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Are you
- using the latest version?</b> <br>
- Before reporting any issue, type
- <tt>youtube−dl −U</tt>. This should report
- that you're up−to−date. About 20% of the reports
- we receive are already fixed, but people are using outdated
- versions. This goes for feature requests as well.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Is the issue
- already documented?</b> <br>
- Make sure that someone has not already opened the issue
- you're trying to open. Search at the top of the window or
- browse the GitHub Issues
- (https://github.com/rg3/youtube-dl/search?type=Issues) of
- this repository. If there is an issue, feel free to write
- something along the lines of "This affects me as well,
- with version 2015.01.01. Here is some more information on
- the issue: ...". While some issues may be old, a new
- post into them often spurs rapid activity.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Why are
- existing options not enough?</b> <br>
- Before requesting a new feature, please have a quick peek at
- the list of supported options
- (https://github.com/rg3/youtube-dl/blob/master/README.md#synopsis).
- Many feature requests are for features that actually exist
- already! Please, absolutely do show off your work in the
- issue report and detail how the existing similar options do
- <i>not</i> solve your problem.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Is there
- enough context in your bug report?</b> <br>
- People want to solve problems, and often think they do us a
- favor by breaking down their larger problems (e.g. wanting
- to skip already downloaded files) to a specific request
- (e.g. requesting us to look whether the file exists before
- downloading the info page). However, what often happens is
- that they break down the problem into two steps: One simple,
- and one impossible (or extremely complicated one).</p>
- <p style="margin-left:11%; margin-top: 1em">We are then
- presented with a very complicated request when the original
- problem could be solved far easier, e.g. by recording the
- downloaded video IDs in a separate file. To avoid this, you
- must include the greater context where it is
- non−obvious. In particular, every feature request that
- does not consist of adding support for a new site should
- contain a use case scenario that explains in what situation
- the missing feature would be useful.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Does the
- issue involve one problem, and one problem only?</b> <br>
- Some of our users seem to think there is a limit of issues
- they can or should open. There is no limit of issues they
- can or should open. While it may seem appealing to be able
- to dump all your issues into one ticket, that means that
- someone who solves one of your issues cannot mark the issue
- as closed. Typically, reporting a bunch of issues leads to
- the ticket lingering since nobody wants to attack that
- behemoth, until someone mercifully splits the issue into
- multiple ones.</p>
- <p style="margin-left:11%; margin-top: 1em">In particular,
- every site support request issue should only pertain to
- services at one site (generally under a common domain, but
- always using the same backend technology). Do not request
- support for vimeo user videos, Whitehouse podcasts, and
- Google Plus pages in the same issue. Also, make sure that
- you don't post bug reports alongside feature requests. As a
- rule of thumb, a feature request does not include outputs of
- youtube−dl that are not immediately related to the
- feature at hand. Do not post reports of a network error
- alongside the request for a new video service.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Is anyone
- going to need the feature?</b> <br>
- Only post features that you (or an incapacitated friend you
- can personally talk to) require. Do not post features
- because they seem like a good idea. If they are really
- useful, they will be requested by someone who requires
- them.</p>
- <p style="margin-left:11%; margin-top: 1em"><b>Is your
- question about youtube−dl?</b> <br>
- It may sound strange, but some bug reports we receive are
- completely unrelated to youtube−dl and relate to a
- different or even the reporter's own application. Please
- make sure that you are actually using youtube−dl. If
- you are using a UI for youtube−dl, report the bug to
- the maintainer of the actual application providing the UI.
- On the other hand, if your UI for youtube−dl fails in
- some way you believe is related to youtube−dl, by all
- means, go ahead and report the bug.</p>
- <h2>COPYRIGHT
- <a name="COPYRIGHT"></a>
- </h2>
- <p style="margin-left:11%; margin-top: 1em">youtube−dl
- is released into the public domain by the copyright
- holders.</p>
- <p style="margin-left:11%; margin-top: 1em">This README
- file was originally written by Daniel Bolton
- (https://github.com/dbbolton) and is likewise released into
- the public domain.</p>
- <hr>
- </body>
- </html>
|