mirror of
https://github.com/soimort/you-get.git
synced 2025-02-10 12:12:26 +03:00
allow change ua by parameter -U or --ua
This commit is contained in:
parent
9c5dd80b96
commit
74dcd2bfe4
@ -1533,6 +1533,10 @@ def script_main(download, download_playlist, **kwargs):
|
||||
'-k', '--insecure', action='store_true', default=False,
|
||||
help='ignore ssl errors'
|
||||
)
|
||||
download_grp.add_argument(
|
||||
'-U', '--ua', metavar='USERAGENT', default="default",
|
||||
help='Select user agent'
|
||||
)
|
||||
|
||||
proxy_grp = parser.add_argument_group('Proxy options')
|
||||
proxy_grp = proxy_grp.add_mutually_exclusive_group()
|
||||
@ -1640,6 +1644,15 @@ def script_main(download, download_playlist, **kwargs):
|
||||
|
||||
socket.setdefaulttimeout(args.timeout)
|
||||
|
||||
if args.ua != "default":
|
||||
if args.ua == "random":
|
||||
from .ua_list import ua_list
|
||||
import random
|
||||
fake_headers["User-Agent"] = random.choice(ua_list)
|
||||
else:
|
||||
fake_headers["User-Agent"] = args.ua
|
||||
print("using UA: " + fake_headers["User-Agent"])
|
||||
|
||||
try:
|
||||
extra = {}
|
||||
if extractor_proxy:
|
||||
|
4950
src/you_get/ua_list.py
Normal file
4950
src/you_get/ua_list.py
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user