hylarucoder / silverhand Goto Github PK
View Code? Open in Web Editor NEWMicheal Gardner的数据科学笔记
Micheal Gardner的数据科学笔记
楼主能把 找代理 、验证代理部分代码分享一下吗?这个很关键呀......
as i see ,this has many .py files ,can you tell me how to use you program?
在学Python,想跑下你的程序,不知道改哪些配置,以及运行顺序
2016-04-07 19:11:53 [scrapy] INFO: Scrapy 1.0.5 started (bot: abc)
2016-04-07 19:11:53 [scrapy] INFO: Optional features available: ssl, http11
2016-04-07 19:11:53 [scrapy] INFO: Overridden settings: {'NEWSPIDER_MODULE': 'abc.spiders', 'SPIDER_MODULES': ['abc.spiders'], 'COOKIES_ENABLED': False, 'BOT_NAME': 'abc'}
2016-04-07 19:11:53 [scrapy] INFO: Enabled extensions: CloseSpider, TelnetConsole, LogStats, CoreStats, SpiderState
2016-04-07 19:11:53 [py.warnings] WARNING: /usr/local/lib/python2.7/dist-packages/scrapy/utils/deprecate.py:155: ScrapyDeprecationWarning: scrapy.contrib.downloadermiddleware.useragent.UserAgentMiddleware
class is deprecated, use scrapy.downloadermiddlewares.useragent.UserAgentMiddleware
instead
ScrapyDeprecationWarning)
2016-04-07 19:11:53 [scrapy] INFO: Enabled downloader middlewares: RandomUserAgent, ProxyMiddleware, HttpAuthMiddleware, DownloadTimeoutMiddleware, RetryMiddleware, DefaultHeadersMiddleware, MetaRefreshMiddleware, HttpCompressionMiddleware, RedirectMiddleware, ChunkedTransferMiddleware, DownloaderStats
2016-04-07 19:11:53 [scrapy] INFO: Enabled spider middlewares: HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware, UrlLengthMiddleware, DepthMiddleware
2016-04-07 19:11:53 [scrapy] INFO: Enabled item pipelines: abcPipeline
2016-04-07 19:11:53 [scrapy] INFO: Spider opened
2016-04-07 19:11:53 [scrapy] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2016-04-07 19:11:53 [scrapy] DEBUG: Telnet console listening on 127.0.0.1:6026
***********_ProxyMiddleware no pass_*********http://112.124.4.132:80
2016-04-07 19:11:53 [scrapy] ERROR: Error downloading <GET https://www.abc.com/>: Could not open CONNECT tunnel.
2016-04-07 19:11:53 [scrapy] INFO: Closing spider (finished)
2016-04-07 19:11:53 [scrapy] INFO: Dumping Scrapy stats:
{'downloader/exception_count': 1,
'downloader/exception_type_count/scrapy.core.downloader.handlers.http11.TunnelError': 1,
'downloader/request_bytes': 347,
'downloader/request_count': 1,
'downloader/request_method_count/GET': 1,
'finish_reason': 'finished',
'finish_time': datetime.datetime(2016, 4, 7, 11, 11, 53, 888732),
'log_count/DEBUG': 1,
'log_count/ERROR': 1,
'log_count/INFO': 7,
'log_count/WARNING': 1,
'scheduler/dequeued': 1,
'scheduler/dequeued/memory': 1,
'scheduler/enqueued': 1,
'scheduler/enqueued/memory': 1,
'start_time': datetime.datetime(2016, 4, 7, 11, 11, 53, 578478)}
2016-04-07 19:11:53 [scrapy] INFO: Spider closed (finished)
class ProxyMiddleware(object):
def process_request(self, request, spider):
#request.meta['proxy'] = HTTP_PROXY
proxy = random.choice(PROXIES)
print "****ProxyMiddleware no pass**" + proxy
request.meta['proxy'] = "%s" % proxy
return
DOWNLOADER_MIDDLEWARES = {
'abc.middlewares.RandomUserAgent': 1, #随机user agent
'abc.middlewares.ProxyMiddleware': 100, #代理需要用到
'scrapy.contrib.downloadermiddleware.useragent.UserAgentMiddleware': None
}
PROXIES = [
'http://111.206.37.87:80',
'http://112.124.4.132:80',
'http://61.232.197.13:80',
'http://121.22.253.39:80',
'http://61.135.204.187:80',
]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.