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.

32 lines
698 B

  1. from __future__ import unicode_literals
  2. import io
  3. import os.path
  4. import sys
  5. import re
  6. ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  7. README_FILE = os.path.join(ROOT_DIR, 'README.md')
  8. with io.open(README_FILE, encoding='utf-8') as f:
  9. readme = f.read()
  10. PREFIX = '''%YOUTUBE-DL(1)
  11. # NAME
  12. youtube\-dl \- download videos from youtube.com or other video platforms
  13. # SYNOPSIS
  14. **youtube-dl** \[OPTIONS\] URL [URL...]
  15. '''
  16. readme = re.sub(r'(?s)^.*?(?=# DESCRIPTION)', '', readme)
  17. readme = re.sub(r'\s+youtube-dl \[OPTIONS\] URL \[URL\.\.\.\]', '', readme)
  18. readme = PREFIX + readme
  19. if sys.version_info < (3, 0):
  20. print(readme.encode('utf-8'))
  21. else:
  22. print(readme)