首页 > 解决方案 > 如何从该 URL 获取氨基酸序列?

问题描述

我想通过使用 python 和 Selenium 从下面的 url 获取氨基酸序列,但无法成功。http://flybase.org/download/sequence/FBgn0003719/FBpp

我试过你美丽的汤和硒。

from selenium import webdriver

driver = webdriver.Chrome()

driver.get('http://flybase.org/download/sequence/FBgn0003719/FBpp')

iframe = driver.find_element_by_class_name('scroller')

notification_element = driver.find_element_by_class_name('fastaSeq')

print(notification_element)

消息:没有这样的元素:无法找到元素

标签: pythonweb-scraping

解决方案


只需要使用网络选项卡中的专用 API requests

import requests

r = requests.get('http://flybase.org/api/sequence/id/FBgn0003719/FBpp').json()
print(r['resultset']['result'][0]['sequence'])

推荐阅读