Beispiel #1
0
def get_media(url, options):
    if "http" not in url[:4]:
        url = "http://%s" % url

    if options.silent_semi:
        options.silent = True
    if options.verbose:
        log.debug("version: {0}".format(__version__))
    stream = service_handler(sites, options, url)
    if not stream:
        generic = Generic(options, url)
        url, stream = generic.get(sites)
    if not stream:
        if re.search(".f4m", url) or re.search(".m3u8", url) or re.search(
                ".mpd", url):
            stream = Raw(options, url)
        if not stream:
            log.error(
                "That site is not supported. Make a ticket or send a message")
            sys.exit(2)

    if is_py2:
        url = ensure_unicode(url)

    if options.all_episodes:
        get_all_episodes(stream, copy.copy(options), url)
    else:
        get_one_media(stream, copy.copy(options))
Beispiel #2
0
def get_media(url, options):
    if "http" not in url[:4]:
        url = "http://%s" % url

    if options.silent_semi:
        options.silent = True
    stream = service_handler(sites, options, url)
    if not stream:
        generic = Generic(options, url)
        url, stream = generic.get(sites)
    if not stream:
        if url.find(".f4m") > 0 or url.find(".m3u8") > 0:
            stream = Raw(options, url)
        if not stream:
            log.error(
                "That site is not supported. Make a ticket or send a message")
            sys.exit(2)

    if is_py2:
        url = ensure_unicode(url)

    if options.all_episodes:
        get_all_episodes(stream, options, url)
    else:
        get_one_media(stream, options)
Beispiel #3
0
def get_media(url, options, version="Unknown"):
    if "http" not in url[:4]:
        url = "http://%s" % url

    if options.get("verbose"):
        logging.debug("version: {0}".format(version))

    stream = service_handler(sites, options, url)
    if not stream:
        generic = Generic(options, url)
        url, stream = generic.get(sites)
    if not stream:
        if url.find(".f4m") > 0 or url.find(".m3u8") > 0 or url.find(".mpd") > 1:
            stream = Raw(options, url)
        if not stream:
            logging.error("That site is not supported. Make a ticket or send a message")
            sys.exit(2)

    if options.get("all_episodes") or stream.config.get("all_episodes"):
        get_all_episodes(stream, url)
    else:
        get_one_media(stream)
Beispiel #4
0
 def test_vimeo(self):
     config = setup_defaults()
     generic = Generic(config, "http://example.com")
     data = 'src="https://player.vimeo.com/video/359281775" '
     assert isinstance(generic._match(data, sites)[1], Service)
Beispiel #5
0
 def test_tv4(self):
     config = setup_defaults()
     generic = Generic(config, "http://example.com")
     data = "rc=https://www.tv4play.se/iframe/video/12499319 "
     assert isinstance(generic._match(data, sites)[1], Service)
Beispiel #6
0
 def test_hls(self):
     config = setup_defaults()
     generic = Generic(config, "http://example.com")
     data = 'source src="http://example.com/hls.m3u8" type="application/x-mpegURL"'
     assert isinstance(generic._match(data, sites)[1], Service)
Beispiel #7
0
 def test_nothing(self):
     config = setup_defaults()
     generic = Generic(config, "http://example.com")
     data = "hejsan"
     assert generic._match(data, sites) == ("http://example.com", None)