File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33from datetime import datetime
44from dataclasses import dataclass
5- from robobrowser import RoboBrowser
5+ import requests
6+ from bs4 import BeautifulSoup
67
78@dataclass
89class Concierto :
@@ -26,13 +27,13 @@ def parse(evento):
2627 return None
2728
2829def fetch_conciertos ():
29- browser = RoboBrowser ( parser = "html.parser" )
30-
31- browser . open ( "https://www.songkick.com/venues/4514007-estadio-river-plate/calendar " )
30+ headers = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)' }
31+ res = requests . get ( "https://www.songkick.com/venues/4514007-estadio-river-plate/calendar" , headers = headers )
32+ soup = BeautifulSoup ( res . text , "html.parser " )
3233
3334 conciertos = []
3435
35- for el in browser .select (".microformat" ):
36+ for el in soup .select (".microformat" ):
3637 concierto = Concierto .parse (el )
3738 if concierto :
3839 conciertos .append (concierto )
Original file line number Diff line number Diff line change @@ -2,9 +2,7 @@ icalevents
22pytz
33requests
44python-telegram-bot [webhooks ]== 22.0
5- robobrowser == 0.5.3
6- Werkzeug == 0.15.5
7- MarkupSafe == 2.0.1
5+ beautifulsoup4
86psycopg2-binary
97SQLAlchemy
108sqlalchemy-cockroachdb
Original file line number Diff line number Diff line change 11from datetime import datetime
22from dataclasses import dataclass
3- from robobrowser import RoboBrowser
3+ import requests
4+ from bs4 import BeautifulSoup
45
56RIVER = "River Plate"
67UNSPECIFIED_TIMES = {"A confirmar" , "" }
@@ -50,13 +51,17 @@ def parse(el):
5051 )
5152
5253def fetch_partidos ():
53- browser = RoboBrowser (parser = "html.parser" )
54- browser .open ("https://www.cariverplate.com.ar/calendario-de-partidos" )
54+ headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)' }
55+ res = requests .get ("https://www.cariverplate.com.ar/calendario-de-partidos" , headers = headers )
56+ soup = BeautifulSoup (res .text , "html.parser" )
5557
5658 partidos = []
5759
58- for el in browser .select (".d_calendario" ):
59- partidos .append (Partido .parse (el ))
60+ for el in soup .select (".d_calendario" ):
61+ try :
62+ partidos .append (Partido .parse (el ))
63+ except ValueError :
64+ pass
6065
6166 return partidos
6267
You can’t perform that action at this time.
0 commit comments