UltimaScraper icon indicating copy to clipboard operation
UltimaScraper copied to clipboard

text_length setting doesn't work correctly

Open naxolotl opened this issue 5 years ago • 4 comments

https://github.com/DIGITALCRIMINAL/OnlyFans/blob/00f3f3d190c0eace8177f0fca36387ca878e20aa/helpers/main_helper.py#L253 https://github.com/DIGITALCRIMINAL/OnlyFans/blob/00f3f3d190c0eace8177f0fca36387ca878e20aa/helpers/main_helper.py#L268-L274

maximum_length is initially set to the value of the text_length setting. I'm not sure what the goal was here, maybe to limit the entire absolute path? But text_length should only limit {text}, right? The way this is currently, this does not limit the length, but rather cuts a fixed bit off at the end with a negative slice if maximum_length = text_length is smaller then the absolute path.

If text_length should do what the readme says, then maximum_length should not be modified. If text_length should limit the complete filename, not just {text} the calculation should be more like this:

text_limit = max(0, text_length - len(path) + len('{text}'))
filtered_text = text[:text_limit]

Because path seems to be just the templated filename, not the complete path

naxolotl avatar Jan 03 '21 15:01 naxolotl

I am also having text length problems

I set it to 110 but it doesnt cut anything off at all - and I get all smilies and emojis and all kinds of chars into the text now - using 6.1.2

GreyBeardy avatar Jan 04 '21 16:01 GreyBeardy

I am also having text length problems

I set it to 110 but it doesnt cut anything off at all - and I get all smilies and emojis and all kinds of chars into the text now - using 6.1.2

Don't use text if you don't want emojis, omegalul

UltimaHoarder avatar Jan 05 '21 08:01 UltimaHoarder

lolz fine

GreyBeardy avatar Jan 05 '21 09:01 GreyBeardy

https://github.com/DIGITALCRIMINAL/OnlyFans/blob/00f3f3d190c0eace8177f0fca36387ca878e20aa/helpers/main_helper.py#L253

https://github.com/DIGITALCRIMINAL/OnlyFans/blob/00f3f3d190c0eace8177f0fca36387ca878e20aa/helpers/main_helper.py#L268-L274

maximum_length is initially set to the value of the text_length setting. I'm not sure what the goal was here, maybe to limit the entire absolute path? But text_length should only limit {text}, right? The way this is currently, this does not limit the length, but rather cuts a fixed bit off at the end with a negative slice if maximum_length = text_length is smaller then the absolute path.

If text_length should do what the readme says, then maximum_length should not be modified. If text_length should limit the complete filename, not just {text} the calculation should be more like this:

text_limit = max(0, text_length - len(path) + len('{text}'))
filtered_text = text[:text_limit]

Because path seems to be just the templated filename, not the complete path

Thanks for reporting this.

UltimaHoarder avatar Jan 06 '21 12:01 UltimaHoarder