This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2025 Neuroplexus | |
This software is provided "as is", without warranty of any kind, express or | |
implied, including but not limited to the warranties of merchantability, | |
fitness for a particular purpose and noninfringement. In no event shall the | |
authors or copyright holders be liable for any claim, damages or other | |
liability, whether in an action of contract, tort or otherwise, arising from, | |
out of or in connection with the software or the use or other dealings in the | |
software. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import random | |
from scrapy.conf import settings | |
class RandomUserAgentMiddleware(object): | |
def process_request(self, request, spider): | |
ua = random.choice(settings.get('USER_AGENT_LIST')) | |
if ua: | |
request.headers.setdefault('User-Agent', ua) | |
class ProxyMiddleware(object): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Scrapyd local proxy for basic authentication. | |
# Don't forget iptables rule. | |
# iptables -A INPUT -p tcp --destination-port 6800 -s ! 127.0.0.1 -j DROP | |
server { | |
listen 6801; | |
location ~ /\.ht { | |
deny all; | |
} |