Browse Source

Update 'README.md'

天问 1 year ago
parent
commit
3dcab616e3
1 changed files with 67 additions and 0 deletions
  1. 67 0
      README.md

+ 67 - 0
README.md

@@ -1,2 +1,69 @@
 # youtube-dl
 # youtube-dl
 
 
+## Usage
+
+方式一:windows下载exe,配合listary即可高速下载视频
+
+方式二:windows下载exe,配合GUI,打开GUI工具下载视频
+
+方式三:pip安装使用
+
+```
+pip install --upgrade youtube-dl
+```
+之后命令行就有youtube-dl
+
+```
+youtube-dl [OPTIONS] URL [URL...]
+
+# 配置代理,配置aria2,配置视频高清,配置字幕,配置ffmpeg等
+cmd /k set PATH=%PATH%;D:\Program-Files\gif\; set http_proxy="socks5://127.0.0.1:2180"; && "D:\Program-Files\VDM-0.4.0\package\windows\engines\youtube-dl.exe" --get-url --no-check-certificate --proxy socks5://127.0.0.1:2180 {query}
+
+```
+
+## Develop
+
+```
+python -m youtube_dl
+
+```
+
+新增抽取器:
+
+```
+from __future__ import unicode_literals
+
+from .common import InfoExtractor
+class YourExtractorIE(InfoExtractor):
+    _VALID_URL = r'https?://(?:www\.)?yourextractor\.com/watch/(?P<id>[0-9]+)'
+    _TEST = {
+        'url': 'https://yourextractor.com/watch/42',
+        'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
+        'info_dict': {
+            'id': '42',
+            'ext': 'mp4',
+            'title': 'Video title goes here',
+            'thumbnail': r're:^https?://.*\.jpg$',
+            # TODO more properties, either as:
+            # * A value
+            # * MD5 checksum; start the string with md5:
+            # * A regular expression; start the string with re:
+            # * Any Python type (for example int or float)
+        }
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        webpage = self._download_webpage(url, video_id)
+
+        # TODO more code goes here, for example ...
+        title = self._html_search_regex(r'<h1>(.+?)</h1>', webpage, 'title')
+
+        return {
+            'id': video_id,
+            'title': title,
+            'description': self._og_search_description(webpage),
+            'uploader': self._search_regex(r'<div[^>]+id="uploader"[^>]*>([^<]+)<', webpage, 'uploader', fatal=False),
+            # TODO more properties (see youtube_dl/extractor/common.py)
+        }
+```