parse_price.py 431 B

12345678910111213
  1. import requests
  2. from bs4 import BeautifulSoup
  3. req = requests.get('https://www.coingecko.com/zh/%E6%95%B0%E5%AD%97%E8%B4%A7%E5%B8%81/bikerush')
  4. soup = BeautifulSoup(req.content, 'html.parser')
  5. soup.prettify()
  6. anchors = soup.findAll('div', class_='tw-text-gray-500 text-normal dark:tw-text-white dark:tw-text-opacity-60 tw-mb-3')
  7. print(len(anchors))
  8. res = anchors[0]
  9. res = res.children
  10. for r in res:
  11. print(type(r))
  12. print(r)