Move providers to subliminal_patch

pull/292/head
e01 6 years ago
parent aafc55f3cb
commit 0bd2f2e68f

@ -94,9 +94,7 @@ provider_manager = RegistrableExtensionManager('subliminal.providers', [
'podnapisi = subliminal.providers.podnapisi:PodnapisiProvider', 'podnapisi = subliminal.providers.podnapisi:PodnapisiProvider',
'shooter = subliminal.providers.shooter:ShooterProvider', 'shooter = subliminal.providers.shooter:ShooterProvider',
'thesubdb = subliminal.providers.thesubdb:TheSubDBProvider', 'thesubdb = subliminal.providers.thesubdb:TheSubDBProvider',
'tvsubtitles = subliminal.providers.tvsubtitles:TVsubtitlesProvider', 'tvsubtitles = subliminal.providers.tvsubtitles:TVsubtitlesProvider'
'subsunacs = subliminal.providers.subsunacs:SubsUnacsProvider',
'subssabbz = subliminal.providers.subssabbz:SubsSabBzProvider'
]) ])
#: Refiner manager #: Refiner manager

@ -3,7 +3,7 @@ import logging
import re import re
import io import io
import os import os
from random import randint
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from zipfile import ZipFile, is_zipfile from zipfile import ZipFile, is_zipfile
from rarfile import RarFile, is_rarfile from rarfile import RarFile, is_rarfile
@ -18,6 +18,7 @@ from subliminal.subtitle import guess_matches
from subliminal.video import Episode, Movie from subliminal.video import Episode, Movie
from subliminal.subtitle import fix_line_ending from subliminal.subtitle import fix_line_ending
from subzero.language import Language from subzero.language import Language
from .utils import FIRST_THOUSAND_OR_SO_USER_AGENTS as AGENT_LIST
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -65,7 +66,7 @@ class SubsSabBzProvider(Provider):
def initialize(self): def initialize(self):
self.session = Session() self.session = Session()
self.session.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' self.session.headers['User-Agent'] = AGENT_LIST[randint(0, len(AGENT_LIST) - 1)]
self.session.headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" self.session.headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
self.session.headers["Accept-Language"] = "en-US,en;q=0.5" self.session.headers["Accept-Language"] = "en-US,en;q=0.5"
self.session.headers["Accept-Encoding"] = "gzip, deflate, br" self.session.headers["Accept-Encoding"] = "gzip, deflate, br"

@ -3,7 +3,7 @@ import logging
import re import re
import io import io
import os import os
from random import randint
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from zipfile import ZipFile, is_zipfile from zipfile import ZipFile, is_zipfile
from rarfile import RarFile, is_rarfile from rarfile import RarFile, is_rarfile
@ -18,6 +18,7 @@ from subliminal.subtitle import guess_matches
from subliminal.video import Episode, Movie from subliminal.video import Episode, Movie
from subliminal.subtitle import fix_line_ending from subliminal.subtitle import fix_line_ending
from subzero.language import Language from subzero.language import Language
from .utils import FIRST_THOUSAND_OR_SO_USER_AGENTS as AGENT_LIST
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -65,7 +66,7 @@ class SubsUnacsProvider(Provider):
def initialize(self): def initialize(self):
self.session = Session() self.session = Session()
self.session.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' self.session.headers['User-Agent'] = AGENT_LIST[randint(0, len(AGENT_LIST) - 1)]
self.session.headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" self.session.headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
self.session.headers["Accept-Language"] = "en-US,en;q=0.5" self.session.headers["Accept-Language"] = "en-US,en;q=0.5"
self.session.headers["Accept-Encoding"] = "gzip, deflate, br" self.session.headers["Accept-Encoding"] = "gzip, deflate, br"
Loading…
Cancel
Save