niveK77pur / gogoanime

Simple terminal downloader for Gogoanime episodes (entire seasons)
2 stars 1 forks source link

implement workaround for wrongly constructed gogo episode links #5

Closed niveK77pur closed 2 years ago

niveK77pur commented 2 years ago

It is not possible to extract the link form the first episode button, because the button is only generated once the page is rendered by the browser. Therefore it was put together using the category link. As far as possible we should avoid relying on selenium as it's quite slow; the ideal situation is that we can eventually remove selenium from the code again.

The implemented workaround here is to simply try variations of the link. If a 404 page is encountered, the current strategy is to convert anything of the form 2nd-season, 6th-season or 23rd-season into it's corresponding season-x version. This perfectly addresses the example from issue #4.

The workaround may seem like overkill but I tried to make it such that we can easily add new variations, by adding and elif statement before the else which would raise the error in case none of the attempts can be performed.