Web删除多个页面的WHIT计数和URL中的偏移功能
我正在尝试从Yahoo未婚夫网站上进行网络刮擦股票,以获取加密货币。 但是我无法解决分页问题。 我试图以这种方式在URL中循环循环,并抵消参数:
import requests
from bs4 import BeautifulSoup as bs
import pandas as pd
list_ticker=[]
for i in range(8):
url=f'https://finance.yahoo.com/cryptocurrencies?count=25&offset={i*25}'
r= requests.get(url)
soup=bs(r.text,"html.parser")
for i in range(25):
list_ticker.append(soup.find_all('a', {'class': 'Fw(600) C($linkColor)'})[i].text)
它不起作用。 我可以使用此库解决这个问题吗?
提前致谢!
I am trying to web scrape tickers from the Yahoo Fiance website for crypto-currencies.
However I can't tackle the pagination problem.
I have tried to loop on the count and offset parameters in the url this way:
import requests
from bs4 import BeautifulSoup as bs
import pandas as pd
list_ticker=[]
for i in range(8):
url=f'https://finance.yahoo.com/cryptocurrencies?count=25&offset={i*25}'
r= requests.get(url)
soup=bs(r.text,"html.parser")
for i in range(25):
list_ticker.append(soup.find_all('a', {'class': 'Fw(600) C($linkColor)'})[i].text)
It does not work.
Can I solve this problem using this library?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论