<commit_before>from __future__ import unicode_literals, division, absolute_import
from builtins import *  # pylint: disable=unused-import, redefined-builtin

import logging

from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.soup import get_soup

from datetime import date, timedelta

import unicodedata
import requests
import re

log = logging.getLogger('search_npo')
fragment_regex = re.compile('[A-Z][^/]+/')
date_regex = re.compile('([1-3]?[0-9]) ([a-z]{3}) ([0-9]{4})')
days_ago_regex = re.compile('([0-9]+) dagen geleden')
months = ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']


class NPOWatchlist(object):
    """
        Produces entries for every episode on the user's npo.nl watchlist (Dutch public television).
        Entries can be downloaded using https://bitbucket.org/Carpetsmoker/download-npo

        If 'remove_accepted' is set to 'yes', the plugin will delete accepted entries from the watchlist after download
            is complete.
        If 'max_episode_age_days' is set (and not 0), entries will only be generated for episodes broadcast in the last x days.
            This only applies to episodes related to series the user is following.

        For example:
            npo_watchlist:
              email: <EMAIL>
              password: <PASSWORD>
              remove_accepted: yes
              max_episode_age_days: 7
            accept_all: yes
            exec:
              fail_entries: yes
              auto_escape: yes
              on_output:
                for_accepted:<commit_msg>Update link to download-npo site<commit_after>from __future__ import unicode_literals, division, absolute_import
from builtins import *  # pylint: disable=unused-import, redefined-builtin

import logging

from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.soup import get_soup

from datetime import date, timedelta

import unicodedata
import requests
import re

log = logging.getLogger('search_npo')
fragment_regex = re.compile('[A-Z][^/]+/')
date_regex = re.compile('([1-3]?[0-9]) ([a-z]{3}) ([0-9]{4})')
days_ago_regex = re.compile('([0-9]+) dagen geleden')
months = ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']


class NPOWatchlist(object):
    """
        Produces entries for every episode on the user's npo.nl watchlist (Dutch public television).
        Entries can be downloaded using http://arp242.net/code/download-npo

        If 'remove_accepted' is set to 'yes', the plugin will delete accepted entries from the watchlist after download
            is complete.
        If 'max_episode_age_days' is set (and not 0), entries will only be generated for episodes broadcast in the last x days.
            This only applies to episodes related to series the user is following.

        For example:
            npo_watchlist:
              email: <EMAIL>
              password: <PASSWORD>
              remove_accepted: yes
              max_episode_age_days: 7
            accept_all: yes
            exec:
              fail_entries: yes
              auto_escape: yes
              on_output:
                for_accepted:
{'fraction_non_alphanumeric': 0.10088929776142287, 'fraction_numerical': 0.00827966881324747, 'mean_word_length': 2.8376470588235296, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5145342', 'n_tokens_mistral': 984, 'n_tokens_neox': 947, 'n_words': 319}