mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2015
Posts: 19
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Mar 2015
Posts: 19
How can I get data from a class on a page. For example..


Html:
<span class="servername">
 



<span class="common-playing-link" data-track="friend.playing.server.link">



 <a title="-|TBG|- INFANTRY ONLY + LIGHT VEHICLES | NO LAG | TBGCLAN.COM"
 class="common-playing-link "
 href="/bf4/servers/show/PC/29443877-42b9-47ea-a5f3-7f91c7bff615/TBG-INFANTRY-ONLY-LIGHT-VEHICLES-NO-LAG-TBGCLAN-COM/">
 


-|TBG|- INFANTRY...

 </a>
</span></span>

I want to get the server name and the url to post in chat when someone types !bf4server. I want the Name: {url} so they an join me if they wish

Joined: Mar 2015
Posts: 19
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Mar 2015
Posts: 19
I was trying something like this but idk.. Im so lost.

Code:
on *:TEXT:!stats*:#: { 
  msg $chan test
  if ($sock(FAFstats)) .sockclose FAFstats
  set %FAFSearchfaction $+(*,class="common-playing-link",*)
  set %FAFSearchunit $+(*,>,$3-,</span>,*)  
  set %searchchan $chan
  sockopen FAFstats battlelog.battlefield.com 80
}

on *:SOCKOPEN:FAFstats: {
  msg %searchchan test2

  sockwrite -nt $sockname GET //bf4/user/HELLRAPTOR408/ HTTP/1.1
  sockwrite -nt $sockname Host: battlelog.battlefield.com
  sockwrite $sockname $crlf
}

on *:SOCKREAD:FAFstats: {
  if (!$sockerr) {
    var %sockreader
    sockread %sockreader
    if (%FAFSearchfaction iswm %sockreader && %FAFSearchunit iswm %sockreader ) {
      msg %searchchan $gettok(%sockreader,24,34)
      write c:\users\wolf\desktop\socket.txt %sockreader
      unset %searchchan
      unset %FAFSearchfaction
      unset %FAFSearchtext
      sockclose FAFstats
    }
  }
}

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Is there an API for the info you want?


I am SReject
My Stuff
Joined: Mar 2015
Posts: 19
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Mar 2015
Posts: 19
not that I could find, that is why I was trying like this. I am trying to display the BF4 server name and a link to the live scoreboard for people to join me.

Joined: Mar 2015
Posts: 19
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Mar 2015
Posts: 19
This is the a similar page that I want to get the info from.. The only diff is that this is a friends page not mine.

http://battlelog.battlefield.com/bf4/user/Spongebizzle1992/

or of your on chrome put "view-source:" in front of the URL and CTRL+F search class="common-playing-link"


Link Copied to Clipboard