V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
V2EX  ›  NLL  ›  全部回复第 16 页 / 共 23 页
回复总数  452
1 ... 8  9  10  11  12  13  14  15  16  17 ... 23  
geek510253
2018 年 12 月 21 日
回复了 qian88199496 创建的主题 生活 刚工作两年,老婆刚怀孕,老妈癌症复发
祝好!
求票
很久以前用过,可以的,支持下
2018 年 12 月 3 日
回复了 yuanrenxue 创建的主题 Python 聊点俗的, Python 爬虫挣钱的道道
@Keyes 是什么赚钱的门道?
2018 年 11 月 11 日
回复了 moxiaowei 创建的主题 Python scrapy 的请求问题
写个中间件
ig 牛批
2018 年 10 月 29 日
回复了 NLL 创建的主题 Python 尝试用 aiohttp 写爬虫,但这么写不知道该怎么停止循环?
@binux 嗯嗯,删除操作是在 fetch 方法里面执行的
2018 年 10 月 29 日
回复了 NLL 创建的主题 Python 尝试用 aiohttp 写爬虫,但这么写不知道该怎么停止循环?
```
async def worker(self):
"""
任务调度
:return:
"""
while True:
if not self.queue.empty():
next_data = await self.queue.get()
task_id = uuid.uuid1()
self.task_running_list.append(task_id)
if isinstance(next_data, Item):
asyncio.create_task(self.set_item(task_id, next_data.info))
else:
asyncio.create_task(self.fetch(task_id, next_data.info))
self.queue.task_done()
else:
await asyncio.sleep(0)
if self.queue.empty() and not self.task_running_list:
break
```
根据 @binux 的提示,这么处理可解决该问题。
一样可以 xpath 取到的
1 ... 8  9  10  11  12  13  14  15  16  17 ... 23  
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1492 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 30ms · UTC 16:37 · PVG 00:37 · LAX 09:37 · JFK 12:37
♥ Do have faith in what you're doing.