lossless1024 / StreaMonitor

Adult live stream downloader for advanced people. I could have chosen a better name.
GNU General Public License v3.0
172 stars 42 forks source link

Adding stream containing special characters #132

Closed awerskto closed 4 days ago

awerskto commented 4 months ago

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

Regards

DerBunteBall commented 4 months ago

Normally this should be possible with quoting or escaping:

python3 Controller.py add "usernmae#!"

or

python3 Ctonroller.py add username\#\!
awerskto commented 4 months ago

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 |

DerBunteBall commented 4 months ago

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.

awerskto commented 4 months ago

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: ()

DerBunteBall commented 4 months ago

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 commented 4 months ago

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).</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/awerskto"><img src="https://avatars.githubusercontent.com/u/69040722?v=4" />awerskto</a> commented <strong> 4 months ago</strong> </div> <div class="markdown-body"> <p>Thank you very much for your help! </p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>