""" Kodi urlresolver plugin Copyright (C) 2019 script.module.urlresolver This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . """ # Updates: # - 2019 05 12 # Old vidtodo.me vidotodo.com from urlparse import urlparse from lib import helpers from urlresolver.common import Net, RAND_UA from urlresolver.resolver import UrlResolver, ResolverError class VidToDoResolver(UrlResolver): name = 'Vidtodo' domains = ['vidtodoo.com', 'vidtodo.com'] pattern = '(?://|\.)((?:vidtodoo|vidtodo)\.(?:com))/(?:embed-)?([0-9a-zA-Z]+)' def __init__(self): self.net = Net() self.userAgent = RAND_UA self.net.set_user_agent(self.userAgent) self.desktopHeaders = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en-US,en;q=0.5', 'Upgrade-Insecure-Requests': '1', 'DNT': '1' } def get_media_url(self, host, media_id): web_url = self.get_url(host, media_id) r = self.net.http_GET(web_url, headers=self.desktopHeaders) sources = helpers.scrape_sources( r.content, generic_patterns=False, patterns=[ '''sources.*?\[['"](?P.*?)['"]''', '''sources.*?file:.*?['"](?P.*?)['"](?:.*?label.*?['"](?P