Repository: Flexget/Flexget

Issue:
descargas 2020 broken (again)
### Expected behaviour:
it downloads torrent properly.

### Actual behaviour:

### Steps to reproduce:
add this rss http://feeds.feedburner.com/descargas2020new
flexget execute
you will get:
2019-04-28 23:00 WARNING  urlrewriter   series_sigo     URL rewriting descargas2020 failed: Unable to locate torrent ID from url http://descargas2020.com/descargar-torrent/121574_-1556477420-55-pasos--blurayrip/
2019-04-28 23:00 ERROR    entry         series_sigo     Failed 55 Pasos  [BluRay Rip][AC3 2.0 Castellano][2019][] (None)

#### Config:

```
tasks:
  series_sigo:
    rss:
      url: http://feeds.feedburner.com/descargas2020new
      link: link
    all_series: yes
    seen: local
    regexp:
      reject:
        - PCDVD
    accept_all: yes
    thetvdb_lookup: yes
    no_entries_ok: yes
    set:
      filename: "{{title|pathscrub}}.torrent"
    download: /home/flexget/torrent/
```
  
#### Log:


2019-04-28 23:00 WARNING  urlrewriter   series_sigo     URL rewriting descargas2020 failed: Unable to locate torrent ID from url http://descargas2020.com/descargar-torrent/121574_-1556477420-55-pasos--blurayrip/
2019-04-28 23:00 ERROR    entry         series_sigo     Failed 55 Pasos  [BluRay Rip][AC3 2.0 Castellano][2019][] (None)


```
paste log output here
```
</details>

### Additional information:

- FlexGet version: 2.20.23
- Python version: 2.7.13
- Installation method: i don't remember
- Using daemon (yes/no): no
- OS and version: debian 9 x64
- Link to crash log:

<!---
In config and debug/crash logs, remember to redact any personal or sensitive information such as passwords, API keys, private URLs and so on.

Please verify that the following data is present before submitting your issue:

- Link to a paste service or paste above the relevant config (preferably full config, including templates if present). Please make sure the paste does not expire, if possible.
- Link to a paste service or paste above debug-level logs of the relevant task/s (use `flexget -L debug execute --tasks <Task_name>`).
- FlexGet version (use `flexget -V` to get it).
- Full Python version, for example `2.7.11` (use `python -V` to get it). Note that FlexGet is not supported for use with Python v3.0, 3.1, 3.2 or 3.6.
- Installation method (pip, git install, etc).
- Whether or not you're running FlexGet as a daemon.
- OS and version.
- Attach crash log if one was generated, in addition to the debug-level log. It can be found in the directory with your config file.
--->



Discussion:
Hi,

Yes, me too.
But it seems it is not necessary the descargas2020 plugin anymore!!! The torrent is downloaded directly from the rss file.  Who can support us to change the yml?

Thank you in advance.

Hi,
a work around, replace:
https://github.com/Flexget/Flexget/blob/15e09295b51b525dbdf6902716cd36a2d5845aff/flexget/components/sites/sites/descargas2020.py#L49
with:
`return False`
(keep leading spaces on line 49)
In Debian Linux you will find this file in /usr/local/lib/python2.7/dist-packages/flexget.
Give me some time and I will publish a commit that will solve this the right way.
> Hi,
> 
> Yes, me too.
> But it seems it is not necessary the descargas2020 plugin anymore!!! The torrent is downloaded directly from the rss file. Who can support us to change the yml?
> 
> Thank you in advance.

In theory, inserting this on the task would had been enough:
`disable: descargas2020`
but I had tested it and is not working. disable plugin can not disable urlrewriters for now

Resolving patch:
diff --git a/flexget/components/sites/sites/descargas2020.py b/flexget/components/sites/sites/descargas2020.py
--- a/flexget/components/sites/sites/descargas2020.py
+++ b/flexget/components/sites/sites/descargas2020.py
@@ -22,7 +22,9 @@
 REWRITABLE_REGEX = re.compile(
     r'https?://(www.)?(descargas2020|tvsinpagar|tumejortorrent|torrentlocura|torrentrapid).com/'
 )
-
+NONREWRITABLE_REGEX = re.compile(
+    r'(.*/descargar-torrent/|.*\.torrent$)'
+)
 
 class UrlRewriteDescargas2020(object):
     """Descargas2020 urlrewriter and search."""
@@ -46,7 +48,7 @@ def session(self):
     # urlrewriter API
     def url_rewritable(self, task, entry):
         url = entry['url']
-        return not url.endswith('.torrent') and REWRITABLE_REGEX.match(url)
+        return REWRITABLE_REGEX.match(url) and not NONREWRITABLE_REGEX.match(url)
 
     # urlrewriter API
     def url_rewrite(self, task, entry):


Test patch: