[add] Add url rewrite support for bt.hliang.com (#1630)
[add] Add url rewrite support for bt.hliang.com (#1630)

* Add url rewrite support for bt.hliang.com

bt.hliang.com provides asian tv show torrents.  However, it does not support rss feeds.  To auto download shows, use http plugin to download the homepage of bt.hliang.com, and this url rewrite plugin will do the following:

1.  Go through each entry url and follow the link to open the details page.
2.  In the details page, search for the actual torrent download url (any link that contains "down.php?[unique id]"
3. Return the url if found, or raise UrlRewriteError.

* Fix regex issue
Forgot to escape '.' and '?' for the "down.php?" regex pattern.

* Resolved pull request feedback.

1.  Wrapped requests.get() call inside try-except
2.  Changed plugin registration to specify "interfaces" instead of "groups"

Additional changes:
1.  Removed unused urllib2 import.
2.  Grouped import statements.

* Catch requests library exceptions separately.

When making request calls, catch request specific exceptions and log the error before raising UrlRewritingError.

For the soup library call, it is not immediately clear what Exception types are guaranteed to throw, therefore it is left unchanged.

* Fix logging call.

Change from log.exception to log.error as requested in the pull request.  Also fixed how the arguments are being passed, the message takes a format string and the arguments that follow are the values.  The previous implementation was incorrect.

* Store exception message in UrlRewritingError.

Instead of storing the actual exception, store exception message in UrlRewritingError. Printing the exception as a string shows the traceback, which for log files is a little verbose.  Showing the the exception message helps give more meaningful info.

* Use str(e) to display exception message.

Exception.message is deprecated, use str(e) as recommended in https://stackoverflow.com/questions/1272138/baseexception-message-deprecated-in-python-2-6 .

Flexget/Flexget,malkavi/Flexget,JorisDeRieck/Flexget,malkavi/Flexget,jawilson/Flexget,poulpito/Flexget,LynxyssCZ/Flexget,Flexget/Flexget,JorisDeRieck/Flexget,LynxyssCZ/Flexget,sean797/Flexget,sean797/Flexget,Danfocus/Flexget,crawln45/Flexget,ianstalk/Flexget,LynxyssCZ/Flexget,JorisDeRieck/Flexget,Danfocus/Flexget,Danfocus/Flexget,crawln45/Flexget,qk4l/Flexget,gazpachoking/Flexget,jawilson/Flexget,Danfocus/Flexget,tobinjt/Flexget,poulpito/Flexget,sean797/Flexget,gazpachoking/Flexget,qk4l/Flexget,ianstalk/Flexget,ianstalk/Flexget,Flexget/Flexget,OmgOhnoes/Flexget,crawln45/Flexget,malkavi/Flexget,jawilson/Flexget,OmgOhnoes/Flexget,poulpito/Flexget,qk4l/Flexget,jawilson/Flexget,crawln45/Flexget,OmgOhnoes/Flexget,LynxyssCZ/Flexget,Flexget/Flexget,JorisDeRieck/Flexget,tobinjt/Flexget,tobinjt/Flexget,malkavi/Flexget,tobinjt/Flexget