Incorrect, URL encoded download link for .torrent file

Issue #19 resolved
Former user created an issue

I'm trying to download torrents with YaRSS2, but YaRSS2 fails to download the torrent file. The download link looks like this https://something.com/rss_dl.php/id=###/key=### where id and key are query strings, however YaRSS2 url encodes the equal signs, which results a wrong url like this: https://something.com/rss_dl.php/id%3D###/key%3D###

Here is a log snippet with the problematic rss:

#!

[INFO    ] 21:54:02 logger:63 YaRSS2.torrent_handling:89: Downloading torrent: 'https://*****.com/rss_dl.php/id%3D1821213/key%3D83039a7******************93bced5' using cookies: {}
[INFO    ] 21:54:02 connectionpool:523 Starting new HTTPS connection (1): *****.com
[ERROR   ] 21:54:06 logger:71 YaRSS2.torrent_handling:66: Failed to download torrent url: 'https://*****.com/rss_dl.php/id%3D1821213/key%3D83039a7******************93bced5'. Exception: 
[INFO    ] 21:54:06 logger:63 YaRSS2.torrent_handling:146: Adding torrent: 'https://*****.com/rss_dl.php/id=1821213/key=83039a7******************93bced5' using cookies: ({},)
Unhandled error in Deferred:
Unhandled Error
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/yarss2/gtkui/dialog_subscription.py", line 294, in on_button_add_torrent_clicked

  File "build/bdist.linux-x86_64/egg/yarss2/gtkui/gtkui.py", line 159, in add_torrent

  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 306, in addCallback
    callbackKeywords=kw)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 295, in addCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 577, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "build/bdist.linux-x86_64/egg/yarss2/gtkui/dialog_subscription.py", line 280, in add_torrent_callback

  File "build/bdist.linux-x86_64/egg/yarss2/util/http.py", line 97, in clean_html_body

  File "build/bdist.linux-x86_64/egg/yarss2/include/bs4/__init__.py", line 169, in __init__

  File "build/bdist.linux-x86_64/egg/yarss2/include/bs4/builder/_lxml.py", line 68, in prepare_markup

  File "build/bdist.linux-x86_64/egg/yarss2/include/bs4/dammit.py", line 203, in __init__

  File "build/bdist.linux-x86_64/egg/yarss2/include/bs4/dammit.py", line 373, in _detectEncoding

exceptions.TypeError: expected string or buffer

The Message log also a bit misleading:

(2015-05-18T21:54:06): Failed to download torrent url: 'https://*****.com/rss_dl.php/id%3D1821213/key%3D83039a7******************93bced5'. Exception: 
(2015-05-18T21:54:06): Adding torrent: 'https://*****.com/rss_dl.php/id=1821213/key=83039a7******************93bced5' using cookies: ({},)

Comments (3)

  1. Bendik repo owner

    Hi

    I can't reproduce the issue with urls containing equal characters. When testing RSS with such download links the equal characters are not replaced with %3D so I wonder why that happens. However, any / after the .php is replaced with %2F.

    If you can provide a public link that causes this error it'll be easier to debug.

  2. Log in to comment