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.
get ‘/’ do
mainpage = Nokogiri::HTML(open(‘https://www.transfermarkt.de/’))
@main = mainpage.css(’.mostWanted’).css(’.subline’).text.delete("\n\t\")
This case @main is crawled all the time.
<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
=Nokogiri::HTML(open(‘IT SHOULD BE A VARIABLE’))
@team = player.css('.dataZusatzDaten').css('.hauptpunkt').text @number = player.css('.dataHeader').css('.dataRN').text
It will crawl the team name and the number of the player If the link is changed to an another player i.e. https://www.transfermarkt.de/marc-andre-ter-stegen/profil/spieler/74857 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.