You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1300 lines
205 KiB

  1. <!doctype html PUBLIC "-//W3C//DTD html 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
  5. <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' />
  6. <title>Coverage for youtube_dl: 8%</title>
  7. <link rel='stylesheet' href='style.css' type='text/css'>
  8. <script type='text/javascript' src='jquery-1.4.3.min.js'></script>
  9. <script type='text/javascript' src='jquery.hotkeys.js'></script>
  10. <script type='text/javascript' src='jquery.isonscreen.js'></script>
  11. <script type='text/javascript' src='coverage_html.js'></script>
  12. <script type='text/javascript' charset='utf-8'>
  13. jQuery(document).ready(coverage.pyfile_ready);
  14. </script>
  15. </head>
  16. <body id='pyfile'>
  17. <div id='header'>
  18. <div class='content'>
  19. <h1>Coverage for <b>youtube_dl</b> :
  20. <span class='pc_cov'>8%</span>
  21. </h1>
  22. <img id='keyboard_icon' src='keybd_closed.png'>
  23. <h2 class='stats'>
  24. 330 statements &nbsp;
  25. <span class='run hide_run shortkey_r button_toggle_run'>27 run</span>
  26. <span class='mis shortkey_m button_toggle_mis'>303 missing</span>
  27. <span class='exc shortkey_x button_toggle_exc'>0 excluded</span>
  28. </h2>
  29. </div>
  30. </div>
  31. <div class='help_panel'>
  32. <img id='panel_icon' src='keybd_open.png'>
  33. <p class='legend'>Hot-keys on this page</p>
  34. <div>
  35. <p class='keyhelp'>
  36. <span class='key'>r</span>
  37. <span class='key'>m</span>
  38. <span class='key'>x</span>
  39. <span class='key'>p</span> &nbsp; toggle line displays
  40. </p>
  41. <p class='keyhelp'>
  42. <span class='key'>j</span>
  43. <span class='key'>k</span> &nbsp; next/prev highlighted chunk
  44. </p>
  45. <p class='keyhelp'>
  46. <span class='key'>0</span> &nbsp; (zero) top of page
  47. </p>
  48. <p class='keyhelp'>
  49. <span class='key'>1</span> &nbsp; (one) first highlighted chunk
  50. </p>
  51. </div>
  52. </div>
  53. <div id='source'>
  54. <table cellspacing='0' cellpadding='0'>
  55. <tr>
  56. <td class='linenos' valign='top'>
  57. <p id='n1' class='pln'><a href='#n1'>1</a></p>
  58. <p id='n2' class='pln'><a href='#n2'>2</a></p>
  59. <p id='n3' class='pln'><a href='#n3'>3</a></p>
  60. <p id='n4' class='stm run hide_run'><a href='#n4'>4</a></p>
  61. <p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p>
  62. <p id='n6' class='pln'><a href='#n6'>6</a></p>
  63. <p id='n7' class='stm run hide_run'><a href='#n7'>7</a></p>
  64. <p id='n8' class='pln'><a href='#n8'>8</a></p>
  65. <p id='n9' class='pln'><a href='#n9'>9</a></p>
  66. <p id='n10' class='pln'><a href='#n10'>10</a></p>
  67. <p id='n11' class='pln'><a href='#n11'>11</a></p>
  68. <p id='n12' class='pln'><a href='#n12'>12</a></p>
  69. <p id='n13' class='pln'><a href='#n13'>13</a></p>
  70. <p id='n14' class='pln'><a href='#n14'>14</a></p>
  71. <p id='n15' class='pln'><a href='#n15'>15</a></p>
  72. <p id='n16' class='pln'><a href='#n16'>16</a></p>
  73. <p id='n17' class='pln'><a href='#n17'>17</a></p>
  74. <p id='n18' class='pln'><a href='#n18'>18</a></p>
  75. <p id='n19' class='pln'><a href='#n19'>19</a></p>
  76. <p id='n20' class='pln'><a href='#n20'>20</a></p>
  77. <p id='n21' class='pln'><a href='#n21'>21</a></p>
  78. <p id='n22' class='pln'><a href='#n22'>22</a></p>
  79. <p id='n23' class='pln'><a href='#n23'>23</a></p>
  80. <p id='n24' class='pln'><a href='#n24'>24</a></p>
  81. <p id='n25' class='pln'><a href='#n25'>25</a></p>
  82. <p id='n26' class='stm run hide_run'><a href='#n26'>26</a></p>
  83. <p id='n27' class='pln'><a href='#n27'>27</a></p>
  84. <p id='n28' class='stm run hide_run'><a href='#n28'>28</a></p>
  85. <p id='n29' class='stm run hide_run'><a href='#n29'>29</a></p>
  86. <p id='n30' class='stm run hide_run'><a href='#n30'>30</a></p>
  87. <p id='n31' class='stm run hide_run'><a href='#n31'>31</a></p>
  88. <p id='n32' class='stm run hide_run'><a href='#n32'>32</a></p>
  89. <p id='n33' class='stm run hide_run'><a href='#n33'>33</a></p>
  90. <p id='n34' class='stm run hide_run'><a href='#n34'>34</a></p>
  91. <p id='n35' class='stm run hide_run'><a href='#n35'>35</a></p>
  92. <p id='n36' class='stm run hide_run'><a href='#n36'>36</a></p>
  93. <p id='n37' class='pln'><a href='#n37'>37</a></p>
  94. <p id='n38' class='stm run hide_run'><a href='#n38'>38</a></p>
  95. <p id='n39' class='stm run hide_run'><a href='#n39'>39</a></p>
  96. <p id='n40' class='stm run hide_run'><a href='#n40'>40</a></p>
  97. <p id='n41' class='stm run hide_run'><a href='#n41'>41</a></p>
  98. <p id='n42' class='stm run hide_run'><a href='#n42'>42</a></p>
  99. <p id='n43' class='pln'><a href='#n43'>43</a></p>
  100. <p id='n44' class='stm run hide_run'><a href='#n44'>44</a></p>
  101. <p id='n45' class='pln'><a href='#n45'>45</a></p>
  102. <p id='n46' class='pln'><a href='#n46'>46</a></p>
  103. <p id='n47' class='pln'><a href='#n47'>47</a></p>
  104. <p id='n48' class='pln'><a href='#n48'>48</a></p>
  105. <p id='n49' class='stm mis'><a href='#n49'>49</a></p>
  106. <p id='n50' class='pln'><a href='#n50'>50</a></p>
  107. <p id='n51' class='stm mis'><a href='#n51'>51</a></p>
  108. <p id='n52' class='stm mis'><a href='#n52'>52</a></p>
  109. <p id='n53' class='stm mis'><a href='#n53'>53</a></p>
  110. <p id='n54' class='pln'><a href='#n54'>54</a></p>
  111. <p id='n55' class='stm mis'><a href='#n55'>55</a></p>
  112. <p id='n56' class='stm mis'><a href='#n56'>56</a></p>
  113. <p id='n57' class='stm mis'><a href='#n57'>57</a></p>
  114. <p id='n58' class='pln'><a href='#n58'>58</a></p>
  115. <p id='n59' class='stm mis'><a href='#n59'>59</a></p>
  116. <p id='n60' class='pln'><a href='#n60'>60</a></p>
  117. <p id='n61' class='stm mis'><a href='#n61'>61</a></p>
  118. <p id='n62' class='stm mis'><a href='#n62'>62</a></p>
  119. <p id='n63' class='stm mis'><a href='#n63'>63</a></p>
  120. <p id='n64' class='stm mis'><a href='#n64'>64</a></p>
  121. <p id='n65' class='stm mis'><a href='#n65'>65</a></p>
  122. <p id='n66' class='stm mis'><a href='#n66'>66</a></p>
  123. <p id='n67' class='stm mis'><a href='#n67'>67</a></p>
  124. <p id='n68' class='stm mis'><a href='#n68'>68</a></p>
  125. <p id='n69' class='stm mis'><a href='#n69'>69</a></p>
  126. <p id='n70' class='stm mis'><a href='#n70'>70</a></p>
  127. <p id='n71' class='pln'><a href='#n71'>71</a></p>
  128. <p id='n72' class='stm mis'><a href='#n72'>72</a></p>
  129. <p id='n73' class='stm mis'><a href='#n73'>73</a></p>
  130. <p id='n74' class='stm mis'><a href='#n74'>74</a></p>
  131. <p id='n75' class='stm mis'><a href='#n75'>75</a></p>
  132. <p id='n76' class='pln'><a href='#n76'>76</a></p>
  133. <p id='n77' class='stm mis'><a href='#n77'>77</a></p>
  134. <p id='n78' class='stm mis'><a href='#n78'>78</a></p>
  135. <p id='n79' class='stm mis'><a href='#n79'>79</a></p>
  136. <p id='n80' class='stm mis'><a href='#n80'>80</a></p>
  137. <p id='n81' class='stm mis'><a href='#n81'>81</a></p>
  138. <p id='n82' class='stm mis'><a href='#n82'>82</a></p>
  139. <p id='n83' class='stm mis'><a href='#n83'>83</a></p>
  140. <p id='n84' class='stm mis'><a href='#n84'>84</a></p>
  141. <p id='n85' class='pln'><a href='#n85'>85</a></p>
  142. <p id='n86' class='stm mis'><a href='#n86'>86</a></p>
  143. <p id='n87' class='stm mis'><a href='#n87'>87</a></p>
  144. <p id='n88' class='stm mis'><a href='#n88'>88</a></p>
  145. <p id='n89' class='stm mis'><a href='#n89'>89</a></p>
  146. <p id='n90' class='pln'><a href='#n90'>90</a></p>
  147. <p id='n91' class='pln'><a href='#n91'>91</a></p>
  148. <p id='n92' class='pln'><a href='#n92'>92</a></p>
  149. <p id='n93' class='pln'><a href='#n93'>93</a></p>
  150. <p id='n94' class='pln'><a href='#n94'>94</a></p>
  151. <p id='n95' class='stm mis'><a href='#n95'>95</a></p>
  152. <p id='n96' class='pln'><a href='#n96'>96</a></p>
  153. <p id='n97' class='stm mis'><a href='#n97'>97</a></p>
  154. <p id='n98' class='stm mis'><a href='#n98'>98</a></p>
  155. <p id='n99' class='stm mis'><a href='#n99'>99</a></p>
  156. <p id='n100' class='pln'><a href='#n100'>100</a></p>
  157. <p id='n101' class='stm mis'><a href='#n101'>101</a></p>
  158. <p id='n102' class='stm mis'><a href='#n102'>102</a></p>
  159. <p id='n103' class='stm mis'><a href='#n103'>103</a></p>
  160. <p id='n104' class='pln'><a href='#n104'>104</a></p>
  161. <p id='n105' class='stm mis'><a href='#n105'>105</a></p>
  162. <p id='n106' class='pln'><a href='#n106'>106</a></p>
  163. <p id='n107' class='stm mis'><a href='#n107'>107</a></p>
  164. <p id='n108' class='stm mis'><a href='#n108'>108</a></p>
  165. <p id='n109' class='stm mis'><a href='#n109'>109</a></p>
  166. <p id='n110' class='stm mis'><a href='#n110'>110</a></p>
  167. <p id='n111' class='stm mis'><a href='#n111'>111</a></p>
  168. <p id='n112' class='stm mis'><a href='#n112'>112</a></p>
  169. <p id='n113' class='stm mis'><a href='#n113'>113</a></p>
  170. <p id='n114' class='stm mis'><a href='#n114'>114</a></p>
  171. <p id='n115' class='stm mis'><a href='#n115'>115</a></p>
  172. <p id='n116' class='stm mis'><a href='#n116'>116</a></p>
  173. <p id='n117' class='pln'><a href='#n117'>117</a></p>
  174. <p id='n118' class='stm mis'><a href='#n118'>118</a></p>
  175. <p id='n119' class='stm mis'><a href='#n119'>119</a></p>
  176. <p id='n120' class='stm mis'><a href='#n120'>120</a></p>
  177. <p id='n121' class='stm mis'><a href='#n121'>121</a></p>
  178. <p id='n122' class='stm mis'><a href='#n122'>122</a></p>
  179. <p id='n123' class='stm mis'><a href='#n123'>123</a></p>
  180. <p id='n124' class='pln'><a href='#n124'>124</a></p>
  181. <p id='n125' class='stm mis'><a href='#n125'>125</a></p>
  182. <p id='n126' class='stm mis'><a href='#n126'>126</a></p>
  183. <p id='n127' class='stm mis'><a href='#n127'>127</a></p>
  184. <p id='n128' class='stm mis'><a href='#n128'>128</a></p>
  185. <p id='n129' class='stm mis'><a href='#n129'>129</a></p>
  186. <p id='n130' class='pln'><a href='#n130'>130</a></p>
  187. <p id='n131' class='pln'><a href='#n131'>131</a></p>
  188. <p id='n132' class='stm mis'><a href='#n132'>132</a></p>
  189. <p id='n133' class='stm mis'><a href='#n133'>133</a></p>
  190. <p id='n134' class='pln'><a href='#n134'>134</a></p>
  191. <p id='n135' class='stm mis'><a href='#n135'>135</a></p>
  192. <p id='n136' class='pln'><a href='#n136'>136</a></p>
  193. <p id='n137' class='stm run hide_run'><a href='#n137'>137</a></p>
  194. <p id='n138' class='stm mis'><a href='#n138'>138</a></p>
  195. <p id='n139' class='stm mis'><a href='#n139'>139</a></p>
  196. <p id='n140' class='stm mis'><a href='#n140'>140</a></p>
  197. <p id='n141' class='stm mis'><a href='#n141'>141</a></p>
  198. <p id='n142' class='stm mis'><a href='#n142'>142</a></p>
  199. <p id='n143' class='stm mis'><a href='#n143'>143</a></p>
  200. <p id='n144' class='stm mis'><a href='#n144'>144</a></p>
  201. <p id='n145' class='stm mis'><a href='#n145'>145</a></p>
  202. <p id='n146' class='stm mis'><a href='#n146'>146</a></p>
  203. <p id='n147' class='pln'><a href='#n147'>147</a></p>
  204. <p id='n148' class='stm mis'><a href='#n148'>148</a></p>
  205. <p id='n149' class='stm mis'><a href='#n149'>149</a></p>
  206. <p id='n150' class='pln'><a href='#n150'>150</a></p>
  207. <p id='n151' class='stm mis'><a href='#n151'>151</a></p>
  208. <p id='n152' class='pln'><a href='#n152'>152</a></p>
  209. <p id='n153' class='pln'><a href='#n153'>153</a></p>
  210. <p id='n154' class='stm mis'><a href='#n154'>154</a></p>
  211. <p id='n155' class='pln'><a href='#n155'>155</a></p>
  212. <p id='n156' class='stm mis'><a href='#n156'>156</a></p>
  213. <p id='n157' class='stm mis'><a href='#n157'>157</a></p>
  214. <p id='n158' class='stm mis'><a href='#n158'>158</a></p>
  215. <p id='n159' class='stm mis'><a href='#n159'>159</a></p>
  216. <p id='n160' class='stm mis'><a href='#n160'>160</a></p>
  217. <p id='n161' class='stm mis'><a href='#n161'>161</a></p>
  218. <p id='n162' class='pln'><a href='#n162'>162</a></p>
  219. <p id='n163' class='stm mis'><a href='#n163'>163</a></p>
  220. <p id='n164' class='pln'><a href='#n164'>164</a></p>
  221. <p id='n165' class='stm mis'><a href='#n165'>165</a></p>
  222. <p id='n166' class='pln'><a href='#n166'>166</a></p>
  223. <p id='n167' class='stm mis'><a href='#n167'>167</a></p>
  224. <p id='n168' class='stm mis'><a href='#n168'>168</a></p>
  225. <p id='n169' class='stm mis'><a href='#n169'>169</a></p>
  226. <p id='n170' class='stm mis'><a href='#n170'>170</a></p>
  227. <p id='n171' class='pln'><a href='#n171'>171</a></p>
  228. <p id='n172' class='stm mis'><a href='#n172'>172</a></p>
  229. <p id='n173' class='stm mis'><a href='#n173'>173</a></p>
  230. <p id='n174' class='stm mis'><a href='#n174'>174</a></p>
  231. <p id='n175' class='stm mis'><a href='#n175'>175</a></p>
  232. <p id='n176' class='stm mis'><a href='#n176'>176</a></p>
  233. <p id='n177' class='stm mis'><a href='#n177'>177</a></p>
  234. <p id='n178' class='stm mis'><a href='#n178'>178</a></p>
  235. <p id='n179' class='pln'><a href='#n179'>179</a></p>
  236. <p id='n180' class='stm mis'><a href='#n180'>180</a></p>
  237. <p id='n181' class='stm mis'><a href='#n181'>181</a></p>
  238. <p id='n182' class='pln'><a href='#n182'>182</a></p>
  239. <p id='n183' class='pln'><a href='#n183'>183</a></p>
  240. <p id='n184' class='stm mis'><a href='#n184'>184</a></p>
  241. <p id='n185' class='stm mis'><a href='#n185'>185</a></p>
  242. <p id='n186' class='pln'><a href='#n186'>186</a></p>
  243. <p id='n187' class='stm mis'><a href='#n187'>187</a></p>
  244. <p id='n188' class='stm mis'><a href='#n188'>188</a></p>
  245. <p id='n189' class='pln'><a href='#n189'>189</a></p>
  246. <p id='n190' class='stm mis'><a href='#n190'>190</a></p>
  247. <p id='n191' class='pln'><a href='#n191'>191</a></p>
  248. <p id='n192' class='pln'><a href='#n192'>192</a></p>
  249. <p id='n193' class='pln'><a href='#n193'>193</a></p>
  250. <p id='n194' class='pln'><a href='#n194'>194</a></p>
  251. <p id='n195' class='pln'><a href='#n195'>195</a></p>
  252. <p id='n196' class='pln'><a href='#n196'>196</a></p>
  253. <p id='n197' class='stm mis'><a href='#n197'>197</a></p>
  254. <p id='n198' class='pln'><a href='#n198'>198</a></p>
  255. <p id='n199' class='pln'><a href='#n199'>199</a></p>
  256. <p id='n200' class='stm mis'><a href='#n200'>200</a></p>
  257. <p id='n201' class='stm mis'><a href='#n201'>201</a></p>
  258. <p id='n202' class='stm mis'><a href='#n202'>202</a></p>
  259. <p id='n203' class='stm mis'><a href='#n203'>203</a></p>
  260. <p id='n204' class='stm mis'><a href='#n204'>204</a></p>
  261. <p id='n205' class='stm mis'><a href='#n205'>205</a></p>
  262. <p id='n206' class='stm mis'><a href='#n206'>206</a></p>
  263. <p id='n207' class='pln'><a href='#n207'>207</a></p>
  264. <p id='n208' class='stm mis'><a href='#n208'>208</a></p>
  265. <p id='n209' class='pln'><a href='#n209'>209</a></p>
  266. <p id='n210' class='stm mis'><a href='#n210'>210</a></p>
  267. <p id='n211' class='pln'><a href='#n211'>211</a></p>
  268. <p id='n212' class='stm mis'><a href='#n212'>212</a></p>
  269. <p id='n213' class='pln'><a href='#n213'>213</a></p>
  270. <p id='n214' class='stm mis'><a href='#n214'>214</a></p>
  271. <p id='n215' class='pln'><a href='#n215'>215</a></p>
  272. <p id='n216' class='stm mis'><a href='#n216'>216</a></p>
  273. <p id='n217' class='pln'><a href='#n217'>217</a></p>
  274. <p id='n218' class='stm mis'><a href='#n218'>218</a></p>
  275. <p id='n219' class='pln'><a href='#n219'>219</a></p>
  276. <p id='n220' class='stm mis'><a href='#n220'>220</a></p>
  277. <p id='n221' class='pln'><a href='#n221'>221</a></p>
  278. <p id='n222' class='stm mis'><a href='#n222'>222</a></p>
  279. <p id='n223' class='pln'><a href='#n223'>223</a></p>
  280. <p id='n224' class='pln'><a href='#n224'>224</a></p>
  281. <p id='n225' class='stm mis'><a href='#n225'>225</a></p>
  282. <p id='n226' class='pln'><a href='#n226'>226</a></p>
  283. <p id='n227' class='pln'><a href='#n227'>227</a></p>
  284. <p id='n228' class='stm mis'><a href='#n228'>228</a></p>
  285. <p id='n229' class='pln'><a href='#n229'>229</a></p>
  286. <p id='n230' class='stm mis'><a href='#n230'>230</a></p>
  287. <p id='n231' class='pln'><a href='#n231'>231</a></p>
  288. <p id='n232' class='pln'><a href='#n232'>232</a></p>
  289. <p id='n233' class='stm mis'><a href='#n233'>233</a></p>
  290. <p id='n234' class='pln'><a href='#n234'>234</a></p>
  291. <p id='n235' class='stm mis'><a href='#n235'>235</a></p>
  292. <p id='n236' class='pln'><a href='#n236'>236</a></p>
  293. <p id='n237' class='stm mis'><a href='#n237'>237</a></p>
  294. <p id='n238' class='pln'><a href='#n238'>238</a></p>
  295. <p id='n239' class='stm mis'><a href='#n239'>239</a></p>
  296. <p id='n240' class='stm mis'><a href='#n240'>240</a></p>
  297. <p id='n241' class='stm mis'><a href='#n241'>241</a></p>
  298. <p id='n242' class='pln'><a href='#n242'>242</a></p>
  299. <p id='n243' class='stm mis'><a href='#n243'>243</a></p>
  300. <p id='n244' class='pln'><a href='#n244'>244</a></p>
  301. <p id='n245' class='stm mis'><a href='#n245'>245</a></p>
  302. <p id='n246' class='pln'><a href='#n246'>246</a></p>
  303. <p id='n247' class='stm mis'><a href='#n247'>247</a></p>
  304. <p id='n248' class='pln'><a href='#n248'>248</a></p>
  305. <p id='n249' class='pln'><a href='#n249'>249</a></p>
  306. <p id='n250' class='pln'><a href='#n250'>250</a></p>
  307. <p id='n251' class='stm mis'><a href='#n251'>251</a></p>
  308. <p id='n252' class='pln'><a href='#n252'>252</a></p>
  309. <p id='n253' class='stm mis'><a href='#n253'>253</a></p>
  310. <p id='n254' class='pln'><a href='#n254'>254</a></p>
  311. <p id='n255' class='stm mis'><a href='#n255'>255</a></p>
  312. <p id='n256' class='pln'><a href='#n256'>256</a></p>
  313. <p id='n257' class='stm mis'><a href='#n257'>257</a></p>
  314. <p id='n258' class='pln'><a href='#n258'>258</a></p>
  315. <p id='n259' class='stm mis'><a href='#n259'>259</a></p>
  316. <p id='n260' class='pln'><a href='#n260'>260</a></p>
  317. <p id='n261' class='stm mis'><a href='#n261'>261</a></p>
  318. <p id='n262' class='pln'><a href='#n262'>262</a></p>
  319. <p id='n263' class='pln'><a href='#n263'>263</a></p>
  320. <p id='n264' class='stm mis'><a href='#n264'>264</a></p>
  321. <p id='n265' class='pln'><a href='#n265'>265</a></p>
  322. <p id='n266' class='pln'><a href='#n266'>266</a></p>
  323. <p id='n267' class='pln'><a href='#n267'>267</a></p>
  324. <p id='n268' class='pln'><a href='#n268'>268</a></p>
  325. <p id='n269' class='stm mis'><a href='#n269'>269</a></p>
  326. <p id='n270' class='pln'><a href='#n270'>270</a></p>
  327. <p id='n271' class='stm mis'><a href='#n271'>271</a></p>
  328. <p id='n272' class='pln'><a href='#n272'>272</a></p>
  329. <p id='n273' class='stm mis'><a href='#n273'>273</a></p>
  330. <p id='n274' class='pln'><a href='#n274'>274</a></p>
  331. <p id='n275' class='stm mis'><a href='#n275'>275</a></p>
  332. <p id='n276' class='pln'><a href='#n276'>276</a></p>
  333. <p id='n277' class='stm mis'><a href='#n277'>277</a></p>
  334. <p id='n278' class='pln'><a href='#n278'>278</a></p>
  335. <p id='n279' class='stm mis'><a href='#n279'>279</a></p>
  336. <p id='n280' class='pln'><a href='#n280'>280</a></p>
  337. <p id='n281' class='pln'><a href='#n281'>281</a></p>
  338. <p id='n282' class='stm mis'><a href='#n282'>282</a></p>
  339. <p id='n283' class='pln'><a href='#n283'>283</a></p>
  340. <p id='n284' class='pln'><a href='#n284'>284</a></p>
  341. <p id='n285' class='stm mis'><a href='#n285'>285</a></p>
  342. <p id='n286' class='pln'><a href='#n286'>286</a></p>
  343. <p id='n287' class='pln'><a href='#n287'>287</a></p>
  344. <p id='n288' class='stm mis'><a href='#n288'>288</a></p>
  345. <p id='n289' class='pln'><a href='#n289'>289</a></p>
  346. <p id='n290' class='pln'><a href='#n290'>290</a></p>
  347. <p id='n291' class='stm mis'><a href='#n291'>291</a></p>
  348. <p id='n292' class='pln'><a href='#n292'>292</a></p>
  349. <p id='n293' class='stm mis'><a href='#n293'>293</a></p>
  350. <p id='n294' class='pln'><a href='#n294'>294</a></p>
  351. <p id='n295' class='pln'><a href='#n295'>295</a></p>
  352. <p id='n296' class='stm mis'><a href='#n296'>296</a></p>
  353. <p id='n297' class='pln'><a href='#n297'>297</a></p>
  354. <p id='n298' class='pln'><a href='#n298'>298</a></p>
  355. <p id='n299' class='pln'><a href='#n299'>299</a></p>
  356. <p id='n300' class='stm mis'><a href='#n300'>300</a></p>
  357. <p id='n301' class='pln'><a href='#n301'>301</a></p>
  358. <p id='n302' class='stm mis'><a href='#n302'>302</a></p>
  359. <p id='n303' class='pln'><a href='#n303'>303</a></p>
  360. <p id='n304' class='stm mis'><a href='#n304'>304</a></p>
  361. <p id='n305' class='pln'><a href='#n305'>305</a></p>
  362. <p id='n306' class='stm mis'><a href='#n306'>306</a></p>
  363. <p id='n307' class='pln'><a href='#n307'>307</a></p>
  364. <p id='n308' class='pln'><a href='#n308'>308</a></p>
  365. <p id='n309' class='stm mis'><a href='#n309'>309</a></p>
  366. <p id='n310' class='pln'><a href='#n310'>310</a></p>
  367. <p id='n311' class='stm mis'><a href='#n311'>311</a></p>
  368. <p id='n312' class='pln'><a href='#n312'>312</a></p>
  369. <p id='n313' class='pln'><a href='#n313'>313</a></p>
  370. <p id='n314' class='stm mis'><a href='#n314'>314</a></p>
  371. <p id='n315' class='pln'><a href='#n315'>315</a></p>
  372. <p id='n316' class='stm mis'><a href='#n316'>316</a></p>
  373. <p id='n317' class='pln'><a href='#n317'>317</a></p>
  374. <p id='n318' class='stm mis'><a href='#n318'>318</a></p>
  375. <p id='n319' class='pln'><a href='#n319'>319</a></p>
  376. <p id='n320' class='stm mis'><a href='#n320'>320</a></p>
  377. <p id='n321' class='pln'><a href='#n321'>321</a></p>
  378. <p id='n322' class='pln'><a href='#n322'>322</a></p>
  379. <p id='n323' class='stm mis'><a href='#n323'>323</a></p>
  380. <p id='n324' class='pln'><a href='#n324'>324</a></p>
  381. <p id='n325' class='stm mis'><a href='#n325'>325</a></p>
  382. <p id='n326' class='pln'><a href='#n326'>326</a></p>
  383. <p id='n327' class='stm mis'><a href='#n327'>327</a></p>
  384. <p id='n328' class='pln'><a href='#n328'>328</a></p>
  385. <p id='n329' class='pln'><a href='#n329'>329</a></p>
  386. <p id='n330' class='stm mis'><a href='#n330'>330</a></p>
  387. <p id='n331' class='pln'><a href='#n331'>331</a></p>
  388. <p id='n332' class='pln'><a href='#n332'>332</a></p>
  389. <p id='n333' class='stm mis'><a href='#n333'>333</a></p>
  390. <p id='n334' class='pln'><a href='#n334'>334</a></p>
  391. <p id='n335' class='pln'><a href='#n335'>335</a></p>
  392. <p id='n336' class='pln'><a href='#n336'>336</a></p>
  393. <p id='n337' class='pln'><a href='#n337'>337</a></p>
  394. <p id='n338' class='stm mis'><a href='#n338'>338</a></p>
  395. <p id='n339' class='pln'><a href='#n339'>339</a></p>
  396. <p id='n340' class='stm mis'><a href='#n340'>340</a></p>
  397. <p id='n341' class='pln'><a href='#n341'>341</a></p>
  398. <p id='n342' class='stm mis'><a href='#n342'>342</a></p>
  399. <p id='n343' class='pln'><a href='#n343'>343</a></p>
  400. <p id='n344' class='stm mis'><a href='#n344'>344</a></p>
  401. <p id='n345' class='pln'><a href='#n345'>345</a></p>
  402. <p id='n346' class='pln'><a href='#n346'>346</a></p>
  403. <p id='n347' class='pln'><a href='#n347'>347</a></p>
  404. <p id='n348' class='stm mis'><a href='#n348'>348</a></p>
  405. <p id='n349' class='stm mis'><a href='#n349'>349</a></p>
  406. <p id='n350' class='stm mis'><a href='#n350'>350</a></p>
  407. <p id='n351' class='stm mis'><a href='#n351'>351</a></p>
  408. <p id='n352' class='stm mis'><a href='#n352'>352</a></p>
  409. <p id='n353' class='stm mis'><a href='#n353'>353</a></p>
  410. <p id='n354' class='stm mis'><a href='#n354'>354</a></p>
  411. <p id='n355' class='pln'><a href='#n355'>355</a></p>
  412. <p id='n356' class='stm mis'><a href='#n356'>356</a></p>
  413. <p id='n357' class='stm mis'><a href='#n357'>357</a></p>
  414. <p id='n358' class='stm mis'><a href='#n358'>358</a></p>
  415. <p id='n359' class='pln'><a href='#n359'>359</a></p>
  416. <p id='n360' class='stm mis'><a href='#n360'>360</a></p>
  417. <p id='n361' class='stm mis'><a href='#n361'>361</a></p>
  418. <p id='n362' class='stm mis'><a href='#n362'>362</a></p>
  419. <p id='n363' class='pln'><a href='#n363'>363</a></p>
  420. <p id='n364' class='stm mis'><a href='#n364'>364</a></p>
  421. <p id='n365' class='pln'><a href='#n365'>365</a></p>
  422. <p id='n366' class='stm run hide_run'><a href='#n366'>366</a></p>
  423. <p id='n367' class='pln'><a href='#n367'>367</a></p>
  424. <p id='n368' class='pln'><a href='#n368'>368</a></p>
  425. <p id='n369' class='pln'><a href='#n369'>369</a></p>
  426. <p id='n370' class='stm run hide_run'><a href='#n370'>370</a></p>
  427. <p id='n371' class='pln'><a href='#n371'>371</a></p>
  428. <p id='n372' class='pln'><a href='#n372'>372</a></p>
  429. <p id='n373' class='pln'><a href='#n373'>373</a></p>
  430. <p id='n374' class='pln'><a href='#n374'>374</a></p>
  431. <p id='n375' class='pln'><a href='#n375'>375</a></p>
  432. <p id='n376' class='pln'><a href='#n376'>376</a></p>
  433. <p id='n377' class='pln'><a href='#n377'>377</a></p>
  434. <p id='n378' class='pln'><a href='#n378'>378</a></p>
  435. <p id='n379' class='pln'><a href='#n379'>379</a></p>
  436. <p id='n380' class='pln'><a href='#n380'>380</a></p>
  437. <p id='n381' class='pln'><a href='#n381'>381</a></p>
  438. <p id='n382' class='pln'><a href='#n382'>382</a></p>
  439. <p id='n383' class='pln'><a href='#n383'>383</a></p>
  440. <p id='n384' class='pln'><a href='#n384'>384</a></p>
  441. <p id='n385' class='pln'><a href='#n385'>385</a></p>
  442. <p id='n386' class='pln'><a href='#n386'>386</a></p>
  443. <p id='n387' class='pln'><a href='#n387'>387</a></p>
  444. <p id='n388' class='pln'><a href='#n388'>388</a></p>
  445. <p id='n389' class='pln'><a href='#n389'>389</a></p>
  446. <p id='n390' class='pln'><a href='#n390'>390</a></p>
  447. <p id='n391' class='pln'><a href='#n391'>391</a></p>
  448. <p id='n392' class='pln'><a href='#n392'>392</a></p>
  449. <p id='n393' class='pln'><a href='#n393'>393</a></p>
  450. <p id='n394' class='pln'><a href='#n394'>394</a></p>
  451. <p id='n395' class='pln'><a href='#n395'>395</a></p>
  452. <p id='n396' class='pln'><a href='#n396'>396</a></p>
  453. <p id='n397' class='pln'><a href='#n397'>397</a></p>
  454. <p id='n398' class='pln'><a href='#n398'>398</a></p>
  455. <p id='n399' class='pln'><a href='#n399'>399</a></p>
  456. <p id='n400' class='pln'><a href='#n400'>400</a></p>
  457. <p id='n401' class='pln'><a href='#n401'>401</a></p>
  458. <p id='n402' class='pln'><a href='#n402'>402</a></p>
  459. <p id='n403' class='pln'><a href='#n403'>403</a></p>
  460. <p id='n404' class='pln'><a href='#n404'>404</a></p>
  461. <p id='n405' class='pln'><a href='#n405'>405</a></p>
  462. <p id='n406' class='stm run hide_run'><a href='#n406'>406</a></p>
  463. <p id='n407' class='stm run hide_run'><a href='#n407'>407</a></p>
  464. <p id='n408' class='pln'><a href='#n408'>408</a></p>
  465. <p id='n409' class='pln'><a href='#n409'>409</a></p>
  466. <p id='n410' class='stm mis'><a href='#n410'>410</a></p>
  467. <p id='n411' class='stm mis'><a href='#n411'>411</a></p>
  468. <p id='n412' class='pln'><a href='#n412'>412</a></p>
  469. <p id='n413' class='stm mis'><a href='#n413'>413</a></p>
  470. <p id='n414' class='stm mis'><a href='#n414'>414</a></p>
  471. <p id='n415' class='stm mis'><a href='#n415'>415</a></p>
  472. <p id='n416' class='stm mis'><a href='#n416'>416</a></p>
  473. <p id='n417' class='stm mis'><a href='#n417'>417</a></p>
  474. <p id='n418' class='stm mis'><a href='#n418'>418</a></p>
  475. <p id='n419' class='pln'><a href='#n419'>419</a></p>
  476. <p id='n420' class='stm mis'><a href='#n420'>420</a></p>
  477. <p id='n421' class='stm mis'><a href='#n421'>421</a></p>
  478. <p id='n422' class='pln'><a href='#n422'>422</a></p>
  479. <p id='n423' class='pln'><a href='#n423'>423</a></p>
  480. <p id='n424' class='stm mis'><a href='#n424'>424</a></p>
  481. <p id='n425' class='stm mis'><a href='#n425'>425</a></p>
  482. <p id='n426' class='stm mis'><a href='#n426'>426</a></p>
  483. <p id='n427' class='pln'><a href='#n427'>427</a></p>
  484. <p id='n428' class='pln'><a href='#n428'>428</a></p>
  485. <p id='n429' class='stm mis'><a href='#n429'>429</a></p>
  486. <p id='n430' class='stm mis'><a href='#n430'>430</a></p>
  487. <p id='n431' class='stm mis'><a href='#n431'>431</a></p>
  488. <p id='n432' class='stm mis'><a href='#n432'>432</a></p>
  489. <p id='n433' class='stm mis'><a href='#n433'>433</a></p>
  490. <p id='n434' class='pln'><a href='#n434'>434</a></p>
  491. <p id='n435' class='stm mis'><a href='#n435'>435</a></p>
  492. <p id='n436' class='stm mis'><a href='#n436'>436</a></p>
  493. <p id='n437' class='stm mis'><a href='#n437'>437</a></p>
  494. <p id='n438' class='stm mis'><a href='#n438'>438</a></p>
  495. <p id='n439' class='stm mis'><a href='#n439'>439</a></p>
  496. <p id='n440' class='stm mis'><a href='#n440'>440</a></p>
  497. <p id='n441' class='stm mis'><a href='#n441'>441</a></p>
  498. <p id='n442' class='stm mis'><a href='#n442'>442</a></p>
  499. <p id='n443' class='pln'><a href='#n443'>443</a></p>
  500. <p id='n444' class='pln'><a href='#n444'>444</a></p>
  501. <p id='n445' class='stm mis'><a href='#n445'>445</a></p>
  502. <p id='n446' class='stm mis'><a href='#n446'>446</a></p>
  503. <p id='n447' class='stm mis'><a href='#n447'>447</a></p>
  504. <p id='n448' class='stm mis'><a href='#n448'>448</a></p>
  505. <p id='n449' class='stm mis'><a href='#n449'>449</a></p>
  506. <p id='n450' class='pln'><a href='#n450'>450</a></p>
  507. <p id='n451' class='stm mis'><a href='#n451'>451</a></p>
  508. <p id='n452' class='pln'><a href='#n452'>452</a></p>
  509. <p id='n453' class='stm mis'><a href='#n453'>453</a></p>
  510. <p id='n454' class='stm mis'><a href='#n454'>454</a></p>
  511. <p id='n455' class='stm mis'><a href='#n455'>455</a></p>
  512. <p id='n456' class='stm mis'><a href='#n456'>456</a></p>
  513. <p id='n457' class='stm mis'><a href='#n457'>457</a></p>
  514. <p id='n458' class='stm mis'><a href='#n458'>458</a></p>
  515. <p id='n459' class='stm mis'><a href='#n459'>459</a></p>
  516. <p id='n460' class='stm mis'><a href='#n460'>460</a></p>
  517. <p id='n461' class='pln'><a href='#n461'>461</a></p>
  518. <p id='n462' class='pln'><a href='#n462'>462</a></p>
  519. <p id='n463' class='stm mis'><a href='#n463'>463</a></p>
  520. <p id='n464' class='stm mis'><a href='#n464'>464</a></p>
  521. <p id='n465' class='stm mis'><a href='#n465'>465</a></p>
  522. <p id='n466' class='stm mis'><a href='#n466'>466</a></p>
  523. <p id='n467' class='stm mis'><a href='#n467'>467</a></p>
  524. <p id='n468' class='stm mis'><a href='#n468'>468</a></p>
  525. <p id='n469' class='stm mis'><a href='#n469'>469</a></p>
  526. <p id='n470' class='stm mis'><a href='#n470'>470</a></p>
  527. <p id='n471' class='stm mis'><a href='#n471'>471</a></p>
  528. <p id='n472' class='stm mis'><a href='#n472'>472</a></p>
  529. <p id='n473' class='stm mis'><a href='#n473'>473</a></p>
  530. <p id='n474' class='stm mis'><a href='#n474'>474</a></p>
  531. <p id='n475' class='stm mis'><a href='#n475'>475</a></p>
  532. <p id='n476' class='stm mis'><a href='#n476'>476</a></p>
  533. <p id='n477' class='stm mis'><a href='#n477'>477</a></p>
  534. <p id='n478' class='stm mis'><a href='#n478'>478</a></p>
  535. <p id='n479' class='stm mis'><a href='#n479'>479</a></p>
  536. <p id='n480' class='stm mis'><a href='#n480'>480</a></p>
  537. <p id='n481' class='stm mis'><a href='#n481'>481</a></p>
  538. <p id='n482' class='stm mis'><a href='#n482'>482</a></p>
  539. <p id='n483' class='stm mis'><a href='#n483'>483</a></p>
  540. <p id='n484' class='stm mis'><a href='#n484'>484</a></p>
  541. <p id='n485' class='stm mis'><a href='#n485'>485</a></p>
  542. <p id='n486' class='stm mis'><a href='#n486'>486</a></p>
  543. <p id='n487' class='stm mis'><a href='#n487'>487</a></p>
  544. <p id='n488' class='stm mis'><a href='#n488'>488</a></p>
  545. <p id='n489' class='stm mis'><a href='#n489'>489</a></p>
  546. <p id='n490' class='stm mis'><a href='#n490'>490</a></p>
  547. <p id='n491' class='stm mis'><a href='#n491'>491</a></p>
  548. <p id='n492' class='stm mis'><a href='#n492'>492</a></p>
  549. <p id='n493' class='stm mis'><a href='#n493'>493</a></p>
  550. <p id='n494' class='stm mis'><a href='#n494'>494</a></p>
  551. <p id='n495' class='stm mis'><a href='#n495'>495</a></p>
  552. <p id='n496' class='stm mis'><a href='#n496'>496</a></p>
  553. <p id='n497' class='stm mis'><a href='#n497'>497</a></p>
  554. <p id='n498' class='stm mis'><a href='#n498'>498</a></p>
  555. <p id='n499' class='stm mis'><a href='#n499'>499</a></p>
  556. <p id='n500' class='stm mis'><a href='#n500'>500</a></p>
  557. <p id='n501' class='stm mis'><a href='#n501'>501</a></p>
  558. <p id='n502' class='stm mis'><a href='#n502'>502</a></p>
  559. <p id='n503' class='stm mis'><a href='#n503'>503</a></p>
  560. <p id='n504' class='stm mis'><a href='#n504'>504</a></p>
  561. <p id='n505' class='stm mis'><a href='#n505'>505</a></p>
  562. <p id='n506' class='stm mis'><a href='#n506'>506</a></p>
  563. <p id='n507' class='pln'><a href='#n507'>507</a></p>
  564. <p id='n508' class='stm mis'><a href='#n508'>508</a></p>
  565. <p id='n509' class='pln'><a href='#n509'>509</a></p>
  566. <p id='n510' class='stm mis'><a href='#n510'>510</a></p>
  567. <p id='n511' class='stm mis'><a href='#n511'>511</a></p>
  568. <p id='n512' class='stm mis'><a href='#n512'>512</a></p>
  569. <p id='n513' class='pln'><a href='#n513'>513</a></p>
  570. <p id='n514' class='pln'><a href='#n514'>514</a></p>
  571. <p id='n515' class='pln'><a href='#n515'>515</a></p>
  572. <p id='n516' class='pln'><a href='#n516'>516</a></p>
  573. <p id='n517' class='pln'><a href='#n517'>517</a></p>
  574. <p id='n518' class='pln'><a href='#n518'>518</a></p>
  575. <p id='n519' class='pln'><a href='#n519'>519</a></p>
  576. <p id='n520' class='pln'><a href='#n520'>520</a></p>
  577. <p id='n521' class='stm mis'><a href='#n521'>521</a></p>
  578. <p id='n522' class='pln'><a href='#n522'>522</a></p>
  579. <p id='n523' class='pln'><a href='#n523'>523</a></p>
  580. <p id='n524' class='pln'><a href='#n524'>524</a></p>
  581. <p id='n525' class='pln'><a href='#n525'>525</a></p>
  582. <p id='n526' class='pln'><a href='#n526'>526</a></p>
  583. <p id='n527' class='pln'><a href='#n527'>527</a></p>
  584. <p id='n528' class='pln'><a href='#n528'>528</a></p>
  585. <p id='n529' class='pln'><a href='#n529'>529</a></p>
  586. <p id='n530' class='pln'><a href='#n530'>530</a></p>
  587. <p id='n531' class='pln'><a href='#n531'>531</a></p>
  588. <p id='n532' class='pln'><a href='#n532'>532</a></p>
  589. <p id='n533' class='pln'><a href='#n533'>533</a></p>
  590. <p id='n534' class='pln'><a href='#n534'>534</a></p>
  591. <p id='n535' class='pln'><a href='#n535'>535</a></p>
  592. <p id='n536' class='pln'><a href='#n536'>536</a></p>
  593. <p id='n537' class='pln'><a href='#n537'>537</a></p>
  594. <p id='n538' class='pln'><a href='#n538'>538</a></p>
  595. <p id='n539' class='pln'><a href='#n539'>539</a></p>
  596. <p id='n540' class='pln'><a href='#n540'>540</a></p>
  597. <p id='n541' class='pln'><a href='#n541'>541</a></p>
  598. <p id='n542' class='pln'><a href='#n542'>542</a></p>
  599. <p id='n543' class='pln'><a href='#n543'>543</a></p>
  600. <p id='n544' class='pln'><a href='#n544'>544</a></p>
  601. <p id='n545' class='pln'><a href='#n545'>545</a></p>
  602. <p id='n546' class='pln'><a href='#n546'>546</a></p>
  603. <p id='n547' class='pln'><a href='#n547'>547</a></p>
  604. <p id='n548' class='pln'><a href='#n548'>548</a></p>
  605. <p id='n549' class='pln'><a href='#n549'>549</a></p>
  606. <p id='n550' class='pln'><a href='#n550'>550</a></p>
  607. <p id='n551' class='pln'><a href='#n551'>551</a></p>
  608. <p id='n552' class='pln'><a href='#n552'>552</a></p>
  609. <p id='n553' class='pln'><a href='#n553'>553</a></p>
  610. <p id='n554' class='pln'><a href='#n554'>554</a></p>
  611. <p id='n555' class='pln'><a href='#n555'>555</a></p>
  612. <p id='n556' class='pln'><a href='#n556'>556</a></p>
  613. <p id='n557' class='pln'><a href='#n557'>557</a></p>
  614. <p id='n558' class='pln'><a href='#n558'>558</a></p>
  615. <p id='n559' class='pln'><a href='#n559'>559</a></p>
  616. <p id='n560' class='pln'><a href='#n560'>560</a></p>
  617. <p id='n561' class='pln'><a href='#n561'>561</a></p>
  618. <p id='n562' class='pln'><a href='#n562'>562</a></p>
  619. <p id='n563' class='pln'><a href='#n563'>563</a></p>
  620. <p id='n564' class='pln'><a href='#n564'>564</a></p>
  621. <p id='n565' class='stm mis'><a href='#n565'>565</a></p>
  622. <p id='n566' class='stm mis'><a href='#n566'>566</a></p>
  623. <p id='n567' class='pln'><a href='#n567'>567</a></p>
  624. <p id='n568' class='stm mis'><a href='#n568'>568</a></p>
  625. <p id='n569' class='stm mis'><a href='#n569'>569</a></p>
  626. <p id='n570' class='pln'><a href='#n570'>570</a></p>
  627. <p id='n571' class='pln'><a href='#n571'>571</a></p>
  628. <p id='n572' class='stm mis'><a href='#n572'>572</a></p>
  629. <p id='n573' class='stm mis'><a href='#n573'>573</a></p>
  630. <p id='n574' class='pln'><a href='#n574'>574</a></p>
  631. <p id='n575' class='pln'><a href='#n575'>575</a></p>
  632. <p id='n576' class='stm mis'><a href='#n576'>576</a></p>
  633. <p id='n577' class='stm mis'><a href='#n577'>577</a></p>
  634. <p id='n578' class='pln'><a href='#n578'>578</a></p>
  635. <p id='n579' class='pln'><a href='#n579'>579</a></p>
  636. <p id='n580' class='stm mis'><a href='#n580'>580</a></p>
  637. <p id='n581' class='stm mis'><a href='#n581'>581</a></p>
  638. <p id='n582' class='stm mis'><a href='#n582'>582</a></p>
  639. <p id='n583' class='pln'><a href='#n583'>583</a></p>
  640. <p id='n584' class='stm mis'><a href='#n584'>584</a></p>
  641. <p id='n585' class='pln'><a href='#n585'>585</a></p>
  642. <p id='n586' class='stm mis'><a href='#n586'>586</a></p>
  643. <p id='n587' class='stm mis'><a href='#n587'>587</a></p>
  644. <p id='n588' class='stm mis'><a href='#n588'>588</a></p>
  645. <p id='n589' class='stm mis'><a href='#n589'>589</a></p>
  646. <p id='n590' class='stm mis'><a href='#n590'>590</a></p>
  647. <p id='n591' class='pln'><a href='#n591'>591</a></p>
  648. <p id='n592' class='pln'><a href='#n592'>592</a></p>
  649. <p id='n593' class='stm mis'><a href='#n593'>593</a></p>
  650. <p id='n594' class='stm run hide_run'><a href='#n594'>594</a></p>
  651. <p id='n595' class='stm mis'><a href='#n595'>595</a></p>
  652. <p id='n596' class='stm mis'><a href='#n596'>596</a></p>
  653. <p id='n597' class='stm mis'><a href='#n597'>597</a></p>
  654. <p id='n598' class='pln'><a href='#n598'>598</a></p>
  655. <p id='n599' class='stm mis'><a href='#n599'>599</a></p>
  656. <p id='n600' class='pln'><a href='#n600'>600</a></p>
  657. <p id='n601' class='stm run hide_run'><a href='#n601'>601</a></p>
  658. <p id='n602' class='stm run hide_run'><a href='#n602'>602</a></p>
  659. <p id='n603' class='stm mis'><a href='#n603'>603</a></p>
  660. <p id='n604' class='stm mis'><a href='#n604'>604</a></p>
  661. <p id='n605' class='stm mis'><a href='#n605'>605</a></p>
  662. <p id='n606' class='stm mis'><a href='#n606'>606</a></p>
  663. <p id='n607' class='stm mis'><a href='#n607'>607</a></p>
  664. <p id='n608' class='stm mis'><a href='#n608'>608</a></p>
  665. <p id='n609' class='stm mis'><a href='#n609'>609</a></p>
  666. </td>
  667. <td class='text' valign='top'>
  668. <p id='t1' class='pln'><span class='com'>#!/usr/bin/env python</span><span class='strut'>&nbsp;</span></p>
  669. <p id='t2' class='pln'><span class='com'># -*- coding: utf-8 -*-</span><span class='strut'>&nbsp;</span></p>
  670. <p id='t3' class='pln'><span class='strut'>&nbsp;</span></p>
  671. <p id='t4' class='stm run hide_run'><span class='key'>from</span> <span class='nam'>__future__</span> <span class='key'>import</span> <span class='nam'>with_statement</span><span class='strut'>&nbsp;</span></p>
  672. <p id='t5' class='stm run hide_run'><span class='key'>from</span> <span class='nam'>__future__</span> <span class='key'>import</span> <span class='nam'>absolute_import</span><span class='strut'>&nbsp;</span></p>
  673. <p id='t6' class='pln'><span class='strut'>&nbsp;</span></p>
  674. <p id='t7' class='stm run hide_run'><span class='nam'>__authors__</span>&nbsp; <span class='op'>=</span> <span class='op'>(</span><span class='strut'>&nbsp;</span></p>
  675. <p id='t8' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Ricardo Garcia Gonzalez&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  676. <p id='t9' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Danny Colligan&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  677. <p id='t10' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Benjamin Johnson&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  678. <p id='t11' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Vasyl\&#39; Vavrychuk&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  679. <p id='t12' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Witold Baryluk&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  680. <p id='t13' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Pawe&#322; Paprota&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  681. <p id='t14' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Gergely Imreh&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  682. <p id='t15' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Rog&#233;rio Brito&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  683. <p id='t16' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Philipp Hagemeister&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  684. <p id='t17' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;S&#246;ren Schulze&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  685. <p id='t18' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Kevin Ngo&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  686. <p id='t19' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Ori Avtalion&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  687. <p id='t20' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;shizeeg&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  688. <p id='t21' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Filippo Valsorda&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  689. <p id='t22' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Christian Albrecht&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  690. <p id='t23' class='pln'>&nbsp; &nbsp; <span class='str'>&#39;Dave Vasilevsky&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  691. <p id='t24' class='pln'>&nbsp; &nbsp; <span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  692. <p id='t25' class='pln'><span class='strut'>&nbsp;</span></p>
  693. <p id='t26' class='stm run hide_run'><span class='nam'>__license__</span> <span class='op'>=</span> <span class='str'>&#39;Public Domain&#39;</span><span class='strut'>&nbsp;</span></p>
  694. <p id='t27' class='pln'><span class='strut'>&nbsp;</span></p>
  695. <p id='t28' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>getpass</span><span class='strut'>&nbsp;</span></p>
  696. <p id='t29' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>optparse</span><span class='strut'>&nbsp;</span></p>
  697. <p id='t30' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>os</span><span class='strut'>&nbsp;</span></p>
  698. <p id='t31' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>re</span><span class='strut'>&nbsp;</span></p>
  699. <p id='t32' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>shlex</span><span class='strut'>&nbsp;</span></p>
  700. <p id='t33' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>socket</span><span class='strut'>&nbsp;</span></p>
  701. <p id='t34' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>subprocess</span><span class='strut'>&nbsp;</span></p>
  702. <p id='t35' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>sys</span><span class='strut'>&nbsp;</span></p>
  703. <p id='t36' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>warnings</span><span class='strut'>&nbsp;</span></p>
  704. <p id='t37' class='pln'><span class='strut'>&nbsp;</span></p>
  705. <p id='t38' class='stm run hide_run'><span class='key'>from</span> <span class='op'>.</span><span class='nam'>utils</span> <span class='key'>import</span> <span class='op'>*</span><span class='strut'>&nbsp;</span></p>
  706. <p id='t39' class='stm run hide_run'><span class='key'>from</span> <span class='op'>.</span><span class='nam'>version</span> <span class='key'>import</span> <span class='nam'>__version__</span><span class='strut'>&nbsp;</span></p>
  707. <p id='t40' class='stm run hide_run'><span class='key'>from</span> <span class='op'>.</span><span class='nam'>FileDownloader</span> <span class='key'>import</span> <span class='op'>*</span><span class='strut'>&nbsp;</span></p>
  708. <p id='t41' class='stm run hide_run'><span class='key'>from</span> <span class='op'>.</span><span class='nam'>InfoExtractors</span> <span class='key'>import</span> <span class='op'>*</span><span class='strut'>&nbsp;</span></p>
  709. <p id='t42' class='stm run hide_run'><span class='key'>from</span> <span class='op'>.</span><span class='nam'>PostProcessor</span> <span class='key'>import</span> <span class='op'>*</span><span class='strut'>&nbsp;</span></p>
  710. <p id='t43' class='pln'><span class='strut'>&nbsp;</span></p>
  711. <p id='t44' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>updateSelf</span><span class='op'>(</span><span class='nam'>downloader</span><span class='op'>,</span> <span class='nam'>filename</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  712. <p id='t45' class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot;Update the program file with the latest version from the repository&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
  713. <p id='t46' class='pln'><span class='strut'>&nbsp;</span></p>
  714. <p id='t47' class='pln'>&nbsp; &nbsp; <span class='com'># TODO: at least, check https certificates</span><span class='strut'>&nbsp;</span></p>
  715. <p id='t48' class='pln'><span class='strut'>&nbsp;</span></p>
  716. <p id='t49' class='stm mis'>&nbsp; &nbsp; <span class='key'>from</span> <span class='nam'>zipimport</span> <span class='key'>import</span> <span class='nam'>zipimporter</span><span class='strut'>&nbsp;</span></p>
  717. <p id='t50' class='pln'><span class='strut'>&nbsp;</span></p>
  718. <p id='t51' class='stm mis'>&nbsp; &nbsp; <span class='nam'>API_URL</span> <span class='op'>=</span> <span class='str'>&quot;https://api.github.com/repos/rg3/youtube-dl/downloads&quot;</span><span class='strut'>&nbsp;</span></p>
  719. <p id='t52' class='stm mis'>&nbsp; &nbsp; <span class='nam'>BIN_URL</span> <span class='op'>=</span> <span class='str'>&quot;https://github.com/downloads/rg3/youtube-dl/youtube-dl&quot;</span><span class='strut'>&nbsp;</span></p>
  720. <p id='t53' class='stm mis'>&nbsp; &nbsp; <span class='nam'>EXE_URL</span> <span class='op'>=</span> <span class='str'>&quot;https://github.com/downloads/rg3/youtube-dl/youtube-dl.exe&quot;</span><span class='strut'>&nbsp;</span></p>
  721. <p id='t54' class='pln'><span class='strut'>&nbsp;</span></p>
  722. <p id='t55' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>hasattr</span><span class='op'>(</span><span class='nam'>sys</span><span class='op'>,</span> <span class='str'>&quot;frozen&quot;</span><span class='op'>)</span><span class='op'>:</span> <span class='com'># PY2EXE</span><span class='strut'>&nbsp;</span></p>
  723. <p id='t56' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>filename</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  724. <p id='t57' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>&#39;ERROR: no write permissions on %s&#39;</span> <span class='op'>%</span> <span class='nam'>filename</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  725. <p id='t58' class='pln'><span class='strut'>&nbsp;</span></p>
  726. <p id='t59' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>downloader</span><span class='op'>.</span><span class='nam'>to_screen</span><span class='op'>(</span><span class='str'>u&#39;Updating to latest version...&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  727. <p id='t60' class='pln'><span class='strut'>&nbsp;</span></p>
  728. <p id='t61' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>urla</span> <span class='op'>=</span> <span class='nam'>compat_urllib_request</span><span class='op'>.</span><span class='nam'>urlopen</span><span class='op'>(</span><span class='nam'>API_URL</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  729. <p id='t62' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>download</span> <span class='op'>=</span> <span class='nam'>filter</span><span class='op'>(</span><span class='key'>lambda</span> <span class='nam'>x</span><span class='op'>:</span> <span class='nam'>x</span><span class='op'>[</span><span class='str'>&quot;name&quot;</span><span class='op'>]</span> <span class='op'>==</span> <span class='str'>&quot;youtube-dl.exe&quot;</span><span class='op'>,</span> <span class='nam'>json</span><span class='op'>.</span><span class='nam'>loads</span><span class='op'>(</span><span class='nam'>urla</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  730. <p id='t63' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>download</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  731. <p id='t64' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>downloader</span><span class='op'>.</span><span class='nam'>to_screen</span><span class='op'>(</span><span class='str'>u&#39;ERROR: can\&#39;t find the current version. Please try again later.&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  732. <p id='t65' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class='strut'>&nbsp;</span></p>
  733. <p id='t66' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>newversion</span> <span class='op'>=</span> <span class='nam'>download</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>[</span><span class='str'>&quot;description&quot;</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  734. <p id='t67' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>newversion</span> <span class='op'>==</span> <span class='nam'>__version__</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  735. <p id='t68' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>downloader</span><span class='op'>.</span><span class='nam'>to_screen</span><span class='op'>(</span><span class='str'>u&#39;youtube-dl is up-to-date (&#39;</span> <span class='op'>+</span> <span class='nam'>__version__</span> <span class='op'>+</span> <span class='str'>&#39;)&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  736. <p id='t69' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class='strut'>&nbsp;</span></p>
  737. <p id='t70' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>urla</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  738. <p id='t71' class='pln'><span class='strut'>&nbsp;</span></p>
  739. <p id='t72' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>exe</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>abspath</span><span class='op'>(</span><span class='nam'>filename</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  740. <p id='t73' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>directory</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>dirname</span><span class='op'>(</span><span class='nam'>exe</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  741. <p id='t74' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>directory</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  742. <p id='t75' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>&#39;ERROR: no write permissions on %s&#39;</span> <span class='op'>%</span> <span class='nam'>directory</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  743. <p id='t76' class='pln'><span class='strut'>&nbsp;</span></p>
  744. <p id='t77' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  745. <p id='t78' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>urlh</span> <span class='op'>=</span> <span class='nam'>compat_urllib_request</span><span class='op'>.</span><span class='nam'>urlopen</span><span class='op'>(</span><span class='nam'>EXE_URL</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  746. <p id='t79' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>newcontent</span> <span class='op'>=</span> <span class='nam'>urlh</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  747. <p id='t80' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>urlh</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  748. <p id='t81' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>with</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>exe</span> <span class='op'>+</span> <span class='str'>&#39;.new&#39;</span><span class='op'>,</span> <span class='str'>&#39;wb&#39;</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>outf</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  749. <p id='t82' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outf</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>newcontent</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  750. <p id='t83' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='op'>(</span><span class='nam'>IOError</span><span class='op'>,</span> <span class='nam'>OSError</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  751. <p id='t84' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>&#39;ERROR: unable to download latest version&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  752. <p id='t85' class='pln'><span class='strut'>&nbsp;</span></p>
  753. <p id='t86' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  754. <p id='t87' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>bat</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>directory</span><span class='op'>,</span> <span class='str'>&#39;youtube-dl-updater.bat&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  755. <p id='t88' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>b</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>bat</span><span class='op'>,</span> <span class='str'>&#39;w&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  756. <p id='t89' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>b</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='str'>&quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
  757. <p id='t90' class='pln'><span class='str'>echo Updating youtube-dl...</span><span class='strut'>&nbsp;</span></p>
  758. <p id='t91' class='pln'><span class='str'>ping 127.0.0.1 -n 5 -w 1000 &gt; NUL</span><span class='strut'>&nbsp;</span></p>
  759. <p id='t92' class='pln'><span class='str'>move /Y &quot;%s.new&quot; &quot;%s&quot;</span><span class='strut'>&nbsp;</span></p>
  760. <p id='t93' class='pln'><span class='str'>del &quot;%s&quot;</span><span class='strut'>&nbsp;</span></p>
  761. <p id='t94' class='pln'><span class='str'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n&quot;&quot;&quot;</span> <span class='op'>%</span><span class='op'>(</span><span class='nam'>exe</span><span class='op'>,</span> <span class='nam'>exe</span><span class='op'>,</span> <span class='nam'>bat</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  762. <p id='t95' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>b</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  763. <p id='t96' class='pln'><span class='strut'>&nbsp;</span></p>
  764. <p id='t97' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>os</span><span class='op'>.</span><span class='nam'>startfile</span><span class='op'>(</span><span class='nam'>bat</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  765. <p id='t98' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='op'>(</span><span class='nam'>IOError</span><span class='op'>,</span> <span class='nam'>OSError</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  766. <p id='t99' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>&#39;ERROR: unable to overwrite current version&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  767. <p id='t100' class='pln'><span class='strut'>&nbsp;</span></p>
  768. <p id='t101' class='stm mis'>&nbsp; &nbsp; <span class='key'>elif</span> <span class='nam'>isinstance</span><span class='op'>(</span><span class='nam'>globals</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>get</span><span class='op'>(</span><span class='str'>&#39;__loader__&#39;</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>zipimporter</span><span class='op'>)</span><span class='op'>:</span> <span class='com'># UNIX ZIP</span><span class='strut'>&nbsp;</span></p>
  769. <p id='t102' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>filename</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>W_OK</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  770. <p id='t103' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>&#39;ERROR: no write permissions on %s&#39;</span> <span class='op'>%</span> <span class='nam'>filename</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  771. <p id='t104' class='pln'><span class='strut'>&nbsp;</span></p>
  772. <p id='t105' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>downloader</span><span class='op'>.</span><span class='nam'>to_screen</span><span class='op'>(</span><span class='str'>u&#39;Updating to latest version...&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  773. <p id='t106' class='pln'><span class='strut'>&nbsp;</span></p>
  774. <p id='t107' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>urla</span> <span class='op'>=</span> <span class='nam'>compat_urllib_request</span><span class='op'>.</span><span class='nam'>urlopen</span><span class='op'>(</span><span class='nam'>API_URL</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  775. <p id='t108' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>download</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>x</span> <span class='key'>for</span> <span class='nam'>x</span> <span class='key'>in</span> <span class='nam'>json</span><span class='op'>.</span><span class='nam'>loads</span><span class='op'>(</span><span class='nam'>urla</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>decode</span><span class='op'>(</span><span class='str'>&#39;utf8&#39;</span><span class='op'>)</span><span class='op'>)</span> <span class='key'>if</span> <span class='nam'>x</span><span class='op'>[</span><span class='str'>&quot;name&quot;</span><span class='op'>]</span> <span class='op'>==</span> <span class='str'>&quot;youtube-dl&quot;</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
  776. <p id='t109' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>download</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  777. <p id='t110' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>downloader</span><span class='op'>.</span><span class='nam'>to_screen</span><span class='op'>(</span><span class='str'>u&#39;ERROR: can\&#39;t find the current version. Please try again later.&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  778. <p id='t111' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class='strut'>&nbsp;</span></p>
  779. <p id='t112' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>newversion</span> <span class='op'>=</span> <span class='nam'>download</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>[</span><span class='str'>&quot;description&quot;</span><span class='op'>]</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  780. <p id='t113' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>newversion</span> <span class='op'>==</span> <span class='nam'>__version__</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  781. <p id='t114' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>downloader</span><span class='op'>.</span><span class='nam'>to_screen</span><span class='op'>(</span><span class='str'>u&#39;youtube-dl is up-to-date (&#39;</span> <span class='op'>+</span> <span class='nam'>__version__</span> <span class='op'>+</span> <span class='str'>&#39;)&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  782. <p id='t115' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class='strut'>&nbsp;</span></p>
  783. <p id='t116' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>urla</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  784. <p id='t117' class='pln'><span class='strut'>&nbsp;</span></p>
  785. <p id='t118' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  786. <p id='t119' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>urlh</span> <span class='op'>=</span> <span class='nam'>compat_urllib_request</span><span class='op'>.</span><span class='nam'>urlopen</span><span class='op'>(</span><span class='nam'>BIN_URL</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  787. <p id='t120' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>newcontent</span> <span class='op'>=</span> <span class='nam'>urlh</span><span class='op'>.</span><span class='nam'>read</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  788. <p id='t121' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>urlh</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  789. <p id='t122' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='op'>(</span><span class='nam'>IOError</span><span class='op'>,</span> <span class='nam'>OSError</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  790. <p id='t123' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>&#39;ERROR: unable to download latest version&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  791. <p id='t124' class='pln'><span class='strut'>&nbsp;</span></p>
  792. <p id='t125' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  793. <p id='t126' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>with</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>filename</span><span class='op'>,</span> <span class='str'>&#39;wb&#39;</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>outf</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  794. <p id='t127' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>outf</span><span class='op'>.</span><span class='nam'>write</span><span class='op'>(</span><span class='nam'>newcontent</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  795. <p id='t128' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='op'>(</span><span class='nam'>IOError</span><span class='op'>,</span> <span class='nam'>OSError</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  796. <p id='t129' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>&#39;ERROR: unable to overwrite current version&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  797. <p id='t130' class='pln'><span class='strut'>&nbsp;</span></p>
  798. <p id='t131' class='pln'>&nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  799. <p id='t132' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>downloader</span><span class='op'>.</span><span class='nam'>to_screen</span><span class='op'>(</span><span class='str'>u&#39;It looks like you installed youtube-dl with pip or setup.py. Please use that to update.&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  800. <p id='t133' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span><span class='strut'>&nbsp;</span></p>
  801. <p id='t134' class='pln'><span class='strut'>&nbsp;</span></p>
  802. <p id='t135' class='stm mis'>&nbsp; &nbsp; <span class='nam'>downloader</span><span class='op'>.</span><span class='nam'>to_screen</span><span class='op'>(</span><span class='str'>u&#39;Updated youtube-dl. Restart youtube-dl to use the new version.&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  803. <p id='t136' class='pln'><span class='strut'>&nbsp;</span></p>
  804. <p id='t137' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>parseOpts</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  805. <p id='t138' class='stm mis'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_readOptions</span><span class='op'>(</span><span class='nam'>filename_bytes</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  806. <p id='t139' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  807. <p id='t140' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>optionf</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>filename_bytes</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  808. <p id='t141' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>IOError</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  809. <p id='t142' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='op'>[</span><span class='op'>]</span> <span class='com'># silently skip if file is not present</span><span class='strut'>&nbsp;</span></p>
  810. <p id='t143' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  811. <p id='t144' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>res</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
  812. <p id='t145' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>l</span> <span class='key'>in</span> <span class='nam'>optionf</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  813. <p id='t146' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>res</span> <span class='op'>+=</span> <span class='nam'>shlex</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='nam'>l</span><span class='op'>,</span> <span class='nam'>comments</span><span class='op'>=</span><span class='key'>True</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  814. <p id='t147' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>finally</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  815. <p id='t148' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>optionf</span><span class='op'>.</span><span class='nam'>close</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  816. <p id='t149' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>res</span><span class='strut'>&nbsp;</span></p>
  817. <p id='t150' class='pln'><span class='strut'>&nbsp;</span></p>
  818. <p id='t151' class='stm mis'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_format_option_string</span><span class='op'>(</span><span class='nam'>option</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  819. <p id='t152' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;&#39;&#39; (&#39;-o&#39;, &#39;--option&#39;) -&gt; -o, --format METAVAR&#39;&#39;&#39;</span><span class='strut'>&nbsp;</span></p>
  820. <p id='t153' class='pln'><span class='strut'>&nbsp;</span></p>
  821. <p id='t154' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
  822. <p id='t155' class='pln'><span class='strut'>&nbsp;</span></p>
  823. <p id='t156' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>option</span><span class='op'>.</span><span class='nam'>_short_opts</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  824. <p id='t157' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>option</span><span class='op'>.</span><span class='nam'>_short_opts</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  825. <p id='t158' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>option</span><span class='op'>.</span><span class='nam'>_long_opts</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  826. <p id='t159' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='nam'>option</span><span class='op'>.</span><span class='nam'>_long_opts</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  827. <p id='t160' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>)</span> <span class='op'>&gt;</span> <span class='num'>1</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  828. <p id='t161' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>insert</span><span class='op'>(</span><span class='num'>1</span><span class='op'>,</span> <span class='str'>&#39;, &#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  829. <p id='t162' class='pln'><span class='strut'>&nbsp;</span></p>
  830. <p id='t163' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>option</span><span class='op'>.</span><span class='nam'>takes_value</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>append</span><span class='op'>(</span><span class='str'>&#39; %s&#39;</span> <span class='op'>%</span> <span class='nam'>option</span><span class='op'>.</span><span class='nam'>metavar</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  831. <p id='t164' class='pln'><span class='strut'>&nbsp;</span></p>
  832. <p id='t165' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='str'>&quot;&quot;</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  833. <p id='t166' class='pln'><span class='strut'>&nbsp;</span></p>
  834. <p id='t167' class='stm mis'>&nbsp; &nbsp; <span class='key'>def</span> <span class='nam'>_find_term_columns</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  835. <p id='t168' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>columns</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>environ</span><span class='op'>.</span><span class='nam'>get</span><span class='op'>(</span><span class='str'>&#39;COLUMNS&#39;</span><span class='op'>,</span> <span class='key'>None</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  836. <p id='t169' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>columns</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  837. <p id='t170' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>int</span><span class='op'>(</span><span class='nam'>columns</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  838. <p id='t171' class='pln'><span class='strut'>&nbsp;</span></p>
  839. <p id='t172' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  840. <p id='t173' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sp</span> <span class='op'>=</span> <span class='nam'>subprocess</span><span class='op'>.</span><span class='nam'>Popen</span><span class='op'>(</span><span class='op'>[</span><span class='str'>&#39;stty&#39;</span><span class='op'>,</span> <span class='str'>&#39;size&#39;</span><span class='op'>]</span><span class='op'>,</span> <span class='nam'>stdout</span><span class='op'>=</span><span class='nam'>subprocess</span><span class='op'>.</span><span class='nam'>PIPE</span><span class='op'>,</span> <span class='nam'>stderr</span><span class='op'>=</span><span class='nam'>subprocess</span><span class='op'>.</span><span class='nam'>PIPE</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  841. <p id='t174' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>out</span><span class='op'>,</span><span class='nam'>err</span> <span class='op'>=</span> <span class='nam'>sp</span><span class='op'>.</span><span class='nam'>communicate</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  842. <p id='t175' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>int</span><span class='op'>(</span><span class='nam'>out</span><span class='op'>.</span><span class='nam'>split</span><span class='op'>(</span><span class='op'>)</span><span class='op'>[</span><span class='num'>1</span><span class='op'>]</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  843. <p id='t176' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  844. <p id='t177' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>pass</span><span class='strut'>&nbsp;</span></p>
  845. <p id='t178' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>return</span> <span class='key'>None</span><span class='strut'>&nbsp;</span></p>
  846. <p id='t179' class='pln'><span class='strut'>&nbsp;</span></p>
  847. <p id='t180' class='stm mis'>&nbsp; &nbsp; <span class='nam'>max_width</span> <span class='op'>=</span> <span class='num'>80</span><span class='strut'>&nbsp;</span></p>
  848. <p id='t181' class='stm mis'>&nbsp; &nbsp; <span class='nam'>max_help_position</span> <span class='op'>=</span> <span class='num'>80</span><span class='strut'>&nbsp;</span></p>
  849. <p id='t182' class='pln'><span class='strut'>&nbsp;</span></p>
  850. <p id='t183' class='pln'>&nbsp; &nbsp; <span class='com'># No need to wrap help messages if we&#39;re on a wide console</span><span class='strut'>&nbsp;</span></p>
  851. <p id='t184' class='stm mis'>&nbsp; &nbsp; <span class='nam'>columns</span> <span class='op'>=</span> <span class='nam'>_find_term_columns</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  852. <p id='t185' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>columns</span><span class='op'>:</span> <span class='nam'>max_width</span> <span class='op'>=</span> <span class='nam'>columns</span><span class='strut'>&nbsp;</span></p>
  853. <p id='t186' class='pln'><span class='strut'>&nbsp;</span></p>
  854. <p id='t187' class='stm mis'>&nbsp; &nbsp; <span class='nam'>fmt</span> <span class='op'>=</span> <span class='nam'>optparse</span><span class='op'>.</span><span class='nam'>IndentedHelpFormatter</span><span class='op'>(</span><span class='nam'>width</span><span class='op'>=</span><span class='nam'>max_width</span><span class='op'>,</span> <span class='nam'>max_help_position</span><span class='op'>=</span><span class='nam'>max_help_position</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  855. <p id='t188' class='stm mis'>&nbsp; &nbsp; <span class='nam'>fmt</span><span class='op'>.</span><span class='nam'>format_option_strings</span> <span class='op'>=</span> <span class='nam'>_format_option_string</span><span class='strut'>&nbsp;</span></p>
  856. <p id='t189' class='pln'><span class='strut'>&nbsp;</span></p>
  857. <p id='t190' class='stm mis'>&nbsp; &nbsp; <span class='nam'>kw</span> <span class='op'>=</span> <span class='op'>{</span><span class='strut'>&nbsp;</span></p>
  858. <p id='t191' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;version&#39;</span>&nbsp;&nbsp; <span class='op'>:</span> <span class='nam'>__version__</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  859. <p id='t192' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;formatter&#39;</span> <span class='op'>:</span> <span class='nam'>fmt</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  860. <p id='t193' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;usage&#39;</span> <span class='op'>:</span> <span class='str'>&#39;%prog [options] url [url...]&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  861. <p id='t194' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;conflict_handler&#39;</span> <span class='op'>:</span> <span class='str'>&#39;resolve&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  862. <p id='t195' class='pln'>&nbsp; &nbsp; <span class='op'>}</span><span class='strut'>&nbsp;</span></p>
  863. <p id='t196' class='pln'><span class='strut'>&nbsp;</span></p>
  864. <p id='t197' class='stm mis'>&nbsp; &nbsp; <span class='nam'>parser</span> <span class='op'>=</span> <span class='nam'>optparse</span><span class='op'>.</span><span class='nam'>OptionParser</span><span class='op'>(</span><span class='op'>**</span><span class='nam'>kw</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  865. <p id='t198' class='pln'><span class='strut'>&nbsp;</span></p>
  866. <p id='t199' class='pln'>&nbsp; &nbsp; <span class='com'># option groups</span><span class='strut'>&nbsp;</span></p>
  867. <p id='t200' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>=</span> <span class='nam'>optparse</span><span class='op'>.</span><span class='nam'>OptionGroup</span><span class='op'>(</span><span class='nam'>parser</span><span class='op'>,</span> <span class='str'>&#39;General Options&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  868. <p id='t201' class='stm mis'>&nbsp; &nbsp; <span class='nam'>selection</span>&nbsp; &nbsp; &nbsp; <span class='op'>=</span> <span class='nam'>optparse</span><span class='op'>.</span><span class='nam'>OptionGroup</span><span class='op'>(</span><span class='nam'>parser</span><span class='op'>,</span> <span class='str'>&#39;Video Selection&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  869. <p id='t202' class='stm mis'>&nbsp; &nbsp; <span class='nam'>authentication</span> <span class='op'>=</span> <span class='nam'>optparse</span><span class='op'>.</span><span class='nam'>OptionGroup</span><span class='op'>(</span><span class='nam'>parser</span><span class='op'>,</span> <span class='str'>&#39;Authentication Options&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  870. <p id='t203' class='stm mis'>&nbsp; &nbsp; <span class='nam'>video_format</span>&nbsp;&nbsp; <span class='op'>=</span> <span class='nam'>optparse</span><span class='op'>.</span><span class='nam'>OptionGroup</span><span class='op'>(</span><span class='nam'>parser</span><span class='op'>,</span> <span class='str'>&#39;Video Format Options&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  871. <p id='t204' class='stm mis'>&nbsp; &nbsp; <span class='nam'>postproc</span>&nbsp; &nbsp; &nbsp;&nbsp; <span class='op'>=</span> <span class='nam'>optparse</span><span class='op'>.</span><span class='nam'>OptionGroup</span><span class='op'>(</span><span class='nam'>parser</span><span class='op'>,</span> <span class='str'>&#39;Post-processing Options&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  872. <p id='t205' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span>&nbsp; &nbsp;&nbsp; <span class='op'>=</span> <span class='nam'>optparse</span><span class='op'>.</span><span class='nam'>OptionGroup</span><span class='op'>(</span><span class='nam'>parser</span><span class='op'>,</span> <span class='str'>&#39;Filesystem Options&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  873. <p id='t206' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span>&nbsp; &nbsp; &nbsp; <span class='op'>=</span> <span class='nam'>optparse</span><span class='op'>.</span><span class='nam'>OptionGroup</span><span class='op'>(</span><span class='nam'>parser</span><span class='op'>,</span> <span class='str'>&#39;Verbosity / Simulation Options&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  874. <p id='t207' class='pln'><span class='strut'>&nbsp;</span></p>
  875. <p id='t208' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-h&#39;</span><span class='op'>,</span> <span class='str'>&#39;--help&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  876. <p id='t209' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;help&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;print this help text and exit&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  877. <p id='t210' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-v&#39;</span><span class='op'>,</span> <span class='str'>&#39;--version&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  878. <p id='t211' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;version&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;print program version and exit&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  879. <p id='t212' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-U&#39;</span><span class='op'>,</span> <span class='str'>&#39;--update&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  880. <p id='t213' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;update_self&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;update this program to latest version&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  881. <p id='t214' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-i&#39;</span><span class='op'>,</span> <span class='str'>&#39;--ignore-errors&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  882. <p id='t215' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;ignoreerrors&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;continue on download errors&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  883. <p id='t216' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-r&#39;</span><span class='op'>,</span> <span class='str'>&#39;--rate-limit&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  884. <p id='t217' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;ratelimit&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;LIMIT&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;download rate limit (e.g. 50k or 44.6m)&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  885. <p id='t218' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-R&#39;</span><span class='op'>,</span> <span class='str'>&#39;--retries&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  886. <p id='t219' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;retries&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;RETRIES&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;number of retries (default is %default)&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='num'>10</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  887. <p id='t220' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--buffer-size&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  888. <p id='t221' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;buffersize&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;SIZE&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;size of download buffer (e.g. 1024 or 16k) (default is %default)&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='str'>&quot;1024&quot;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  889. <p id='t222' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--no-resize-buffer&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  890. <p id='t223' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;noresizebuffer&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  891. <p id='t224' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;do not automatically adjust the buffer size. By default, the buffer size is automatically resized from an initial value of SIZE.&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  892. <p id='t225' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--dump-user-agent&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  893. <p id='t226' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;dump_user_agent&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  894. <p id='t227' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;display the current browser identification&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  895. <p id='t228' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--user-agent&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  896. <p id='t229' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;user_agent&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;specify a custom user agent&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;UA&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  897. <p id='t230' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--list-extractors&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  898. <p id='t231' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;list_extractors&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  899. <p id='t232' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;List all supported extractors and the URLs they would handle&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  900. <p id='t233' class='stm mis'>&nbsp; &nbsp; <span class='nam'>general</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--test&#39;</span><span class='op'>,</span> <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;test&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='nam'>optparse</span><span class='op'>.</span><span class='nam'>SUPPRESS_HELP</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  901. <p id='t234' class='pln'><span class='strut'>&nbsp;</span></p>
  902. <p id='t235' class='stm mis'>&nbsp; &nbsp; <span class='nam'>selection</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--playlist-start&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  903. <p id='t236' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;playliststart&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;NUMBER&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;playlist video to start at (default is %default)&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='num'>1</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  904. <p id='t237' class='stm mis'>&nbsp; &nbsp; <span class='nam'>selection</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--playlist-end&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  905. <p id='t238' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;playlistend&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;NUMBER&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;playlist video to end at (default is last)&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='op'>-</span><span class='num'>1</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  906. <p id='t239' class='stm mis'>&nbsp; &nbsp; <span class='nam'>selection</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--match-title&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;matchtitle&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;REGEX&#39;</span><span class='op'>,</span><span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;download only matching titles (regex or caseless sub-string)&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  907. <p id='t240' class='stm mis'>&nbsp; &nbsp; <span class='nam'>selection</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--reject-title&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;rejecttitle&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;REGEX&#39;</span><span class='op'>,</span><span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;skip download for matching titles (regex or caseless sub-string)&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  908. <p id='t241' class='stm mis'>&nbsp; &nbsp; <span class='nam'>selection</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--max-downloads&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;NUMBER&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;max_downloads&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;Abort after downloading NUMBER files&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>None</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  909. <p id='t242' class='pln'><span class='strut'>&nbsp;</span></p>
  910. <p id='t243' class='stm mis'>&nbsp; &nbsp; <span class='nam'>authentication</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-u&#39;</span><span class='op'>,</span> <span class='str'>&#39;--username&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  911. <p id='t244' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;username&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;USERNAME&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;account username&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  912. <p id='t245' class='stm mis'>&nbsp; &nbsp; <span class='nam'>authentication</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-p&#39;</span><span class='op'>,</span> <span class='str'>&#39;--password&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  913. <p id='t246' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;password&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;PASSWORD&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;account password&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  914. <p id='t247' class='stm mis'>&nbsp; &nbsp; <span class='nam'>authentication</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-n&#39;</span><span class='op'>,</span> <span class='str'>&#39;--netrc&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  915. <p id='t248' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;usenetrc&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;use .netrc authentication data&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  916. <p id='t249' class='pln'><span class='strut'>&nbsp;</span></p>
  917. <p id='t250' class='pln'><span class='strut'>&nbsp;</span></p>
  918. <p id='t251' class='stm mis'>&nbsp; &nbsp; <span class='nam'>video_format</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-f&#39;</span><span class='op'>,</span> <span class='str'>&#39;--format&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  919. <p id='t252' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;format&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;FORMAT&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;video format code&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  920. <p id='t253' class='stm mis'>&nbsp; &nbsp; <span class='nam'>video_format</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--all-formats&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  921. <p id='t254' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_const&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;format&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;download all available video formats&#39;</span><span class='op'>,</span> <span class='nam'>const</span><span class='op'>=</span><span class='str'>&#39;all&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  922. <p id='t255' class='stm mis'>&nbsp; &nbsp; <span class='nam'>video_format</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--prefer-free-formats&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  923. <p id='t256' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;prefer_free_formats&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;prefer free video formats unless a specific one is requested&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  924. <p id='t257' class='stm mis'>&nbsp; &nbsp; <span class='nam'>video_format</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--max-quality&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  925. <p id='t258' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;format_limit&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;FORMAT&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;highest quality format to download&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  926. <p id='t259' class='stm mis'>&nbsp; &nbsp; <span class='nam'>video_format</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-F&#39;</span><span class='op'>,</span> <span class='str'>&#39;--list-formats&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  927. <p id='t260' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;listformats&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;list all available formats (currently youtube only)&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  928. <p id='t261' class='stm mis'>&nbsp; &nbsp; <span class='nam'>video_format</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--write-srt&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  929. <p id='t262' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;writesubtitles&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  930. <p id='t263' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;write video closed captions to a .srt file (currently youtube only)&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  931. <p id='t264' class='stm mis'>&nbsp; &nbsp; <span class='nam'>video_format</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--srt-lang&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  932. <p id='t265' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;subtitleslang&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;LANG&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  933. <p id='t266' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;language of the closed captions to download (optional) use IETF language tags like \&#39;en\&#39;&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  934. <p id='t267' class='pln'><span class='strut'>&nbsp;</span></p>
  935. <p id='t268' class='pln'><span class='strut'>&nbsp;</span></p>
  936. <p id='t269' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-q&#39;</span><span class='op'>,</span> <span class='str'>&#39;--quiet&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  937. <p id='t270' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;quiet&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;activates quiet mode&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  938. <p id='t271' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-s&#39;</span><span class='op'>,</span> <span class='str'>&#39;--simulate&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  939. <p id='t272' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;simulate&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;do not download the video and do not write anything to disk&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  940. <p id='t273' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--skip-download&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  941. <p id='t274' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;skip_download&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;do not download the video&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  942. <p id='t275' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-g&#39;</span><span class='op'>,</span> <span class='str'>&#39;--get-url&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  943. <p id='t276' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;geturl&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;simulate, quiet but print URL&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  944. <p id='t277' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-e&#39;</span><span class='op'>,</span> <span class='str'>&#39;--get-title&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  945. <p id='t278' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;gettitle&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;simulate, quiet but print title&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  946. <p id='t279' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--get-thumbnail&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  947. <p id='t280' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;getthumbnail&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  948. <p id='t281' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;simulate, quiet but print thumbnail URL&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  949. <p id='t282' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--get-description&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  950. <p id='t283' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;getdescription&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  951. <p id='t284' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;simulate, quiet but print video description&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  952. <p id='t285' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--get-filename&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  953. <p id='t286' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;getfilename&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  954. <p id='t287' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;simulate, quiet but print output filename&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  955. <p id='t288' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--get-format&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  956. <p id='t289' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;getformat&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  957. <p id='t290' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;simulate, quiet but print output format&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  958. <p id='t291' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--no-progress&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  959. <p id='t292' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;noprogress&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;do not print progress bar&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  960. <p id='t293' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--console-title&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  961. <p id='t294' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;consoletitle&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  962. <p id='t295' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;display progress in console titlebar&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  963. <p id='t296' class='stm mis'>&nbsp; &nbsp; <span class='nam'>verbosity</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-v&#39;</span><span class='op'>,</span> <span class='str'>&#39;--verbose&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  964. <p id='t297' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;verbose&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;print various debugging information&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  965. <p id='t298' class='pln'><span class='strut'>&nbsp;</span></p>
  966. <p id='t299' class='pln'><span class='strut'>&nbsp;</span></p>
  967. <p id='t300' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-t&#39;</span><span class='op'>,</span> <span class='str'>&#39;--title&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  968. <p id='t301' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;usetitle&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;use title in file name&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  969. <p id='t302' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--id&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  970. <p id='t303' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;useid&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;use video ID in file name&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  971. <p id='t304' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-l&#39;</span><span class='op'>,</span> <span class='str'>&#39;--literal&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  972. <p id='t305' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;usetitle&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;[deprecated] alias of --title&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  973. <p id='t306' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-A&#39;</span><span class='op'>,</span> <span class='str'>&#39;--auto-number&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  974. <p id='t307' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;autonumber&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  975. <p id='t308' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;number downloaded files starting from 00000&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  976. <p id='t309' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-o&#39;</span><span class='op'>,</span> <span class='str'>&#39;--output&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  977. <p id='t310' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;outtmpl&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;TEMPLATE&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;output filename template. Use %(title)s to get the title, %(uploader)s for the uploader name, %(autonumber)s to get an automatically incremented number, %(ext)s for the filename extension, %(upload_date)s for the upload date (YYYYMMDD), %(extractor)s for the provider (youtube, metacafe, etc), %(id)s for the video id and %% for a literal percent. Use - to output to stdout. Can also be used to download to a different directory, for example with -o \&#39;/my/downloads/%(uploader)s/%(title)s-%(id)s.%(ext)s\&#39; .&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  978. <p id='t311' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--restrict-filenames&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  979. <p id='t312' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;restrictfilenames&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  980. <p id='t313' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;Restrict filenames to only ASCII characters, and avoid &quot;&amp;&quot; and spaces in filenames&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  981. <p id='t314' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-a&#39;</span><span class='op'>,</span> <span class='str'>&#39;--batch-file&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  982. <p id='t315' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;batchfile&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;FILE&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;file containing URLs to download (\&#39;-\&#39; for stdin)&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  983. <p id='t316' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-w&#39;</span><span class='op'>,</span> <span class='str'>&#39;--no-overwrites&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  984. <p id='t317' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;nooverwrites&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;do not overwrite files&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  985. <p id='t318' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-c&#39;</span><span class='op'>,</span> <span class='str'>&#39;--continue&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  986. <p id='t319' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;continue_dl&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;resume partially downloaded files&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>True</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  987. <p id='t320' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--no-continue&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  988. <p id='t321' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_false&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;continue_dl&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  989. <p id='t322' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;do not resume partially downloaded files (restart from beginning)&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  990. <p id='t323' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--cookies&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  991. <p id='t324' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;cookiefile&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;FILE&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;file to read cookies from and dump cookie jar in&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  992. <p id='t325' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--no-part&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  993. <p id='t326' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;nopart&#39;</span><span class='op'>,</span> <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;do not use .part files&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  994. <p id='t327' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--no-mtime&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  995. <p id='t328' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_false&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;updatetime&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  996. <p id='t329' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;do not use the Last-modified header to set the file modification time&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>True</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  997. <p id='t330' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--write-description&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  998. <p id='t331' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;writedescription&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  999. <p id='t332' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;write video description to a .description file&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1000. <p id='t333' class='stm mis'>&nbsp; &nbsp; <span class='nam'>filesystem</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--write-info-json&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1001. <p id='t334' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;writeinfojson&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1002. <p id='t335' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;write video metadata to a .info.json file&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1003. <p id='t336' class='pln'><span class='strut'>&nbsp;</span></p>
  1004. <p id='t337' class='pln'><span class='strut'>&nbsp;</span></p>
  1005. <p id='t338' class='stm mis'>&nbsp; &nbsp; <span class='nam'>postproc</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-x&#39;</span><span class='op'>,</span> <span class='str'>&#39;--extract-audio&#39;</span><span class='op'>,</span> <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;extractaudio&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1006. <p id='t339' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;convert video files to audio-only files (requires ffmpeg or avconv and ffprobe or avprobe)&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1007. <p id='t340' class='stm mis'>&nbsp; &nbsp; <span class='nam'>postproc</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--audio-format&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;FORMAT&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;audioformat&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='str'>&#39;best&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1008. <p id='t341' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;&quot;best&quot;, &quot;aac&quot;, &quot;vorbis&quot;, &quot;mp3&quot;, &quot;m4a&quot;, or &quot;wav&quot;; best by default&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1009. <p id='t342' class='stm mis'>&nbsp; &nbsp; <span class='nam'>postproc</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;--audio-quality&#39;</span><span class='op'>,</span> <span class='nam'>metavar</span><span class='op'>=</span><span class='str'>&#39;QUALITY&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;audioquality&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='str'>&#39;5&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1010. <p id='t343' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;ffmpeg/avconv audio quality specification, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K (default 5)&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1011. <p id='t344' class='stm mis'>&nbsp; &nbsp; <span class='nam'>postproc</span><span class='op'>.</span><span class='nam'>add_option</span><span class='op'>(</span><span class='str'>&#39;-k&#39;</span><span class='op'>,</span> <span class='str'>&#39;--keep-video&#39;</span><span class='op'>,</span> <span class='nam'>action</span><span class='op'>=</span><span class='str'>&#39;store_true&#39;</span><span class='op'>,</span> <span class='nam'>dest</span><span class='op'>=</span><span class='str'>&#39;keepvideo&#39;</span><span class='op'>,</span> <span class='nam'>default</span><span class='op'>=</span><span class='key'>False</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1012. <p id='t345' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>help</span><span class='op'>=</span><span class='str'>&#39;keeps the video file on disk after the post-processing; the video is erased by default&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1013. <p id='t346' class='pln'><span class='strut'>&nbsp;</span></p>
  1014. <p id='t347' class='pln'><span class='strut'>&nbsp;</span></p>
  1015. <p id='t348' class='stm mis'>&nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>add_option_group</span><span class='op'>(</span><span class='nam'>general</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1016. <p id='t349' class='stm mis'>&nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>add_option_group</span><span class='op'>(</span><span class='nam'>selection</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1017. <p id='t350' class='stm mis'>&nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>add_option_group</span><span class='op'>(</span><span class='nam'>filesystem</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1018. <p id='t351' class='stm mis'>&nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>add_option_group</span><span class='op'>(</span><span class='nam'>verbosity</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1019. <p id='t352' class='stm mis'>&nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>add_option_group</span><span class='op'>(</span><span class='nam'>video_format</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1020. <p id='t353' class='stm mis'>&nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>add_option_group</span><span class='op'>(</span><span class='nam'>authentication</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1021. <p id='t354' class='stm mis'>&nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>add_option_group</span><span class='op'>(</span><span class='nam'>postproc</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1022. <p id='t355' class='pln'><span class='strut'>&nbsp;</span></p>
  1023. <p id='t356' class='stm mis'>&nbsp; &nbsp; <span class='nam'>xdg_config_home</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>environ</span><span class='op'>.</span><span class='nam'>get</span><span class='op'>(</span><span class='str'>&#39;XDG_CONFIG_HOME&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1024. <p id='t357' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>xdg_config_home</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1025. <p id='t358' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>userConf</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>xdg_config_home</span><span class='op'>,</span> <span class='str'>&#39;youtube-dl.conf&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1026. <p id='t359' class='pln'>&nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1027. <p id='t360' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>userConf</span> <span class='op'>=</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>join</span><span class='op'>(</span><span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>expanduser</span><span class='op'>(</span><span class='str'>&#39;~&#39;</span><span class='op'>)</span><span class='op'>,</span> <span class='str'>&#39;.config&#39;</span><span class='op'>,</span> <span class='str'>&#39;youtube-dl.conf&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1028. <p id='t361' class='stm mis'>&nbsp; &nbsp; <span class='nam'>argv</span> <span class='op'>=</span> <span class='nam'>_readOptions</span><span class='op'>(</span><span class='str'>&#39;/etc/youtube-dl.conf&#39;</span><span class='op'>)</span> <span class='op'>+</span> <span class='nam'>_readOptions</span><span class='op'>(</span><span class='nam'>userConf</span><span class='op'>)</span> <span class='op'>+</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>argv</span><span class='op'>[</span><span class='num'>1</span><span class='op'>:</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
  1029. <p id='t362' class='stm mis'>&nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>,</span> <span class='nam'>args</span> <span class='op'>=</span> <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>parse_args</span><span class='op'>(</span><span class='nam'>argv</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1030. <p id='t363' class='pln'><span class='strut'>&nbsp;</span></p>
  1031. <p id='t364' class='stm mis'>&nbsp; &nbsp; <span class='key'>return</span> <span class='nam'>parser</span><span class='op'>,</span> <span class='nam'>opts</span><span class='op'>,</span> <span class='nam'>args</span><span class='strut'>&nbsp;</span></p>
  1032. <p id='t365' class='pln'><span class='strut'>&nbsp;</span></p>
  1033. <p id='t366' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>gen_extractors</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1034. <p id='t367' class='pln'>&nbsp; &nbsp; <span class='str'>&quot;&quot;&quot; Return a list of an instance of every supported extractor.</span><span class='strut'>&nbsp;</span></p>
  1035. <p id='t368' class='pln'><span class='str'>&nbsp; &nbsp; The order does matter; the first extractor matched is the one handling the URL.</span><span class='strut'>&nbsp;</span></p>
  1036. <p id='t369' class='pln'><span class='str'>&nbsp; &nbsp; &quot;&quot;&quot;</span><span class='strut'>&nbsp;</span></p>
  1037. <p id='t370' class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>return</span> <span class='op'>[</span><span class='strut'>&nbsp;</span></p>
  1038. <p id='t371' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>YoutubePlaylistIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1039. <p id='t372' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>YoutubeChannelIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1040. <p id='t373' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>YoutubeUserIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1041. <p id='t374' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>YoutubeSearchIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1042. <p id='t375' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>YoutubeIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1043. <p id='t376' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>MetacafeIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1044. <p id='t377' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>DailymotionIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1045. <p id='t378' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>GoogleSearchIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1046. <p id='t379' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>PhotobucketIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1047. <p id='t380' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>YahooIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1048. <p id='t381' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>YahooSearchIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1049. <p id='t382' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>DepositFilesIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1050. <p id='t383' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>FacebookIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1051. <p id='t384' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>BlipTVUserIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1052. <p id='t385' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>BlipTVIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1053. <p id='t386' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>VimeoIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1054. <p id='t387' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>MyVideoIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1055. <p id='t388' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>ComedyCentralIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1056. <p id='t389' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>EscapistIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1057. <p id='t390' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>CollegeHumorIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1058. <p id='t391' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>XVideosIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1059. <p id='t392' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>SoundcloudIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1060. <p id='t393' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>InfoQIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1061. <p id='t394' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>MixcloudIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1062. <p id='t395' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>StanfordOpenClassroomIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1063. <p id='t396' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>MTVIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1064. <p id='t397' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>YoukuIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1065. <p id='t398' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>XNXXIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1066. <p id='t399' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>GooglePlusIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1067. <p id='t400' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>ArteTvIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1068. <p id='t401' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>NBAIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1069. <p id='t402' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>JustinTVIE</span><span class='op'>(</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1070. <p id='t403' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>GenericIE</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1071. <p id='t404' class='pln'>&nbsp; &nbsp; <span class='op'>]</span><span class='strut'>&nbsp;</span></p>
  1072. <p id='t405' class='pln'><span class='strut'>&nbsp;</span></p>
  1073. <p id='t406' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>_real_main</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1074. <p id='t407' class='stm run hide_run'>&nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>,</span> <span class='nam'>opts</span><span class='op'>,</span> <span class='nam'>args</span> <span class='op'>=</span> <span class='nam'>parseOpts</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1075. <p id='t408' class='pln'><span class='strut'>&nbsp;</span></p>
  1076. <p id='t409' class='pln'>&nbsp; &nbsp; <span class='com'># Open appropriate CookieJar</span><span class='strut'>&nbsp;</span></p>
  1077. <p id='t410' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>cookiefile</span> <span class='key'>is</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1078. <p id='t411' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>jar</span> <span class='op'>=</span> <span class='nam'>compat_cookiejar</span><span class='op'>.</span><span class='nam'>CookieJar</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1079. <p id='t412' class='pln'>&nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1080. <p id='t413' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1081. <p id='t414' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>jar</span> <span class='op'>=</span> <span class='nam'>compat_cookiejar</span><span class='op'>.</span><span class='nam'>MozillaCookieJar</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>cookiefile</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1082. <p id='t415' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>path</span><span class='op'>.</span><span class='nam'>isfile</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>cookiefile</span><span class='op'>)</span> <span class='key'>and</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>access</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>cookiefile</span><span class='op'>,</span> <span class='nam'>os</span><span class='op'>.</span><span class='nam'>R_OK</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1083. <p id='t416' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>jar</span><span class='op'>.</span><span class='nam'>load</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1084. <p id='t417' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='op'>(</span><span class='nam'>IOError</span><span class='op'>,</span> <span class='nam'>OSError</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1085. <p id='t418' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>u&#39;ERROR: unable to open cookie file&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1086. <p id='t419' class='pln'>&nbsp; &nbsp; <span class='com'># Set user agent</span><span class='strut'>&nbsp;</span></p>
  1087. <p id='t420' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>user_agent</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1088. <p id='t421' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>std_headers</span><span class='op'>[</span><span class='str'>&#39;User-Agent&#39;</span><span class='op'>]</span> <span class='op'>=</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>user_agent</span><span class='strut'>&nbsp;</span></p>
  1089. <p id='t422' class='pln'><span class='strut'>&nbsp;</span></p>
  1090. <p id='t423' class='pln'>&nbsp; &nbsp; <span class='com'># Dump user agent</span><span class='strut'>&nbsp;</span></p>
  1091. <p id='t424' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>dump_user_agent</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1092. <p id='t425' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>print</span><span class='op'>(</span><span class='nam'>std_headers</span><span class='op'>[</span><span class='str'>&#39;User-Agent&#39;</span><span class='op'>]</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1093. <p id='t426' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1094. <p id='t427' class='pln'><span class='strut'>&nbsp;</span></p>
  1095. <p id='t428' class='pln'>&nbsp; &nbsp; <span class='com'># Batch file verification</span><span class='strut'>&nbsp;</span></p>
  1096. <p id='t429' class='stm mis'>&nbsp; &nbsp; <span class='nam'>batchurls</span> <span class='op'>=</span> <span class='op'>[</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
  1097. <p id='t430' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>batchfile</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1098. <p id='t431' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1099. <p id='t432' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>batchfile</span> <span class='op'>==</span> <span class='str'>&#39;-&#39;</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1100. <p id='t433' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>batchfd</span> <span class='op'>=</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>stdin</span><span class='strut'>&nbsp;</span></p>
  1101. <p id='t434' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1102. <p id='t435' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>batchfd</span> <span class='op'>=</span> <span class='nam'>open</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>batchfile</span><span class='op'>,</span> <span class='str'>&#39;r&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1103. <p id='t436' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>batchurls</span> <span class='op'>=</span> <span class='nam'>batchfd</span><span class='op'>.</span><span class='nam'>readlines</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1104. <p id='t437' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>batchurls</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>x</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='key'>for</span> <span class='nam'>x</span> <span class='key'>in</span> <span class='nam'>batchurls</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
  1105. <p id='t438' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>batchurls</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>x</span> <span class='key'>for</span> <span class='nam'>x</span> <span class='key'>in</span> <span class='nam'>batchurls</span> <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>x</span><span class='op'>)</span> <span class='op'>&gt;</span> <span class='num'>0</span> <span class='key'>and</span> <span class='key'>not</span> <span class='nam'>re</span><span class='op'>.</span><span class='nam'>search</span><span class='op'>(</span><span class='str'>r&#39;^[#/;]&#39;</span><span class='op'>,</span> <span class='nam'>x</span><span class='op'>)</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
  1106. <p id='t439' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>IOError</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1107. <p id='t440' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>u&#39;ERROR: batch file could not be read&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1108. <p id='t441' class='stm mis'>&nbsp; &nbsp; <span class='nam'>all_urls</span> <span class='op'>=</span> <span class='nam'>batchurls</span> <span class='op'>+</span> <span class='nam'>args</span><span class='strut'>&nbsp;</span></p>
  1109. <p id='t442' class='stm mis'>&nbsp; &nbsp; <span class='nam'>all_urls</span> <span class='op'>=</span> <span class='op'>[</span><span class='nam'>url</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='op'>)</span> <span class='key'>for</span> <span class='nam'>url</span> <span class='key'>in</span> <span class='nam'>all_urls</span><span class='op'>]</span><span class='strut'>&nbsp;</span></p>
  1110. <p id='t443' class='pln'><span class='strut'>&nbsp;</span></p>
  1111. <p id='t444' class='pln'>&nbsp; &nbsp; <span class='com'># General configuration</span><span class='strut'>&nbsp;</span></p>
  1112. <p id='t445' class='stm mis'>&nbsp; &nbsp; <span class='nam'>cookie_processor</span> <span class='op'>=</span> <span class='nam'>compat_urllib_request</span><span class='op'>.</span><span class='nam'>HTTPCookieProcessor</span><span class='op'>(</span><span class='nam'>jar</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1113. <p id='t446' class='stm mis'>&nbsp; &nbsp; <span class='nam'>proxy_handler</span> <span class='op'>=</span> <span class='nam'>compat_urllib_request</span><span class='op'>.</span><span class='nam'>ProxyHandler</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1114. <p id='t447' class='stm mis'>&nbsp; &nbsp; <span class='nam'>opener</span> <span class='op'>=</span> <span class='nam'>compat_urllib_request</span><span class='op'>.</span><span class='nam'>build_opener</span><span class='op'>(</span><span class='nam'>proxy_handler</span><span class='op'>,</span> <span class='nam'>cookie_processor</span><span class='op'>,</span> <span class='nam'>YoutubeDLHandler</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1115. <p id='t448' class='stm mis'>&nbsp; &nbsp; <span class='nam'>compat_urllib_request</span><span class='op'>.</span><span class='nam'>install_opener</span><span class='op'>(</span><span class='nam'>opener</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1116. <p id='t449' class='stm mis'>&nbsp; &nbsp; <span class='nam'>socket</span><span class='op'>.</span><span class='nam'>setdefaulttimeout</span><span class='op'>(</span><span class='num'>300</span><span class='op'>)</span> <span class='com'># 5 minutes should be enough (famous last words)</span><span class='strut'>&nbsp;</span></p>
  1117. <p id='t450' class='pln'><span class='strut'>&nbsp;</span></p>
  1118. <p id='t451' class='stm mis'>&nbsp; &nbsp; <span class='nam'>extractors</span> <span class='op'>=</span> <span class='nam'>gen_extractors</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1119. <p id='t452' class='pln'><span class='strut'>&nbsp;</span></p>
  1120. <p id='t453' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>list_extractors</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1121. <p id='t454' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>ie</span> <span class='key'>in</span> <span class='nam'>extractors</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1122. <p id='t455' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>print</span><span class='op'>(</span><span class='nam'>ie</span><span class='op'>.</span><span class='nam'>IE_NAME</span> <span class='op'>+</span> <span class='op'>(</span><span class='str'>&#39; (CURRENTLY BROKEN)&#39;</span> <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>ie</span><span class='op'>.</span><span class='nam'>_WORKING</span> <span class='key'>else</span> <span class='str'>&#39;&#39;</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1123. <p id='t456' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>matchedUrls</span> <span class='op'>=</span> <span class='nam'>filter</span><span class='op'>(</span><span class='key'>lambda</span> <span class='nam'>url</span><span class='op'>:</span> <span class='nam'>ie</span><span class='op'>.</span><span class='nam'>suitable</span><span class='op'>(</span><span class='nam'>url</span><span class='op'>)</span><span class='op'>,</span> <span class='nam'>all_urls</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1124. <p id='t457' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>all_urls</span> <span class='op'>=</span> <span class='nam'>filter</span><span class='op'>(</span><span class='key'>lambda</span> <span class='nam'>url</span><span class='op'>:</span> <span class='nam'>url</span> <span class='key'>not</span> <span class='key'>in</span> <span class='nam'>matchedUrls</span><span class='op'>,</span> <span class='nam'>all_urls</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1125. <p id='t458' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>mu</span> <span class='key'>in</span> <span class='nam'>matchedUrls</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1126. <p id='t459' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>print</span><span class='op'>(</span><span class='str'>u&#39;&nbsp; &#39;</span> <span class='op'>+</span> <span class='nam'>mu</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1127. <p id='t460' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='num'>0</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1128. <p id='t461' class='pln'><span class='strut'>&nbsp;</span></p>
  1129. <p id='t462' class='pln'>&nbsp; &nbsp; <span class='com'># Conflicting, missing and erroneous options</span><span class='strut'>&nbsp;</span></p>
  1130. <p id='t463' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>usenetrc</span> <span class='key'>and</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>username</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>password</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1131. <p id='t464' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;using .netrc conflicts with giving username/password&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1132. <p id='t465' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>password</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span> <span class='key'>and</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>username</span> <span class='key'>is</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1133. <p id='t466' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;account username missing&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1134. <p id='t467' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>outtmpl</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span> <span class='key'>and</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>usetitle</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>autonumber</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>useid</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1135. <p id='t468' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;using output template conflicts with using title, video ID or auto number&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1136. <p id='t469' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>usetitle</span> <span class='key'>and</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>useid</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1137. <p id='t470' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;using title conflicts with using video ID&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1138. <p id='t471' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>username</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span> <span class='key'>and</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>password</span> <span class='key'>is</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1139. <p id='t472' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>password</span> <span class='op'>=</span> <span class='nam'>getpass</span><span class='op'>.</span><span class='nam'>getpass</span><span class='op'>(</span><span class='str'>u&#39;Type account password and press return:&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1140. <p id='t473' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>ratelimit</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1141. <p id='t474' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>numeric_limit</span> <span class='op'>=</span> <span class='nam'>FileDownloader</span><span class='op'>.</span><span class='nam'>parse_bytes</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>ratelimit</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1142. <p id='t475' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>numeric_limit</span> <span class='key'>is</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1143. <p id='t476' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;invalid rate limit specified&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1144. <p id='t477' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>ratelimit</span> <span class='op'>=</span> <span class='nam'>numeric_limit</span><span class='strut'>&nbsp;</span></p>
  1145. <p id='t478' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>retries</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1146. <p id='t479' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1147. <p id='t480' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>retries</span> <span class='op'>=</span> <span class='nam'>int</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>retries</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1148. <p id='t481' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='op'>(</span><span class='nam'>TypeError</span><span class='op'>,</span> <span class='nam'>ValueError</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1149. <p id='t482' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;invalid retry count specified&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1150. <p id='t483' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>buffersize</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1151. <p id='t484' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>numeric_buffersize</span> <span class='op'>=</span> <span class='nam'>FileDownloader</span><span class='op'>.</span><span class='nam'>parse_bytes</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>buffersize</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1152. <p id='t485' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>numeric_buffersize</span> <span class='key'>is</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1153. <p id='t486' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;invalid buffer size specified&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1154. <p id='t487' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>buffersize</span> <span class='op'>=</span> <span class='nam'>numeric_buffersize</span><span class='strut'>&nbsp;</span></p>
  1155. <p id='t488' class='stm mis'>&nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1156. <p id='t489' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playliststart</span> <span class='op'>=</span> <span class='nam'>int</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playliststart</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1157. <p id='t490' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playliststart</span> <span class='op'>&lt;=</span> <span class='num'>0</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1158. <p id='t491' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>ValueError</span><span class='op'>(</span><span class='str'>u&#39;Playlist start must be positive&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1159. <p id='t492' class='stm mis'>&nbsp; &nbsp; <span class='key'>except</span> <span class='op'>(</span><span class='nam'>TypeError</span><span class='op'>,</span> <span class='nam'>ValueError</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1160. <p id='t493' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;invalid playlist start number specified&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1161. <p id='t494' class='stm mis'>&nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1162. <p id='t495' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playlistend</span> <span class='op'>=</span> <span class='nam'>int</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playlistend</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1163. <p id='t496' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playlistend</span> <span class='op'>!=</span> <span class='op'>-</span><span class='num'>1</span> <span class='key'>and</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playlistend</span> <span class='op'>&lt;=</span> <span class='num'>0</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playlistend</span> <span class='op'>&lt;</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playliststart</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1164. <p id='t497' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>raise</span> <span class='nam'>ValueError</span><span class='op'>(</span><span class='str'>u&#39;Playlist end must be greater than playlist start&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1165. <p id='t498' class='stm mis'>&nbsp; &nbsp; <span class='key'>except</span> <span class='op'>(</span><span class='nam'>TypeError</span><span class='op'>,</span> <span class='nam'>ValueError</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1166. <p id='t499' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;invalid playlist end number specified&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1167. <p id='t500' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>extractaudio</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1168. <p id='t501' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>audioformat</span> <span class='key'>not</span> <span class='key'>in</span> <span class='op'>[</span><span class='str'>&#39;best&#39;</span><span class='op'>,</span> <span class='str'>&#39;aac&#39;</span><span class='op'>,</span> <span class='str'>&#39;mp3&#39;</span><span class='op'>,</span> <span class='str'>&#39;vorbis&#39;</span><span class='op'>,</span> <span class='str'>&#39;m4a&#39;</span><span class='op'>,</span> <span class='str'>&#39;wav&#39;</span><span class='op'>]</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1169. <p id='t502' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;invalid audio format specified&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1170. <p id='t503' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>audioquality</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1171. <p id='t504' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>audioquality</span> <span class='op'>=</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>audioquality</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='str'>&#39;k&#39;</span><span class='op'>)</span><span class='op'>.</span><span class='nam'>strip</span><span class='op'>(</span><span class='str'>&#39;K&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1172. <p id='t505' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>audioquality</span><span class='op'>.</span><span class='nam'>isdigit</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1173. <p id='t506' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;invalid audio quality specified&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1174. <p id='t507' class='pln'><span class='strut'>&nbsp;</span></p>
  1175. <p id='t508' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>version_info</span> <span class='op'>&lt;</span> <span class='op'>(</span><span class='num'>3</span><span class='op'>,</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1176. <p id='t509' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='com'># In Python 2, sys.argv is a bytestring (also note http://bugs.python.org/issue2128 for Windows systems)</span><span class='strut'>&nbsp;</span></p>
  1177. <p id='t510' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>outtmpl</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1178. <p id='t511' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>outtmpl</span> <span class='op'>=</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>outtmpl</span><span class='op'>.</span><span class='nam'>decode</span><span class='op'>(</span><span class='nam'>preferredencoding</span><span class='op'>(</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1179. <p id='t512' class='stm mis'>&nbsp; &nbsp; <span class='nam'>outtmpl</span> <span class='op'>=</span><span class='op'>(</span><span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>outtmpl</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span> <span class='key'>and</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>outtmpl</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1180. <p id='t513' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>or</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>format</span> <span class='op'>==</span> <span class='str'>&#39;-1&#39;</span> <span class='key'>and</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>usetitle</span> <span class='key'>and</span> <span class='str'>u&#39;%(title)s-%(id)s-%(format)s.%(ext)s&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1181. <p id='t514' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>or</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>format</span> <span class='op'>==</span> <span class='str'>&#39;-1&#39;</span> <span class='key'>and</span> <span class='str'>u&#39;%(id)s-%(format)s.%(ext)s&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1182. <p id='t515' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>or</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>usetitle</span> <span class='key'>and</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>autonumber</span> <span class='key'>and</span> <span class='str'>u&#39;%(autonumber)s-%(title)s-%(id)s.%(ext)s&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1183. <p id='t516' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>or</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>usetitle</span> <span class='key'>and</span> <span class='str'>u&#39;%(title)s-%(id)s.%(ext)s&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1184. <p id='t517' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>or</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>useid</span> <span class='key'>and</span> <span class='str'>u&#39;%(id)s.%(ext)s&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1185. <p id='t518' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>or</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>autonumber</span> <span class='key'>and</span> <span class='str'>u&#39;%(autonumber)s-%(id)s.%(ext)s&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1186. <p id='t519' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>or</span> <span class='str'>u&#39;%(id)s.%(ext)s&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1187. <p id='t520' class='pln'>&nbsp; &nbsp; <span class='com'># File downloader</span><span class='strut'>&nbsp;</span></p>
  1188. <p id='t521' class='stm mis'>&nbsp; &nbsp; <span class='nam'>fd</span> <span class='op'>=</span> <span class='nam'>FileDownloader</span><span class='op'>(</span><span class='op'>{</span><span class='strut'>&nbsp;</span></p>
  1189. <p id='t522' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;usenetrc&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>usenetrc</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1190. <p id='t523' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;username&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>username</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1191. <p id='t524' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;password&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>password</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1192. <p id='t525' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;quiet&#39;</span><span class='op'>:</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>quiet</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>geturl</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>gettitle</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getthumbnail</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getdescription</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getfilename</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getformat</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1193. <p id='t526' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;forceurl&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>geturl</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1194. <p id='t527' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;forcetitle&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>gettitle</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1195. <p id='t528' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;forcethumbnail&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getthumbnail</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1196. <p id='t529' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;forcedescription&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getdescription</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1197. <p id='t530' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;forcefilename&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getfilename</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1198. <p id='t531' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;forceformat&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getformat</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1199. <p id='t532' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;simulate&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>simulate</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1200. <p id='t533' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;skip_download&#39;</span><span class='op'>:</span> <span class='op'>(</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>skip_download</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>simulate</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>geturl</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>gettitle</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getthumbnail</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getdescription</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getfilename</span> <span class='key'>or</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>getformat</span><span class='op'>)</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1201. <p id='t534' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;format&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>format</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1202. <p id='t535' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;format_limit&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>format_limit</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1203. <p id='t536' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;listformats&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>listformats</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1204. <p id='t537' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;outtmpl&#39;</span><span class='op'>:</span> <span class='nam'>outtmpl</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1205. <p id='t538' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;restrictfilenames&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>restrictfilenames</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1206. <p id='t539' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;ignoreerrors&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>ignoreerrors</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1207. <p id='t540' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;ratelimit&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>ratelimit</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1208. <p id='t541' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;nooverwrites&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>nooverwrites</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1209. <p id='t542' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;retries&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>retries</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1210. <p id='t543' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;buffersize&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>buffersize</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1211. <p id='t544' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;noresizebuffer&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>noresizebuffer</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1212. <p id='t545' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;continuedl&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>continue_dl</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1213. <p id='t546' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;noprogress&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>noprogress</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1214. <p id='t547' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;playliststart&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playliststart</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1215. <p id='t548' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;playlistend&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>playlistend</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1216. <p id='t549' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;logtostderr&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>outtmpl</span> <span class='op'>==</span> <span class='str'>&#39;-&#39;</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1217. <p id='t550' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;consoletitle&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>consoletitle</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1218. <p id='t551' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;nopart&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>nopart</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1219. <p id='t552' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;updatetime&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>updatetime</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1220. <p id='t553' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;writedescription&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>writedescription</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1221. <p id='t554' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;writeinfojson&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>writeinfojson</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1222. <p id='t555' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;writesubtitles&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>writesubtitles</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1223. <p id='t556' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;subtitleslang&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>subtitleslang</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1224. <p id='t557' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;matchtitle&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>matchtitle</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1225. <p id='t558' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;rejecttitle&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>rejecttitle</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1226. <p id='t559' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;max_downloads&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>max_downloads</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1227. <p id='t560' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;prefer_free_formats&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>prefer_free_formats</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1228. <p id='t561' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;verbose&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>verbose</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1229. <p id='t562' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='str'>&#39;test&#39;</span><span class='op'>:</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>test</span><span class='op'>,</span><span class='strut'>&nbsp;</span></p>
  1230. <p id='t563' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='op'>}</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1231. <p id='t564' class='pln'><span class='strut'>&nbsp;</span></p>
  1232. <p id='t565' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>verbose</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1233. <p id='t566' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fd</span><span class='op'>.</span><span class='nam'>to_screen</span><span class='op'>(</span><span class='str'>u&#39;[debug] Proxy map: &#39;</span> <span class='op'>+</span> <span class='nam'>str</span><span class='op'>(</span><span class='nam'>proxy_handler</span><span class='op'>.</span><span class='nam'>proxies</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1234. <p id='t567' class='pln'><span class='strut'>&nbsp;</span></p>
  1235. <p id='t568' class='stm mis'>&nbsp; &nbsp; <span class='key'>for</span> <span class='nam'>extractor</span> <span class='key'>in</span> <span class='nam'>extractors</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1236. <p id='t569' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fd</span><span class='op'>.</span><span class='nam'>add_info_extractor</span><span class='op'>(</span><span class='nam'>extractor</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1237. <p id='t570' class='pln'><span class='strut'>&nbsp;</span></p>
  1238. <p id='t571' class='pln'>&nbsp; &nbsp; <span class='com'># PostProcessors</span><span class='strut'>&nbsp;</span></p>
  1239. <p id='t572' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>extractaudio</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1240. <p id='t573' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fd</span><span class='op'>.</span><span class='nam'>add_post_processor</span><span class='op'>(</span><span class='nam'>FFmpegExtractAudioPP</span><span class='op'>(</span><span class='nam'>preferredcodec</span><span class='op'>=</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>audioformat</span><span class='op'>,</span> <span class='nam'>preferredquality</span><span class='op'>=</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>audioquality</span><span class='op'>,</span> <span class='nam'>keepvideo</span><span class='op'>=</span><span class='nam'>opts</span><span class='op'>.</span><span class='nam'>keepvideo</span><span class='op'>)</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1241. <p id='t574' class='pln'><span class='strut'>&nbsp;</span></p>
  1242. <p id='t575' class='pln'>&nbsp; &nbsp; <span class='com'># Update version</span><span class='strut'>&nbsp;</span></p>
  1243. <p id='t576' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>update_self</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1244. <p id='t577' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>updateSelf</span><span class='op'>(</span><span class='nam'>fd</span><span class='op'>,</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>argv</span><span class='op'>[</span><span class='num'>0</span><span class='op'>]</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1245. <p id='t578' class='pln'><span class='strut'>&nbsp;</span></p>
  1246. <p id='t579' class='pln'>&nbsp; &nbsp; <span class='com'># Maybe do nothing</span><span class='strut'>&nbsp;</span></p>
  1247. <p id='t580' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>all_urls</span><span class='op'>)</span> <span class='op'>&lt;</span> <span class='num'>1</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1248. <p id='t581' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>if</span> <span class='key'>not</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>update_self</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1249. <p id='t582' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>parser</span><span class='op'>.</span><span class='nam'>error</span><span class='op'>(</span><span class='str'>u&#39;you must provide at least one URL&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1250. <p id='t583' class='pln'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>else</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1251. <p id='t584' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1252. <p id='t585' class='pln'><span class='strut'>&nbsp;</span></p>
  1253. <p id='t586' class='stm mis'>&nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1254. <p id='t587' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>retcode</span> <span class='op'>=</span> <span class='nam'>fd</span><span class='op'>.</span><span class='nam'>download</span><span class='op'>(</span><span class='nam'>all_urls</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1255. <p id='t588' class='stm mis'>&nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>MaxDownloadsReached</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1256. <p id='t589' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>fd</span><span class='op'>.</span><span class='nam'>to_screen</span><span class='op'>(</span><span class='str'>u&#39;--max-download limit reached, aborting.&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1257. <p id='t590' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>retcode</span> <span class='op'>=</span> <span class='num'>101</span><span class='strut'>&nbsp;</span></p>
  1258. <p id='t591' class='pln'><span class='strut'>&nbsp;</span></p>
  1259. <p id='t592' class='pln'>&nbsp; &nbsp; <span class='com'># Dump cookie jar if requested</span><span class='strut'>&nbsp;</span></p>
  1260. <p id='t593' class='stm mis'>&nbsp; &nbsp; <span class='key'>if</span> <span class='nam'>opts</span><span class='op'>.</span><span class='nam'>cookiefile</span> <span class='key'>is</span> <span class='key'>not</span> <span class='key'>None</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1261. <p id='t594' class='stm run hide_run'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1262. <p id='t595' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>jar</span><span class='op'>.</span><span class='nam'>save</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1263. <p id='t596' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='key'>except</span> <span class='op'>(</span><span class='nam'>IOError</span><span class='op'>,</span> <span class='nam'>OSError</span><span class='op'>)</span> <span class='key'>as</span> <span class='nam'>err</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1264. <p id='t597' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>u&#39;ERROR: unable to save cookie jar&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1265. <p id='t598' class='pln'><span class='strut'>&nbsp;</span></p>
  1266. <p id='t599' class='stm mis'>&nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='nam'>retcode</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1267. <p id='t600' class='pln'><span class='strut'>&nbsp;</span></p>
  1268. <p id='t601' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>main</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1269. <p id='t602' class='stm run hide_run'>&nbsp; &nbsp; <span class='key'>try</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1270. <p id='t603' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>_real_main</span><span class='op'>(</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1271. <p id='t604' class='stm mis'>&nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>DownloadError</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1272. <p id='t605' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='num'>1</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1273. <p id='t606' class='stm mis'>&nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>SameFileError</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1274. <p id='t607' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>u&#39;ERROR: fixed output name but more than one file to download&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1275. <p id='t608' class='stm mis'>&nbsp; &nbsp; <span class='key'>except</span> <span class='nam'>KeyboardInterrupt</span><span class='op'>:</span><span class='strut'>&nbsp;</span></p>
  1276. <p id='t609' class='stm mis'>&nbsp; &nbsp; &nbsp; &nbsp; <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>exit</span><span class='op'>(</span><span class='str'>u&#39;\nERROR: Interrupted by user&#39;</span><span class='op'>)</span><span class='strut'>&nbsp;</span></p>
  1277. </td>
  1278. </tr>
  1279. </table>
  1280. </div>
  1281. <div id='footer'>
  1282. <div class='content'>
  1283. <p>
  1284. <a class='nav' href='index.html'>&#xab; index</a> &nbsp; &nbsp; <a class='nav' href='http://nedbatchelder.com/code/coverage/3.6b1'>coverage.py v3.6b1</a>
  1285. </p>
  1286. </div>
  1287. </div>
  1288. </body>
  1289. </html>