timephy / bs.to-downloader

A tool to download entire seasons from bs.to
4 stars 1 forks source link

"default host" -- case sensitivity problem #1

Open tobi-the-fraggel opened 3 years ago

tobi-the-fraggel commented 3 years ago

Hi bro!

Problem Description

First of all, thx for this project. I was thinking of doing something similar...as usually...I found someone on github, who already "invented the wheel" :) Therefore, your work is appreciated by many people a lot. Believe me. 👍

Now, when using your program for the first time, I did run into a minor problem. At first I wanted to see if you code actually worked (I mean, last commit 13 months ago...) I guess you understand :) Anyhow, I picked a Sci-Fi series I adored back in the days and ran the prog with these parameters: --start 1 --end 1 --out humans https://bs.to/serie/Humans/1/de Vivo The output told me, that I didn't select an episode. Surprise, surprise, right?

Now, here's the important part → Stdout after running bs.to-downloader:

(...)
Available hosts: {'VidLox', 'VOE', 'SendFox', 'Vivo', 'Streamtape', 'Vupload'}
Currently the only supported host is 'vivo'
Selected host: 'vivo'
no episodes selected.

No episode selected? Weird. I am pretty sure command line parameters are correct. Well, turns out, they are. By the title of this issue, you may already guess, what the problem is. I didn't realize it at first though, so, I spooled up my favorite IDE and searched the moment your code exists.

__main__.py

supported_hosts = ["vivo"] # line 11

# lines 63 to 73
host_select = supported_hosts[0]  # args.host
print(f"Currently the only supported host is '{supported_hosts[0]}'")
print("Selected host:", pformat(host_select))

episodes_select = [ep for ep in s.episodes if host_select in ep.hosts] #HINT: can't find hosts, if case of characters in hostname doesn't match available hostnames
episodes_select = [ep for ep in episodes_select
                   if args.start <= ep.id <= args.end]

if not episodes_select:  # no episodes selected
    print("no episodes selected.")
    quit()

Résumé

I presume your intention was to add additional hosts in the future. However, currently the optional HOST argument is ignored, when you test the 'selected host' against available hosts. This test is case sensitive and at least currently vivo is Vivo ;)

Resulting error message is misleading. I did select episodes. It just couldn't find a matching video host. The error message should reflect this.

Suggestion(s)

  1. Easy route - make host check case insensitive in some way
  2. If there is a host issue, catch it and throw a corresponding error
  3. Allow HOST option argument given by users to override default host.

Easiest solution

In __main__.py line 11 replace 'vivo' with 'Vivo'

Thx for you attention and keep it up :)

PS: Removing the "copy URL" part would be a blast obviously, I am convinced there should be a possibility with selenium to automatically 'click' on host redirection and hereby grab the host URI.

tobi-the-fraggel commented 3 years ago

Hi timephy,

it seems like you are not active on github anymore. If this changes feel free to contact me. I've forked your repo to fix the above and another little problem with output file encoding on windows. I may also expand it's functionality but probably not now. If you get back to github just let me know. You can find me here: tobi's fork I'll happily delete my fork and let you continue on this project. Best regards, tobi

timephy commented 3 years ago

Hey, thank you for the detailed issue. 👍🏽 I will address it in the next week!

tobi-the-fraggel commented 3 years ago

Hey man. No problem and thx for having a look into it. No hurry though.

passeee commented 2 years ago

@tobi-the-fraggel @timephy Hey guys! I found your tool and it seems great. Unfortunately I have an issue:

py main.py --start 1 --end 20 --out "X:\Chicago Med" --flat http://bs.to/serie/Chicago-Med/5/de vivo args: Namespace(url='http://bs.to/serie/Chicago-Med/5/de', host='vivo', start=1, end=20, out='X:\Chicago Med', flat=True, dry=False, json=False, verbose=False) Traceback (most recent call last): File "X:\Python\bs.to2__main.py", line 51, in s = Season(args.url) File "X:\Python\bs.to2\objects.py", line 13, in init__ self.title = bs_to.get_series_title(html) File "E:\Programme\Things\Python\bs.to2\bs_to.py", line 8, in get_series_title return list(serie.h2.children)[0].strip() # evade season AttributeError: 'NoneType' object has no attribute 'h2'

I would be very pleased if you could help me with that, bc idk what todo or what im doing wrong.

tobi-the-fraggel commented 2 years ago

Hi @passeee, I'd recommend to open a new issue. Also, @timephy did write this program. I merely made this issue topic about that tiny little bug.

Unfortunately, even when opening a new issue, I don't think you'll get help soon as VIVO seems to have disappeared as a hosting provider. Therefore, this tool would need to be expanded/altered/updated to work with other or at least the next best hoster.

All the best to you! Good luck.