狗儿

热爱的话就坚持吧~

0%

一些开源项目的使用记录(持续更新)

本文记录一些我使用过的开源项目的操作过程,以防因为时间久远而忘记过去的我是如何成功使用的。

you-get:视频下载

github万star的经典项目,可用于下载很多视频网站的视频。

Github链接:https://github.com/soimort/you-get

使用

1
2
3
4
5
6
7
8
9
10
11
12
C:\Users\kljxn>you-get https://www.youtube.com/watch?v=6E-jLv1oHCE
site: YouTube
title:
stream:
- itag: 22
container: mp4
quality: hd720
size: 21.1 MiB (22083826 bytes)
# download-with: you-get --itag=22 [URL]

Downloading 装.mp4 ...
100% ( 21.1/ 21.1MB) ├████████████████████████████████████████┤[1/1] 61 MB/s

1572013450693

下载到cmd当前工作目录。上图中下载到C:\Users\kljxn

踩坑

网上很多教程上使用you-get -i 'https://www.youtube.com/watch?v=6E-jLv1oHCE'

1
2
3
4
5
6
7
8
9
10
C:\Users\kljxn>you-get -i 'https://www.youtube.com/watch?v=6E-jLv1oHCE'
you-get: [error] oops, something went wrong.
you-get: don't panic, c'est la vie. please try the following steps:
you-get: (1) Rule out any network problem.
you-get: (2) Make sure you-get is up-to-date.
you-get: (3) Check if the issue is already known, on
you-get: https://github.com/soimort/you-get/wiki/Known-Bugs
you-get: https://github.com/soimort/you-get/issues
you-get: (4) Run the command with '--debug' option,
you-get: and report this issue with the full output.

1572013708632

后面带上–debug,可以查看报错信息。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
C:\Users\kljxn>you-get -i 'https://www.youtube.com/watch?v=6E-jLv1oHCE' --debug
[DEBUG] get_location: http://'https://www.youtube.com/watch?v=6E-jLv1oHCE'
[DEBUG] HTTP Error with code400
[DEBUG] HTTP Error with code400
[DEBUG] HTTP Error with code400
[DEBUG] get_location: http://'https://www.youtube.com/watch?v=6E-jLv1oHCE'
[DEBUG] HTTP Error with code400
[DEBUG] HTTP Error with code400
[DEBUG] HTTP Error with code400
you-get: version 0.4.1355, a tiny downloader that scrapes the web.
you-get: Namespace(URL=["'https://www.youtube.com/watch?v=6E-jLv1oHCE'"], auto_rename=False, cookies=None, debug=True, extractor_proxy=None, force=False, format=None, help=False, http_proxy=None, info=True, input_file=None, insecure=False, itag=None, json=False, no_caption=False, no_merge=False, no_proxy=False, output_dir='.', output_filename=None, password=None, player=None, playlist=False, skip_existing_file_size_check=False, socks_proxy=None, stream=None, timeout=600, url=False, version=False)
Traceback (most recent call last):
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 1737, in url_to_module
location = get_location(url) # t.co isn't happy with fake_headers
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 388, in get_location
res = urlopen_with_retry(req)
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 412, in urlopen_with_retry
raise http_error
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 403, in urlopen_with_retry
return request.urlopen(*args, **kwargs)
File "c:\cs\python37\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "c:\cs\python37\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "c:\cs\python37\lib\urllib\request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "c:\cs\python37\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "c:\cs\python37\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "c:\cs\python37\lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Invalid header received from client

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\cs\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\cs\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\CS\Python37\Scripts\you-get.exe\__main__.py", line 7, in <module>
File "c:\cs\python37\lib\site-packages\you_get\__main__.py", line 92, in main
main(**kwargs)
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 1758, in main
script_main(any_download, any_download_playlist, **kwargs)
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 1646, in script_main
**extra
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 1302, in download_main
download(url, **kwargs)
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 1748, in any_download
m, url = url_to_module(url)
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 1739, in url_to_module
location = get_location(url, headers=fake_headers)
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 388, in get_location
res = urlopen_with_retry(req)
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 412, in urlopen_with_retry
raise http_error
File "c:\cs\python37\lib\site-packages\you_get\common.py", line 403, in urlopen_with_retry
return request.urlopen(*args, **kwargs)
File "c:\cs\python37\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "c:\cs\python37\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "c:\cs\python37\lib\urllib\request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "c:\cs\python37\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "c:\cs\python37\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "c:\cs\python37\lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Invalid header received from client

400状态码是bad requests的意思。

dhbooker:欢乐书客小说下载

左转我之前写的博文:零基础运行golang项目