archive_methods.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. import os
  2. from functools import wraps
  3. from collections import defaultdict
  4. from datetime import datetime
  5. from index import (
  6. parse_json_link_index,
  7. write_link_index,
  8. patch_index_title_hack,
  9. )
  10. from config import (
  11. CURL_BINARY,
  12. GIT_BINARY,
  13. WGET_BINARY,
  14. YOUTUBEDL_BINARY,
  15. CHROME_BINARY,
  16. FETCH_FAVICON,
  17. FETCH_TITLE,
  18. FETCH_WGET,
  19. FETCH_WGET_REQUISITES,
  20. FETCH_PDF,
  21. FETCH_SCREENSHOT,
  22. FETCH_DOM,
  23. FETCH_WARC,
  24. FETCH_GIT,
  25. FETCH_MEDIA,
  26. RESOLUTION,
  27. CHECK_SSL_VALIDITY,
  28. SUBMIT_ARCHIVE_DOT_ORG,
  29. COOKIES_FILE,
  30. WGET_USER_AGENT,
  31. CHROME_USER_DATA_DIR,
  32. CHROME_SANDBOX,
  33. TIMEOUT,
  34. MEDIA_TIMEOUT,
  35. ANSI,
  36. ARCHIVE_DIR,
  37. GIT_DOMAINS,
  38. GIT_SHA,
  39. )
  40. from util import (
  41. domain,
  42. without_query,
  43. without_fragment,
  44. fetch_page_title,
  45. progress,
  46. chmod_file,
  47. pretty_path,
  48. print_error_hints,
  49. check_link_structure,
  50. wget_output_path,
  51. run, PIPE, DEVNULL,
  52. )
  53. _RESULTS_TOTALS = { # globals are bad, mmkay
  54. 'skipped': 0,
  55. 'succeded': 0,
  56. 'failed': 0,
  57. }
  58. def load_link_index(link_dir, link):
  59. """check for an existing link archive in the given directory,
  60. and load+merge it into the given link dict
  61. """
  62. is_new = not os.path.exists(link_dir)
  63. if is_new:
  64. os.makedirs(link_dir)
  65. else:
  66. link = {
  67. **parse_json_link_index(link_dir),
  68. **link,
  69. }
  70. check_link_structure(link)
  71. print_link_status_line(link_dir, link, is_new)
  72. return link
  73. def archive_link(link_dir, link, overwrite=True):
  74. """download the DOM, PDF, and a screenshot into a folder named after the link's timestamp"""
  75. ARCHIVE_METHODS = (
  76. (FETCH_TITLE, fetch_title),
  77. (FETCH_FAVICON, fetch_favicon),
  78. (FETCH_WGET, fetch_wget),
  79. (FETCH_PDF, fetch_pdf),
  80. (FETCH_SCREENSHOT, fetch_screenshot),
  81. (FETCH_DOM, fetch_dom),
  82. (FETCH_GIT, fetch_git),
  83. (FETCH_MEDIA, fetch_media),
  84. (SUBMIT_ARCHIVE_DOT_ORG, archive_dot_org),
  85. )
  86. active_methods = [method for toggle, method in ARCHIVE_METHODS if toggle]
  87. try:
  88. link = load_link_index(link_dir, link)
  89. for archive_method in active_methods:
  90. archive_method(link_dir, link, overwrite=overwrite)
  91. write_link_index(link_dir, link)
  92. except Exception as err:
  93. print(' ! Failed to archive link: {}: {}'.format(err.__class__.__name__, err))
  94. return link
  95. def print_link_status_line(link_dir, link, is_new):
  96. print('[{symbol_color}{symbol}{reset}] [{now}] "{title}"\n {blue}{url}{reset}'.format(
  97. symbol='+' if is_new else '*',
  98. symbol_color=ANSI['green' if is_new else 'black'],
  99. now=datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
  100. **{**link, 'title': link['title'] or link['url']},
  101. **ANSI,
  102. ))
  103. print(' > {}{}'.format(pretty_path(link_dir), ' (new)' if is_new else ''))
  104. # if link['type']:
  105. # print(' i {}'.format(link['type']))
  106. def attach_result_to_link(method):
  107. """
  108. Instead of returning a result={output:'...', status:'success'} object,
  109. attach that result to the links's history & latest fields, then return
  110. the updated link object.
  111. """
  112. def decorator(fetch_func):
  113. @wraps(fetch_func)
  114. def timed_fetch_func(link_dir, link, overwrite=False, **kwargs):
  115. # initialize methods and history json field on link
  116. link['latest'] = link.get('latest') or {}
  117. link['latest'][method] = link['latest'].get(method) or None
  118. link['history'] = link.get('history') or {}
  119. link['history'][method] = link['history'].get(method) or []
  120. start_ts = datetime.now().timestamp()
  121. # if a valid method output is already present, dont run the fetch function
  122. if link['latest'][method] and not overwrite:
  123. print(' √ {}'.format(method))
  124. result = None
  125. else:
  126. print(' > {}'.format(method))
  127. result = fetch_func(link_dir, link, **kwargs)
  128. end_ts = datetime.now().timestamp()
  129. duration = str(end_ts * 1000 - start_ts * 1000).split('.')[0]
  130. # append a history item recording fail/success
  131. history_entry = {
  132. 'timestamp': str(start_ts).split('.')[0],
  133. }
  134. if result is None:
  135. history_entry['status'] = 'skipped'
  136. elif isinstance(result.get('output'), Exception):
  137. history_entry['status'] = 'failed'
  138. history_entry['duration'] = duration
  139. history_entry.update(result or {})
  140. link['history'][method].append(history_entry)
  141. else:
  142. history_entry['status'] = 'succeded'
  143. history_entry['duration'] = duration
  144. history_entry.update(result or {})
  145. link['history'][method].append(history_entry)
  146. link['latest'][method] = result['output']
  147. _RESULTS_TOTALS[history_entry['status']] += 1
  148. return link
  149. return timed_fetch_func
  150. return decorator
  151. @attach_result_to_link('wget')
  152. def fetch_wget(link_dir, link, requisites=FETCH_WGET_REQUISITES, warc=FETCH_WARC, timeout=TIMEOUT):
  153. """download full site using wget"""
  154. domain_dir = os.path.join(link_dir, domain(link['url']))
  155. existing_file = wget_output_path(link)
  156. if os.path.exists(domain_dir) and existing_file:
  157. return {'output': existing_file, 'status': 'skipped'}
  158. if warc:
  159. warc_dir = os.path.join(link_dir, 'warc')
  160. os.makedirs(warc_dir, exist_ok=True)
  161. warc_path = os.path.join('warc', str(int(datetime.now().timestamp())))
  162. # WGET CLI Docs: https://www.gnu.org/software/wget/manual/wget.html
  163. CMD = [
  164. WGET_BINARY,
  165. # '--server-response', # print headers for better error parsing
  166. '--no-verbose',
  167. '--adjust-extension',
  168. '--convert-links',
  169. '--force-directories',
  170. '--backup-converted',
  171. '--span-hosts',
  172. '--no-parent',
  173. '-e', 'robots=off',
  174. '--restrict-file-names=unix',
  175. '--timeout={}'.format(timeout),
  176. *(() if warc else ('--timestamping',)),
  177. *(('--warc-file={}'.format(warc_path),) if warc else ()),
  178. *(('--page-requisites',) if FETCH_WGET_REQUISITES else ()),
  179. *(('--user-agent={}'.format(WGET_USER_AGENT),) if WGET_USER_AGENT else ()),
  180. *(('--load-cookies', COOKIES_FILE) if COOKIES_FILE else ()),
  181. *((() if CHECK_SSL_VALIDITY else ('--no-check-certificate', '--no-hsts'))),
  182. link['url'],
  183. ]
  184. end = progress(timeout, prefix=' ')
  185. try:
  186. result = run(CMD, stdout=PIPE, stderr=PIPE, cwd=link_dir, timeout=timeout)
  187. end()
  188. output = wget_output_path(link, look_in=domain_dir)
  189. output_tail = [' ' + line for line in (result.stdout + result.stderr).decode().rsplit('\n', 3)[-3:] if line.strip()]
  190. # parse out number of files downloaded from "Downloaded: 76 files, 4.0M in 1.6s (2.52 MB/s)"
  191. files_downloaded = (
  192. int(output_tail[-1].strip().split(' ', 2)[1] or 0)
  193. if 'Downloaded:' in output_tail[-1]
  194. else 0
  195. )
  196. # Check for common failure cases
  197. if result.returncode > 0 and files_downloaded < 1:
  198. print(' Got wget response code {}:'.format(result.returncode))
  199. print('\n'.join(output_tail))
  200. if b'403: Forbidden' in result.stderr:
  201. raise Exception('403 Forbidden (try changing WGET_USER_AGENT)')
  202. if b'404: Not Found' in result.stderr:
  203. raise Exception('404 Not Found')
  204. if b'ERROR 500: Internal Server Error' in result.stderr:
  205. raise Exception('500 Internal Server Error')
  206. raise Exception('Got an error from the server')
  207. except Exception as e:
  208. end()
  209. output = e
  210. print_error_hints(cmd=CMD, pwd=link_dir, err=e)
  211. return {
  212. 'cmd': CMD,
  213. 'output': output,
  214. }
  215. @attach_result_to_link('pdf')
  216. def fetch_pdf(link_dir, link, timeout=TIMEOUT, user_data_dir=CHROME_USER_DATA_DIR):
  217. """print PDF of site to file using chrome --headless"""
  218. if link['type'] in ('PDF', 'image'):
  219. return {'output': wget_output_path(link)}
  220. if os.path.exists(os.path.join(link_dir, 'output.pdf')):
  221. return {'output': 'output.pdf', 'status': 'skipped'}
  222. CMD = [
  223. *chrome_headless(user_data_dir=user_data_dir),
  224. '--print-to-pdf',
  225. '--hide-scrollbars',
  226. '--timeout={}'.format((timeout) * 1000),
  227. *(() if CHECK_SSL_VALIDITY else ('--disable-web-security', '--ignore-certificate-errors')),
  228. link['url']
  229. ]
  230. end = progress(timeout, prefix=' ')
  231. try:
  232. result = run(CMD, stdout=PIPE, stderr=PIPE, cwd=link_dir, timeout=timeout)
  233. end()
  234. if result.returncode:
  235. print(' ', (result.stderr or result.stdout).decode())
  236. raise Exception('Failed to print PDF')
  237. chmod_file('output.pdf', cwd=link_dir)
  238. output = 'output.pdf'
  239. except Exception as e:
  240. end()
  241. output = e
  242. print_error_hints(cmd=CMD, pwd=link_dir, err=e)
  243. return {
  244. 'cmd': CMD,
  245. 'output': output,
  246. }
  247. @attach_result_to_link('screenshot')
  248. def fetch_screenshot(link_dir, link, timeout=TIMEOUT, user_data_dir=CHROME_USER_DATA_DIR, resolution=RESOLUTION):
  249. """take screenshot of site using chrome --headless"""
  250. if link['type'] in ('PDF', 'image'):
  251. return {'output': wget_output_path(link)}
  252. if os.path.exists(os.path.join(link_dir, 'screenshot.png')):
  253. return {'output': 'screenshot.png', 'status': 'skipped'}
  254. CMD = [
  255. *chrome_headless(user_data_dir=user_data_dir),
  256. '--screenshot',
  257. '--window-size={}'.format(resolution),
  258. '--hide-scrollbars',
  259. '--timeout={}'.format((timeout) * 1000),
  260. *(() if CHECK_SSL_VALIDITY else ('--disable-web-security', '--ignore-certificate-errors')),
  261. # '--full-page', # TODO: make this actually work using ./bin/screenshot fullPage: true
  262. link['url'],
  263. ]
  264. end = progress(timeout, prefix=' ')
  265. try:
  266. result = run(CMD, stdout=PIPE, stderr=PIPE, cwd=link_dir, timeout=timeout)
  267. end()
  268. if result.returncode:
  269. print(' ', (result.stderr or result.stdout).decode())
  270. raise Exception('Failed to take screenshot')
  271. chmod_file('screenshot.png', cwd=link_dir)
  272. output = 'screenshot.png'
  273. except Exception as e:
  274. end()
  275. output = e
  276. print_error_hints(cmd=CMD, pwd=link_dir, err=e)
  277. return {
  278. 'cmd': CMD,
  279. 'output': output,
  280. }
  281. @attach_result_to_link('dom')
  282. def fetch_dom(link_dir, link, timeout=TIMEOUT, user_data_dir=CHROME_USER_DATA_DIR):
  283. """print HTML of site to file using chrome --dump-html"""
  284. if link['type'] in ('PDF', 'image'):
  285. return {'output': wget_output_path(link)}
  286. output_path = os.path.join(link_dir, 'output.html')
  287. if os.path.exists(output_path):
  288. return {'output': 'output.html', 'status': 'skipped'}
  289. CMD = [
  290. *chrome_headless(user_data_dir=user_data_dir),
  291. '--dump-dom',
  292. '--timeout={}'.format((timeout) * 1000),
  293. link['url']
  294. ]
  295. end = progress(timeout, prefix=' ')
  296. try:
  297. with open(output_path, 'w+') as f:
  298. result = run(CMD, stdout=f, stderr=PIPE, cwd=link_dir, timeout=timeout)
  299. end()
  300. if result.returncode:
  301. print(' ', (result.stderr).decode())
  302. raise Exception('Failed to fetch DOM')
  303. chmod_file('output.html', cwd=link_dir)
  304. output = 'output.html'
  305. except Exception as e:
  306. end()
  307. output = e
  308. print_error_hints(cmd=CMD, pwd=link_dir, err=e)
  309. return {
  310. 'cmd': CMD,
  311. 'output': output,
  312. }
  313. def parse_archive_dot_org_response(response):
  314. # Parse archive.org response headers
  315. headers = defaultdict(list)
  316. # lowercase all the header names and store in dict
  317. for header in response.splitlines():
  318. if b':' not in header or not header.strip():
  319. continue
  320. name, val = header.decode().split(':', 1)
  321. headers[name.lower().strip()].append(val.strip())
  322. # Get successful archive url in "content-location" header or any errors
  323. content_location = headers['content-location']
  324. errors = headers['x-archive-wayback-runtime-error']
  325. return content_location, errors
  326. @attach_result_to_link('archive_org')
  327. def archive_dot_org(link_dir, link, timeout=TIMEOUT):
  328. """submit site to archive.org for archiving via their service, save returned archive url"""
  329. output = 'archive.org.txt'
  330. archive_org_url = None
  331. path = os.path.join(link_dir, output)
  332. if os.path.exists(path):
  333. archive_org_url = open(path, 'r').read().strip()
  334. return {'output': archive_org_url, 'status': 'skipped'}
  335. submit_url = 'https://web.archive.org/save/{}'.format(link['url'])
  336. CMD = [
  337. CURL_BINARY,
  338. '--location',
  339. '--head',
  340. '--user-agent', 'ArchiveBox/{} (+https://github.com/pirate/ArchiveBox/)'.format(GIT_SHA), # be nice to the Archive.org people and show them where all this ArchiveBox traffic is coming from
  341. '--max-time', str(timeout),
  342. *(() if CHECK_SSL_VALIDITY else ('--insecure',)),
  343. submit_url,
  344. ]
  345. end = progress(timeout, prefix=' ')
  346. try:
  347. result = run(CMD, stdout=PIPE, stderr=DEVNULL, cwd=link_dir, timeout=timeout)
  348. end()
  349. content_location, errors = parse_archive_dot_org_response(result.stdout)
  350. if content_location:
  351. archive_org_url = 'https://web.archive.org{}'.format(content_location[0])
  352. elif len(errors) == 1 and 'RobotAccessControlException' in errors[0]:
  353. archive_org_url = None
  354. # raise Exception('Archive.org denied by {}/robots.txt'.format(domain(link['url'])))
  355. elif errors:
  356. raise Exception(', '.join(errors))
  357. else:
  358. raise Exception('Failed to find "content-location" URL header in Archive.org response.')
  359. except Exception as e:
  360. end()
  361. output = e
  362. print_error_hints(cmd=CMD, pwd=link_dir, err=e)
  363. if not isinstance(output, Exception):
  364. # instead of writing None when archive.org rejects the url write the
  365. # url to resubmit it to archive.org. This is so when the user visits
  366. # the URL in person, it will attempt to re-archive it, and it'll show the
  367. # nicer error message explaining why the url was rejected if it fails.
  368. archive_org_url = archive_org_url or submit_url
  369. with open(os.path.join(link_dir, output), 'w', encoding='utf-8') as f:
  370. f.write(archive_org_url)
  371. chmod_file('archive.org.txt', cwd=link_dir)
  372. output = archive_org_url
  373. return {
  374. 'cmd': CMD,
  375. 'output': output,
  376. }
  377. @attach_result_to_link('favicon')
  378. def fetch_favicon(link_dir, link, timeout=TIMEOUT):
  379. """download site favicon from google's favicon api"""
  380. output = 'favicon.ico'
  381. if os.path.exists(os.path.join(link_dir, output)):
  382. return {'output': output, 'status': 'skipped'}
  383. CMD = [
  384. CURL_BINARY,
  385. '--max-time', str(timeout),
  386. '--location',
  387. '--output', output,
  388. *(() if CHECK_SSL_VALIDITY else ('--insecure',)),
  389. 'https://www.google.com/s2/favicons?domain={}'.format(domain(link['url'])),
  390. ]
  391. end = progress(timeout, prefix=' ')
  392. try:
  393. run(CMD, stdout=PIPE, stderr=PIPE, cwd=link_dir, timeout=timeout)
  394. end()
  395. chmod_file('favicon.ico', cwd=link_dir)
  396. output = 'favicon.ico'
  397. except Exception as e:
  398. end()
  399. output = e
  400. print_error_hints(cmd=CMD, pwd=link_dir, err=e)
  401. return {
  402. 'cmd': CMD,
  403. 'output': output,
  404. }
  405. @attach_result_to_link('title')
  406. def fetch_title(link_dir, link, timeout=TIMEOUT):
  407. """try to guess the page's title from its content"""
  408. # if link already has valid title, skip it
  409. if link['title'] and not link['title'].lower().startswith('http'):
  410. return {'output': link['title'], 'status': 'skipped'}
  411. end = progress(timeout, prefix=' ')
  412. try:
  413. title = fetch_page_title(link['url'], timeout=timeout, progress=False)
  414. end()
  415. output = title
  416. except Exception as e:
  417. end()
  418. print(' {}Failed: {} {}{}'.format(ANSI['red'], e.__class__.__name__, e, ANSI['reset']))
  419. output = e
  420. # titles should show up in the global index immediatley for better UX,
  421. # do a hacky immediate replacement to add them in as we're archiving
  422. # TODO: figure out how to do this without gnarly string replacement
  423. if title:
  424. link['title'] = title
  425. patch_index_title_hack(link['url'], title)
  426. return {
  427. 'cmd': 'fetch_page_title("{}")'.format(link['url']),
  428. 'output': output,
  429. }
  430. @attach_result_to_link('media')
  431. def fetch_media(link_dir, link, timeout=MEDIA_TIMEOUT, overwrite=False):
  432. """Download playlists or individual video, audio, and subtitles using youtube-dl"""
  433. # import ipdb; ipdb.set_trace()
  434. output = os.path.join(link_dir, 'media')
  435. already_done = os.path.exists(output) # and os.listdir(output)
  436. if already_done and not overwrite:
  437. return {'output': 'media', 'status': 'skipped'}
  438. os.makedirs(output, exist_ok=True)
  439. CMD = [
  440. YOUTUBEDL_BINARY,
  441. '--write-description',
  442. '--write-info-json',
  443. '--write-annotations',
  444. '--yes-playlist',
  445. '--write-thumbnail',
  446. '--no-call-home',
  447. '--no-check-certificate',
  448. '--user-agent',
  449. '--all-subs',
  450. '--extract-audio',
  451. '--keep-video',
  452. '--ignore-errors',
  453. '--geo-bypass',
  454. '--audio-format', 'mp3',
  455. '--audio-quality', '320K',
  456. '--embed-thumbnail',
  457. '--add-metadata',
  458. *(() if CHECK_SSL_VALIDITY else ('--no-check-certificate',)),
  459. link['url'],
  460. ]
  461. end = progress(timeout, prefix=' ')
  462. try:
  463. result = run(CMD, stdout=PIPE, stderr=PIPE, cwd=output, timeout=timeout + 1)
  464. chmod_file('media', cwd=link_dir)
  465. output = 'media'
  466. end()
  467. if result.returncode:
  468. if (b'ERROR: Unsupported URL' in result.stderr
  469. or b'HTTP Error 404' in result.stderr
  470. or b'HTTP Error 403' in result.stderr
  471. or b'URL could be a direct video link' in result.stderr
  472. or b'Unable to extract container ID' in result.stderr):
  473. # These happen too frequently on non-media pages to warrant printing to console
  474. pass
  475. else:
  476. print(' got youtubedl response code {}:'.format(result.returncode))
  477. print(result.stderr)
  478. raise Exception('Failed to download media')
  479. except Exception as e:
  480. end()
  481. output = e
  482. print_error_hints(cmd=CMD, pwd=link_dir, err=e)
  483. return {
  484. 'cmd': CMD,
  485. 'output': output,
  486. }
  487. @attach_result_to_link('git')
  488. def fetch_git(link_dir, link, timeout=TIMEOUT):
  489. """download full site using git"""
  490. url_is_clonable = (
  491. domain(link['url']) in GIT_DOMAINS
  492. or link['url'].endswith('.git')
  493. or link['type'] == 'git'
  494. )
  495. if not url_is_clonable:
  496. return {'output': None, 'status': 'skipped'}
  497. git_dir = os.path.join(link_dir, 'git')
  498. if os.path.exists(git_dir):
  499. return {'output': 'git', 'status': 'skipped'}
  500. os.makedirs(git_dir, exist_ok=True)
  501. output = 'git'
  502. CMD = [
  503. GIT_BINARY,
  504. 'clone',
  505. '--mirror',
  506. '--recursive',
  507. *(() if CHECK_SSL_VALIDITY else ('-c', 'http.sslVerify=false')),
  508. without_query(without_fragment(link['url'])),
  509. ]
  510. end = progress(timeout, prefix=' ')
  511. try:
  512. result = run(CMD, stdout=PIPE, stderr=PIPE, cwd=git_dir, timeout=timeout + 1)
  513. end()
  514. if result.returncode == 128:
  515. # ignore failed re-download when the folder already exists
  516. pass
  517. elif result.returncode > 0:
  518. print(' got git response code {}:'.format(result.returncode))
  519. raise Exception('Failed git download')
  520. except Exception as e:
  521. end()
  522. output = e
  523. print_error_hints(cmd=CMD, pwd=link_dir, err=e)
  524. return {
  525. 'cmd': CMD,
  526. 'output': output,
  527. }
  528. def chrome_headless(binary=CHROME_BINARY, user_data_dir=CHROME_USER_DATA_DIR):
  529. args = [binary, '--headless']
  530. if not CHROME_SANDBOX:
  531. # dont use GPU or sandbox when running inside docker container
  532. args += ['--no-sandbox', '--disable-gpu']
  533. default_profile = os.path.expanduser('~/Library/Application Support/Google/Chrome')
  534. if user_data_dir:
  535. args.append('--user-data-dir={}'.format(user_data_dir))
  536. elif os.path.exists(default_profile):
  537. args.append('--user-data-dir={}'.format(default_profile))
  538. return args