mirror of
https://github.com/soimort/you-get.git
synced 2025-02-11 04:32:27 +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,
|
'-k', '--insecure', action='store_true', default=False,
|
||||||
help='ignore ssl errors'
|
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 = parser.add_argument_group('Proxy options')
|
||||||
proxy_grp = proxy_grp.add_mutually_exclusive_group()
|
proxy_grp = proxy_grp.add_mutually_exclusive_group()
|
||||||
@ -1640,6 +1644,15 @@ def script_main(download, download_playlist, **kwargs):
|
|||||||
|
|
||||||
socket.setdefaulttimeout(args.timeout)
|
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:
|
try:
|
||||||
extra = {}
|
extra = {}
|
||||||
if extractor_proxy:
|
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