justfoolingaround / animdl

A highly efficient, fast, powerful and light-weight anime downloader and streamer for your favorite anime.
GNU General Public License v3.0
1.29k stars 106 forks source link

gogoanime provider - do not appent extra https: when iframe src url already includes it #269

Closed StevenC4 closed 1 year ago

StevenC4 commented 1 year ago

Overview

I recently encountered a bug that breaks the animdl grab and animdl download scripts for the gogoanime provider.

To reproduce this bug, run animdl grab "Megami no cafe" or animdl download "Megami no cafe".

The following is a screenshot of the output of animdl grab "Megami no cafe":

image

I pulled the repo, and in debugging the issue, I noticed that the get_embed_page function in the gogoanime provider is breaking the URL by adding an additional https: to the front of the URL it is grabbing from the iframe on the page.

Testing

Prior to the changes from this pull request, the get_embed_page function was returning a URL that looked like this:

https:https://gotaku1.com/streaming.php?id=MjAyMzgw&title=Megami+no+Caf%C3%A9+Terrace+Episode+1

After making the changes in this pull request, the get_embed_page function now returns the URL as follows:

https://gotaku1.com/streaming.php?id=MjAyMzgw&title=Megami+no+Caf%C3%A9+Terrace+Episode+1

After making the change, I tested the download and grab functions, and they work now.

Considerations

I noticed this bug recently (within the last two weeks). My assumption is that the there was a recent change to the format of the page that is being parsed. Presumably, before the bug started occurring, the URL parsed from the iframe was missing the https: from the front, but the https: is now being included.

I updated the code to conditionally add an https: to the front of the URL if it is missing. I opted for the conditional logic in case this was not a widespread change; I want to make sure this works with the old format and the new format in case there are still some pages that are missing the https: from the front of the URL.

Let me know if you have any concerns about this approach.

Zolax9 commented 1 year ago

can confirm the PR fixes the bug with gogoanime.

justfoolingaround commented 1 year ago

Nice catch, thank you!

StevenC4 commented 1 year ago

Alright, I have removed the startswith. My PR now simply modifies the existing code so we're not appending https: to the front. Is this what you were requesting?

justfoolingaround commented 1 year ago

Yep, this should be good.

StevenC4 commented 1 year ago

I didn't realize when I was writing up this PR - should I have bumped the patch version of the package like was done in this commit, or do you have a separate or automated process for that?

justfoolingaround commented 1 year ago

Don't worry about that, there are a few staged changes before bumping is all.