You are not logged in.
Pages: 1
I found this small script which parses livescore.com and shows the latest result from the games.
watch -n10 --no-title "w3m http://www.livescore.com/ |awk '/live [0-9H]+[^ ]/,/red cards/'" ;
The output looks like this:
2'
Tunisia
8 - 1
Djibouti
Africa Cup of Nations - Qualification:: group F
June 12
FT
Morocco
1 - 0
Libya
Africa Cup of Nations - Qualification:: group L
June 12
FT
Guinea
1 - 2
Swaziland
International - Friendly (Under 21)
June 12
FT
Austria U21
3 - 1
Bulgaria U21
World Cup Women - Group C
June 12
23:00
Switzerland
? - ?
Ecuador
June 13
02:00
Japan
? - ?
Cameroon
World Cup Women - Group D
June 12
live 13'
Australia
0 - 0
Nigeria
I would like the 3 lines after the line containg the word "live" "HT" or "FT" to be joined together. Is there an easy way to make it happen?
Thanks in advance
Offline
wouldn't a python script be better for this?
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
import time
url="http://www.livescore.com/soccer/";
r=requests.get(url);
data=r.text
soup=BeautifulSoup(data);
count=0;
pl1=""
pl2=""
score=""
line=""
for link in soup.find_all('div'):
if (link.get('class')==['row','row-tall','mt4']):
count=count+1;
if(link.get('class')==['ply','tright','name']):
pl1= ''.join(link.contents)
if(link.get('class')==['sco']):
for st in link.stripped_strings:
score=''.join(repr(st))
if(link.get('class')==['ply','name']):
pl2= ''.join(link.contents)
line=line +pl1+" : "+score+" : "+pl2+"\n";
if(count>1):
break;
print(line)
Output:
carnager@caprica ~/Downloads > python test2
Ireland : '1 - 0' : Scotland
Poland : '0 - 0' : Georgia
Gibraltar : '? - ?' : Germany
Last edited by Rasi (2015-06-13 17:07:51)
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
Pages: 1