Python 如何在网页上搜索搜索字段?

Python 如何在网页上搜索搜索字段?,python,web-scraping,Python,Web Scraping,如何打开网页,例如: 。。。并使用页面上的搜索字段搜索项目 i、 e.“搜索玩家…”您不需要刮取网页,它有一个直接的搜索API import requests s = "Ronaldo" r = requests.get("http://www.futbin.com/api?term={}".format(s)) r.json() 输出 [{u'club_image': u'/content/fifa16/img/clubs/243.png', u'full_name': u'Cristi

如何打开网页,例如:

。。。并使用页面上的搜索字段搜索项目


i、 e.“搜索玩家…”

您不需要刮取网页,它有一个直接的搜索API

import requests
s = "Ronaldo"
r = requests.get("http://www.futbin.com/api?term={}".format(s))
r.json()
输出

[{u'club_image': u'/content/fifa16/img/clubs/243.png',
  u'full_name': u'Cristiano Ronaldo',
  u'id': u'38387',
  u'image': u'/content/fifa16/img/players/20801.png',
  u'nation_image': u'/content/fifa16/img/nation/38.png',
  u'position': u'LW',
  u'rare': u'1',
  u'rare_type': u'11',
  u'rating': u'99'},
...
编辑

from bs4 import BeautifulSoup
import requests

r = requests.get("http://www.futbin.com/16/player/38387/cristiano-ronaldo")
soup = BeautifulSoup(r.text, "html.parser")
pslbin = soup.findAll("span", {'id': "pslbin"})[0].text.strip()
print(plsbin)

谢谢板球!看起来很棒。然而,它似乎对我不起作用,似乎没有打印任何内容。
r.json()
返回一个json字符串。如果需要,您可以在它周围放置
print()
。谢谢!我更具体地说是试图检索网站上出现的“PS4最低垃圾箱”,例如(罗纳尔多:),然而,当打印时,我似乎找不到任何价格的证据。有什么想法吗?再次感谢!你可能需要把这一页刮下来。请参阅更新不可复制!谢谢:)从来没有考虑过这个选项。你有自己的代码吗?