Skip to content

Add torrentz2#2296

Merged
gazpachoking merged 3 commits intoFlexget:developfrom
stephanerosi:master
Jan 14, 2019
Merged

Add torrentz2#2296
gazpachoking merged 3 commits intoFlexget:developfrom
stephanerosi:master

Conversation

@stephanerosi
Copy link
Copy Markdown
Contributor

Motivation for changes:

Read-add torrentz2 plugin (based on previous torrentz, but with new urls)

Detailed changes:

  • search plugin
  • urlrewrite plugin

Addressed issues:

  • Fixes # .

Implemented feature requests:

  • Feathub #XX.

Config usage if relevant (new plugin or updated schema):

paste_config_here

Log and/or tests output (preferably both):

paste output here

To Do:

  • Stuff..

@stephanerosi
Copy link
Copy Markdown
Contributor Author

Hello, I don't get why the plugin is considered a "task" too, and therefore throw errors on test. It should only be "search" and "urlrewrite".


@event('plugin.register')
def register_plugin():
plugin.register(Torrentz2, 'torrentz2', groups=['urlrewriter', 'search'], api_ver=2)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'groups' argument was deprecated, this should be replaced with 'interfaces'. (This will also clear up the problem with tests where it's being considered a task plugin.)

Change plugin name to torrentz (allow backward comptability with old config files)
@gazpachoking
Copy link
Copy Markdown
Member

I think maybe you forgot to add back the file after you renamed it to just torrentz, right now the PR is empty.

@stephanerosi
Copy link
Copy Markdown
Contributor Author

@gazpachoking
Oops, fixed, thanks!

@gazpachoking gazpachoking merged commit 611f1f0 into Flexget:develop Jan 14, 2019
@gazpachoking
Copy link
Copy Markdown
Member

Thanks!

Copy link
Copy Markdown
Contributor

@Daeymien Daeymien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3/4 domains are invalid
3/4 feeds are invalid
feed query format is incorrect

'any': 'feed_any',
'low': 'feed_low',
'good': 'feed',
'verified': 'feed_verified'
Copy link
Copy Markdown
Contributor

@Daeymien Daeymien Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only valid feed is 'feed'. 'feed_low','feed_any', 'feed_verified' do not exist


log = logging.getLogger('torrentz')

REGEXP = re.compile(r'https?://torrentz2\.(eu|me|ch|in)/(?P<hash>[a-f0-9]{40})')
Copy link
Copy Markdown
Contributor

@Daeymien Daeymien Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.me, .ch, .in are not valid domains for torrentz2

valid domains are .eu and .is

entries = set()
for search_string in entry.get('search_strings', [entry['title']]):
query = normalize_unicode(search_string + config.get('extra_terms', ''))
for domain in ['eu', 'me', 'ch', 'in']:
Copy link
Copy Markdown
Contributor

@Daeymien Daeymien Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.me, .ch, .in are not valid domains for torrentz2

valid domains are .eu and .is

query = normalize_unicode(search_string + config.get('extra_terms', ''))
for domain in ['eu', 'me', 'ch', 'in']:
# urllib.quote will crash if the unicode string has non ascii characters, so encode in utf-8 beforehand
url = 'http://torrentz2.%s/%s?q=%s' % (domain, feed, quote(query.encode('utf-8')))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

query in feed url takes form of 'f=' not 'q='

e.g. https://torrentz2.eu/feed?f={{ search_term }}

@gazpachoking
Copy link
Copy Markdown
Member

Thanks @Daeymien. Care to open up a PR by chance?

@Daeymien
Copy link
Copy Markdown
Contributor

@gazpachoking Done. #2301

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants