import asyncio

from requests_html import HTMLSession

url  = 'http://www.xiaohuar.com/hua/'

session = HTMLSession( browser_args=[
'--no-sand',
'--disable-infobars'
'--user-agent=Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36'
],headless=False)
res = session.request(url=url,method='GET')
script = """
() => {
return {
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight,
deviceScaleFactor: window.devicePixelRatio,
}
}
"""
try:
res.html.render(keep_page = True)
async def main(): await res.html.page.waitFor(1000)
await res.html.page.setViewport({'width': 1366, 'height': 768})
url_list = await res.html.page.xpath('//div[@class="img"]/a')
for url in url_list:
url_link = await (await url.getProperty('href')).jsonValue()
print(url_link)
asyncio.get_event_loop().run_until_complete(main())
except Exception as e:
print(e)
finally:
session.close()

最新文章

  1. 史上最详细git教程
  2. Android之数据存储的五种方法
  3. C# 3.0新语言特性和改进(一)
  4. 【leetcode】Longest Common Prefix
  5. Linux实现https方式访问站点
  6. JavaScript、Jquery选择题
  7. Codeforces Round #104 (Div. 1)
  8. Connectify是一款很实用的免费软件。能把计算机变成一个无线路由器
  9. ACM学习
  10. HDU-1390 Binary Numbers
  11. CentOS搭建GIT服务器【二】-HTTP源码访问及smart http协议
  12. My SQL 常用函数
  13. Windows系统基本概念
  14. Ubuntu 12.04 中文输入法
  15. python小工具:用python操作HP的Quality Center
  16. PHP中的封装和继承
  17. python sort和sorted区别。
  18. linux affinity
  19. dict使用
  20. Jmeter(十六)Logic Controllers 之 Runtime Controller

热门文章

  1. flink入门(一)——基本原理与应用场景
  2. Linux故障排查之CPU占用率过高
  3. vue强制刷新组件 ----组件重置到初始状态
  4. 【SSH进阶之路】Spring的IOC逐层深入——源码解析之IoC的根本BeanFactory(五)
  5. npm包的语义版本控制(Semantic Versioning of Packages)
  6. IDEA 获取类的相对路径和绝对路径
  7. elementui禁用全选按钮
  8. son-server模拟http mock数据
  9. [转帖]Latch
  10. WITH AS学习