StreaMonitor icon indicating copy to clipboard operation
StreaMonitor copied to clipboard

Adding stream containing special characters

Open awerskto opened this issue 1 year ago • 7 comments

How can I add a stream that contains special characters in its nickname like: #! I get the message: Nonexistent user

Regards

awerskto avatar Feb 06 '24 19:02 awerskto

Normally this should be possible with quoting or escaping:

python3 Controller.py add "usernmae#!"

or

python3 Ctonroller.py add username\#\!

DerBunteBall avatar Feb 06 '24 19:02 DerBunteBall

Can see login in status but nothing downloads stream

2024-02-06 20:10:08,692 - INFO - manager_zmq: [ZMQ] add -costa-rica-#! bc 2024-02-06 20:10:09,899 - INFO - [BC] -costa-rica-#!: Nonexistent user

| -costa-rica-#! | BongaCams | False | Nonexistent user |

awerskto avatar Feb 06 '24 19:02 awerskto

Please try this as the username:

-costa-rica-%23%21

I guess the problem is line 22 in the bongacams.py file. Here a URL-encoded string is concatinated. But the part which is added with concatination isn't URL encoded. I guess the requests module doesn't sanitize this and so the request gets wrong.

This might lead to other problems. So this is a really dirty fix. Otherwhise patch the bongcams.py file by simply use urllib to encode the string before.

DerBunteBall avatar Feb 06 '24 19:02 DerBunteBall

This is a rather bigger problem

--- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.10/logging/init.py", line 1100, in emit msg = self.format(record) File "/usr/lib/python3.10/logging/init.py", line 943, in format return fmt.format(record) File "/usr/lib/python3.10/logging/init.py", line 681, in format s = self.formatMessage(record) File "/usr/lib/python3.10/logging/init.py", line 650, in formatMessage return self._style.format(record) File "/usr/lib/python3.10/logging/init.py", line 440, in format return self._format(record) File "/usr/lib/python3.10/logging/init.py", line 436, in _format return self._fmt % values TypeError: not enough arguments for format string Call stack: File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap self._bootstrap_inner() File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/home/m2/StreaMonitor/streamonitor/bot.py", line 126, in run self.log(self.status()) File "/home/m2/StreaMonitor/streamonitor/bot.py", line 92, in log self.logger.info(message) Message: 'Nonexistent user' Arguments: ()

awerskto avatar Feb 06 '24 19:02 awerskto

Yes.....

That's because the logging explodes because of the % sign. That's related to string formatting which is a chaos in the code. Just cleanup your config.json and start the Downlaoder again.

It seems that they don't url encode this here. I thought they do this because they URL encode much really dirty stuff. But it seems they just cut away stuff. Also possible that the account got renamed or so I don't know.

So you should be able to add this model with:

add -Costa-rica- BC

When you check the request which gets send on the model page it uses this.

It seems they simply throw away the #! and always cast up a few characters. I guess -costa-rica- in the add command would also work. I guess there is a JavaScript function which does this. So to sanitize stuff like this the behaviour of this function would be needed to reproduced in the StreaMonitor code.

DerBunteBall avatar Feb 06 '24 20:02 DerBunteBall

As a hint (I saw this as I closed all my test tabs):

It seems that the real username which will always work is shown in the tab title. So in case of bongacams don't use the string behind the / in the URL instead use the username of the tab (which is in the

tag of the HTML).

DerBunteBall avatar Feb 06 '24 20:02 DerBunteBall

Thank you very much for your help!

awerskto avatar Feb 06 '24 21:02 awerskto