[GH-ISSUE #117] Add Lostfilm get error #84

Closed
opened 2026-10-13 19:47:42 +00:00 by bsakaguchi · 6 comments
Owner

Originally created by @andrewt82 on GitHub (Jul 15, 2016).
Original GitHub issue: https://github.com/werwolfby/monitorrent/issues/117

i sucsesfully install monitorrent on Dlink DNS 320L
configure tracker lostfilm.tv (add login and password)

But when i try add any Lostfilm url e.g. http://www.lostfilm.tv/browse.php?cat=283
2016-07-15 10 13 22
strip runs but add button becomes active

in console i get error:

root@Server:/ffp/var/monitorrent-1.0.1# python server.py
Server started on 0.0.0.0:6687
/ffp/lib/python2.7/site-packages/bs4/builder/_htmlparser.py:167: RuntimeWarning: Python's built-in HTMLParser cannot parse the given document. This is not a bug in Beautiful Soup. The best solution is to install an external parser (lxml or html5lib), and use Beautiful Soup with that parser. See http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser for help.
  "Python's built-in HTMLParser cannot parse the given document. This is not a bug in Beautiful Soup. The best solution is to install an external parser (lxml or html5lib), and use Beautiful Soup with that parser. See http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser for help."))
HTMLParseError()
Traceback (most recent call last):
  File "/ffp/lib/python2.7/site-packages/cherrypy/wsgiserver/__init__.py", line 1405, in communicate
    req.respond()
  File "/ffp/lib/python2.7/site-packages/cherrypy/wsgiserver/__init__.py", line 859, in respond
    self.server.gateway(self).respond()
  File "/ffp/lib/python2.7/site-packages/cherrypy/wsgiserver/__init__.py", line 2303, in respond
    response = self.req.server.wsgi_app(self.env, self.start_response)
  File "/ffp/lib/python2.7/site-packages/cherrypy/wsgiserver/__init__.py", line 2542, in __call__
    return app(environ, start_response)
  File "/ffp/lib/python2.7/site-packages/falcon/api.py", line 189, in __call__
    responder(req, resp, **params)
  File "/mnt/HD/HD_a2/ffp/var/monitorrent-1.0.1/monitorrent/rest/topics.py", line 40, in on_get
    title = self.tracker_manager.prepare_add_topic(url)
  File "/mnt/HD/HD_a2/ffp/var/monitorrent-1.0.1/monitorrent/plugin_managers.py", line 94, in prepare_add_topic
    parsed_url = tracker.prepare_add_topic(url)
  File "/mnt/HD/HD_a2/ffp/var/monitorrent-1.0.1/monitorrent/plugins/trackers/lostfilm.py", line 456, in prepare_add_topic
    parsed_url = self.tracker.parse_url(url)
  File "/mnt/HD/HD_a2/ffp/var/monitorrent-1.0.1/monitorrent/plugins/trackers/lostfilm.py", line 225, in parse_url
    soup = get_soup(r.text, 'html5lib' if sys.platform == 'win32' else None)
  File "/mnt/HD/HD_a2/ffp/var/monitorrent-1.0.1/monitorrent/utils/soup.py", line 12, in get_soup
    return BeautifulSoup(url, 'html.parser')
  File "/ffp/lib/python2.7/site-packages/bs4/__init__.py", line 215, in __init__
    self._feed()
  File "/ffp/lib/python2.7/site-packages/bs4/__init__.py", line 239, in _feed
    self.builder.feed(self.markup)
  File "/ffp/lib/python2.7/site-packages/bs4/builder/_htmlparser.py", line 168, in feed
    raise e
HTMLParseError: bad end tag: u"</scr'+'ipt>", at line 1707, column 137

in what could be the problem here?

Originally created by @andrewt82 on GitHub (Jul 15, 2016). Original GitHub issue: https://github.com/werwolfby/monitorrent/issues/117 i sucsesfully install monitorrent on Dlink DNS 320L configure tracker lostfilm.tv (add login and password) But when i try add any Lostfilm url e.g. http://www.lostfilm.tv/browse.php?cat=283 ![2016-07-15 10 13 22](https://cloud.githubusercontent.com/assets/15378087/16866491/e6c4e086-4a74-11e6-82d3-0465018600c9.png) strip runs but add button becomes active in console i get error: ``` root@Server:/ffp/var/monitorrent-1.0.1# python server.py Server started on 0.0.0.0:6687 /ffp/lib/python2.7/site-packages/bs4/builder/_htmlparser.py:167: RuntimeWarning: Python's built-in HTMLParser cannot parse the given document. This is not a bug in Beautiful Soup. The best solution is to install an external parser (lxml or html5lib), and use Beautiful Soup with that parser. See http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser for help. "Python's built-in HTMLParser cannot parse the given document. This is not a bug in Beautiful Soup. The best solution is to install an external parser (lxml or html5lib), and use Beautiful Soup with that parser. See http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser for help.")) HTMLParseError() Traceback (most recent call last): File "/ffp/lib/python2.7/site-packages/cherrypy/wsgiserver/__init__.py", line 1405, in communicate req.respond() File "/ffp/lib/python2.7/site-packages/cherrypy/wsgiserver/__init__.py", line 859, in respond self.server.gateway(self).respond() File "/ffp/lib/python2.7/site-packages/cherrypy/wsgiserver/__init__.py", line 2303, in respond response = self.req.server.wsgi_app(self.env, self.start_response) File "/ffp/lib/python2.7/site-packages/cherrypy/wsgiserver/__init__.py", line 2542, in __call__ return app(environ, start_response) File "/ffp/lib/python2.7/site-packages/falcon/api.py", line 189, in __call__ responder(req, resp, **params) File "/mnt/HD/HD_a2/ffp/var/monitorrent-1.0.1/monitorrent/rest/topics.py", line 40, in on_get title = self.tracker_manager.prepare_add_topic(url) File "/mnt/HD/HD_a2/ffp/var/monitorrent-1.0.1/monitorrent/plugin_managers.py", line 94, in prepare_add_topic parsed_url = tracker.prepare_add_topic(url) File "/mnt/HD/HD_a2/ffp/var/monitorrent-1.0.1/monitorrent/plugins/trackers/lostfilm.py", line 456, in prepare_add_topic parsed_url = self.tracker.parse_url(url) File "/mnt/HD/HD_a2/ffp/var/monitorrent-1.0.1/monitorrent/plugins/trackers/lostfilm.py", line 225, in parse_url soup = get_soup(r.text, 'html5lib' if sys.platform == 'win32' else None) File "/mnt/HD/HD_a2/ffp/var/monitorrent-1.0.1/monitorrent/utils/soup.py", line 12, in get_soup return BeautifulSoup(url, 'html.parser') File "/ffp/lib/python2.7/site-packages/bs4/__init__.py", line 215, in __init__ self._feed() File "/ffp/lib/python2.7/site-packages/bs4/__init__.py", line 239, in _feed self.builder.feed(self.markup) File "/ffp/lib/python2.7/site-packages/bs4/builder/_htmlparser.py", line 168, in feed raise e HTMLParseError: bad end tag: u"</scr'+'ipt>", at line 1707, column 137 ``` in what could be the problem here?
Author
Owner

@werwolfby commented on GitHub (Jul 15, 2016):

Could you please try to install lxml on your NAS?

<!-- gh-comment-id:232880763 --> @werwolfby commented on GitHub (Jul 15, 2016): Could you please try to install **lxml** on your NAS?
Author
Owner

@andrewt82 commented on GitHub (Jul 15, 2016):

with any versions of this list:
2016-07-15 10 35 48

I in turn set each version to restart the server but the error remains the same

<!-- gh-comment-id:232884007 --> @andrewt82 commented on GitHub (Jul 15, 2016): with any versions of this list: ![2016-07-15 10 35 48](https://cloud.githubusercontent.com/assets/15378087/16867018/0c46792a-4a78-11e6-98c7-60593ddc1a2b.png) I in turn set each version to restart the server but the error remains the same
Author
Owner

@werwolfby commented on GitHub (Jul 15, 2016):

Please try over pip:

pip install lxml
<!-- gh-comment-id:232884425 --> @werwolfby commented on GitHub (Jul 15, 2016): Please try over pip: ``` pip install lxml ```
Author
Owner

@werwolfby commented on GitHub (Jul 15, 2016):

If above doesn't help than you can try to install different html parser.
We tested everything only on Python 2.7.9+, and according to https://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser embedded python html parser is not very linient (prior to 2.7.3). You can try to upgrade to latest Python, or try to install some other html parsers. I suggest html5lib:

pip install html5lib

And then you could hardcode used parser, by editing /monitorrent/utils/soup.py:

You can replace it with next code:

from bs4 import BeautifulSoup
import sys


def get_soup(url, parser=None):
    parse = 'html5lib'
    if parser:
        return BeautifulSoup(url, parser)
    else:
        if 'lxml' in sys.modules:
            return BeautifulSoup(url, 'lxml')
        else:
            return BeautifulSoup(url, 'html.parser')

On line 6 we hardcode html5lib.

<!-- gh-comment-id:232886218 --> @werwolfby commented on GitHub (Jul 15, 2016): If above doesn't help than you can try to install different html parser. We tested everything only on Python 2.7.9+, and according to https://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser embedded python html parser is not very linient (prior to 2.7.3). You can try to upgrade to latest Python, or try to install some other html parsers. I suggest html5lib: ``` pip install html5lib ``` And then you could hardcode used parser, by editing `/monitorrent/utils/soup.py`: You can replace it with next code: ``` from bs4 import BeautifulSoup import sys def get_soup(url, parser=None): parse = 'html5lib' if parser: return BeautifulSoup(url, parser) else: if 'lxml' in sys.modules: return BeautifulSoup(url, 'lxml') else: return BeautifulSoup(url, 'html.parser') ``` On line 6 we hardcode html5lib.
Author
Owner

@andrewt82 commented on GitHub (Jul 16, 2016):

ok thank's for you help!
change file soup.py nothing has changed, i still got same error.

but i reinstall another version of python (2.7.9) error is missing!
monitorrent prefect work on my NAS, thanks!!!

<!-- gh-comment-id:233120630 --> @andrewt82 commented on GitHub (Jul 16, 2016): ok thank's for you help! change file soup.py nothing has changed, i still got same error. but i reinstall another version of python (2.7.9) error is missing! monitorrent prefect work on my NAS, thanks!!!
Author
Owner

@Neustradamus commented on GitHub (Jan 2, 2026):

@andrewt82: For information:

Note that D-Link DNS-320L and DNS-325 are supported in OpenWrt:

<!-- gh-comment-id:3706391108 --> @Neustradamus commented on GitHub (Jan 2, 2026): @andrewt82: For information: Note that D-Link DNS-320L and DNS-325 are supported in OpenWrt: - https://github.com/openwrt/openwrt/pull/17924 - https://github.com/openwrt/openwrt/pull/16803 - https://github.com/openwrt/openwrt/pull/15433
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
werwolfby/monitorrent#84
No description provided.