Mejoras internas
This commit is contained in:
@@ -309,16 +309,12 @@ def random_useragent():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import csv
|
|
||||||
|
|
||||||
UserAgentPath = os.path.join(config.get_runtime_path(), 'tools', 'UserAgent.csv')
|
UserAgentPath = os.path.join(config.get_runtime_path(), 'tools', 'UserAgent.csv')
|
||||||
if os.path.exists(UserAgentPath):
|
if os.path.exists(UserAgentPath):
|
||||||
UserAgentCSV = open(UserAgentPath, 'r')
|
UserAgentIem = random.choice(list(open(UserAgentPath))).strip()
|
||||||
UserAgentList = csv.reader(UserAgentCSV)
|
if UserAgentIem:
|
||||||
UserAgentList = [row for row in UserAgentList]
|
return UserAgentIem
|
||||||
UserAgentList = [l[0] for l in UserAgentList]
|
|
||||||
random.shuffle(UserAgentList)
|
|
||||||
return random.choice(UserAgentList).strip()
|
|
||||||
|
|
||||||
return default_headers["User-Agent"]
|
return default_headers["User-Agent"]
|
||||||
|
|
||||||
|
|||||||
+1815
-1817
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user