aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2019-04-17 00:08:50 +0700
committerSergey M․ <dstftw@gmail.com>2019-04-17 00:08:50 +0700
commit7fc3b68ad32e4ab436cdcc99ed1a410e361e7b12 (patch)
treeea2d08445d2c596af1b23e1953affad2df776c8d
parentc4341ea47ecb6ac9ea3dea89546339aa2e1d7981 (diff)
[openload] Randomize User-Agent (closes #20688)
-rw-r--r--youtube_dl/extractor/openload.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/youtube_dl/extractor/openload.py b/youtube_dl/extractor/openload.py
index da9c721d2..5f5425fbc 100644
--- a/youtube_dl/extractor/openload.py
+++ b/youtube_dl/extractor/openload.py
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
import json
import os
+import random
import re
import subprocess
import tempfile
@@ -361,7 +362,7 @@ class OpenloadIE(InfoExtractor):
'only_matching': True,
}]
- _USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
+ _USER_AGENT_TPL = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{major}.0.{build}.{patch} Safari/537.36'
@staticmethod
def _extract_urls(webpage):
@@ -376,7 +377,11 @@ class OpenloadIE(InfoExtractor):
url_pattern = 'https://%s/%%s/%s/' % (host, video_id)
headers = {
- 'User-Agent': self._USER_AGENT,
+ 'User-Agent': self._USER_AGENT_TPL % {
+ 'major': random.randint(63, 73),
+ 'build': random.randint(3239, 3683),
+ 'patch': random.randint(0, 100),
+ },
}
for path in ('embed', 'f'):