Skip to content

Commit

Permalink
Scrape apenas lances da ultima rodada
Browse files Browse the repository at this point in the history
  • Loading branch information
ballomud committed Jun 10, 2015
1 parent 69fd172 commit 45719d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions Scrapers/Lances.py
Expand Up @@ -31,22 +31,20 @@
from LancesScrapers import Cartoes
from LancesScrapers import Gols

def ScrapeLances(USER_AGENT):
def ScrapeLances(Rodada, USER_AGENT):

# Consts
PARTIDAS_RODADA_URL = 'http://globoesporte.globo.com/servico/esportes_campeonato/responsivo/widget-uuid/09021843-e53d-4020-80f7-302a15756585/fases/fase-unica-brasileiro-2015/rodada/{0}/jogos.html'
LANCES_URL = 'mensagens.json'
TOTAL_RODADA = 38


# Fetch links das Partidas

print '[LOG] Obtendo os links dos Lances'

PartidasRodadaLinks = [PARTIDAS_RODADA_URL.format(i) for i in range(1, TOTAL_RODADA + 1)]
PartidasRodadaLinksData = [scraperwiki.scrape(u, user_agent=USER_AGENT) for u in PartidasRodadaLinks]
PartidasLinks = [html.fromstring(d).xpath('//a/@href') for d in PartidasRodadaLinksData]
PartidasLinks = list(it.chain.from_iterable(PartidasLinks))
PartidasRodadaLink = PARTIDAS_RODADA_URL.format(Rodada)
PartidasRodadaLinkData = scraperwiki.scrape(PartidasRodadaLink, user_agent=USER_AGENT)
PartidasLinks = html.fromstring(PartidasRodadaLinkData).xpath('//a/@href')

print '[LOG] Links das Lances obtidos'

Expand Down
2 changes: 1 addition & 1 deletion scraper.py
Expand Up @@ -65,4 +65,4 @@ def FetchUltimaRodadaDosScouts():
Partidas.ScrapePartidas(PartidasID, USER_AGENT)

# Scrape Lances
Lances.ScrapeLances(USER_AGENT)
Lances.ScrapeLances(ultimaRodada, USER_AGENT)

0 comments on commit 45719d9

Please sign in to comment.