root-phantasoft / empleadoEstatalBot

A reddit bot that fetches the text of link posts and posts it as a comment.
0 stars 0 forks source link

Handle relative URLs #1

Open root-phantasoft opened 7 years ago

root-phantasoft commented 7 years ago

The bot should handle relative URLs properly, adding the posts's relevant path of the URL in front.

Reported by /u/Shark1221

root-phantasoft commented 7 years ago

Example in: https://www.motorsport.com/motogp/news/aprilia-beating-ktm-anomaly-albesiano-952971/

andreskrey commented 7 years ago

Ejem, perdon por meterme, super insportable pero eso sucede acá: https://github.com/andreskrey/readability.php/blob/master/src/HTMLParser.php#L348

:D

root-phantasoft commented 7 years ago

Hey! No, no molesta en absoluto! Por el contrario, se agradece el input.

Ok, esta el codigo entonces ... por algun motivo fallo en esa URL que te pegue, con este HTML:

<a href="/motogp/news/aprilia-must-give-everything-or-quit-motogp-espargaro-949829" target="_blank">Aleix Espargaro urged his team to "give everything" to bolster its position in 2018 or consider quitting MotoGP</a>

Lo convirtio en esto:

[Aleix Espargaro urged his team to "give everything" to bolster its position in 2018 or consider quitting MotoGP](/motogp/news/aprilia-must-give-everything-or-quit-motogp-espargaro-949829),

Sigue relativa. El finde cuando tenga un rato lo debugeo, y despues te cuento.

Gracias!

andreskrey commented 7 years ago

Si exacto, ya lo veia viendo en /r/arg, hay algo mal en el parser eso que con algunas url las deja como estan.

Avisame y vemos!