码迷,mamicode.com
首页 > 系统相关 > 详细

asyncio多进程+pyppeteer浏览器控制+pyquery解析实现爬虫demo

时间:2020-07-11 11:14:06      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:demo   got   close   sync   select   style   code   tee   goto   

import asyncio
from pyppeteer import launch
from pyquery import PyQuery as pq
 
async def main():
   browser = await launch()
   page = await browser.newPage()
   await page.goto(https://dynamic2.scrape.cuiqingcai.com/)
   await page.waitForSelector(.item .name)
   j_result1 = await page.J(.item .name)
   j_result2 = await page.querySelector(.item .name)
   jj_result1 = await page.JJ(.item .name)
   jj_result2 = await page.querySelectorAll(.item .name)
   print(J Result1:, j_result1)
   print(J Result2:, j_result2)
   print(JJ Result1:, jj_result1)
   print(JJ Result2:, jj_result2)
   await browser.close()
 
asyncio.get_event_loop().run_until_complete(main())

 

asyncio多进程+pyppeteer浏览器控制+pyquery解析实现爬虫demo

标签:demo   got   close   sync   select   style   code   tee   goto   

原文地址:https://www.cnblogs.com/hellangels333/p/13282822.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!