Ruby/Sinatra/Nokogiri - How to create a crawler which crawls the site when the submit button is hit

Hi ,
I am aware of some part of nokogiri and I have already written an app which is crawl what i want however i want it in a different way. Here is a very simple example.

rb. file:
require ‘open-uri’
require ‘nokogiri’
require ‘curb’
require ‘json’
require ‘pp’
require ‘sinatra’
require ‘sinatra/reloader’
require ‘openssl’

get ‘/’ do

mainpage = Nokogiri::HTML(open(‘https://www.transfermarkt.de/’))

@main = mainpage.css(‘.mostWanted’).css(‘.subline’).text.delete(“\n\t\”)

erb :players
This case @main is crawled all the time.

players.erb file:

<p><%=@main%></p>

<div>
  <form action="/result" method="post">
  Add the link:<br>
  <input type="text" name="link" placeholder="transfermarkt.de">
  <br>
  <pre></pre>
  <input type="submit" value="Submit">

</form>

</div>

As you can see I added a form where the link will be added.
here is the ruby part:

post ‘/result’ do
player
=Nokogiri::HTML(open(‘IT SHOULD BE A VARIABLE’))

@team = player.css('.dataZusatzDaten').css('.hauptpunkt').text
@number = player.css('.dataHeader').css('.dataRN').text

erb :playersresult
end
It will crawl the team name and the number of the player If the link is changed to an another player i.e. Marc-André ter Stegen - Spielerprofil 22/23 | Transfermarkt i will get the same info (team name and number).

How can i proceed that the link will be a variable?

Hope you see what I mean.

Thank you for your help in advance.