coleifer / micawber

a small library for extracting rich content from urls
http://micawber.readthedocs.org/
MIT License
632 stars 91 forks source link

Provider bootstrap_oembed broken #88

Closed danjac closed 5 years ago

danjac commented 5 years ago

The bootstrap_oembed provider appears to be broken. The following works fine with other providers (Python 3.7, micawber 0.4.0).

from micawber.providers import bootstrap_oembed
r = bootstrap_oembed()
result = r.provider_for_url("https://i.imgur.com/CZX7D64.jpg")
/usr/local/lib/python3.7/site-packages/micawber/providers.py in provider_for_url(self, url)
    136     def provider_for_url(self, url):
    137         for regex, provider in self:
--> 138             if re.match(regex, url):
    139                 return provider
    140 

/usr/local/lib/python3.7/re.py in match(pattern, string, flags)
    171     """Try to apply the pattern at the start of the string, returning
    172     a Match object, or None if no match was found."""
--> 173     return _compile(pattern, flags).match(string)
    174 
    175 def fullmatch(pattern, string, flags=0):

/usr/local/lib/python3.7/re.py in _compile(pattern, flags)
    284     if not sre_compile.isstring(pattern):
    285         raise TypeError("first argument must be string or compiled pattern")
--> 286     p = sre_compile.compile(pattern, flags)
    287     if not (flags & DEBUG):
    288         if len(_cache) >= _MAXCACHE:

/usr/local/lib/python3.7/sre_compile.py in compile(p, flags)
    762     if isstring(p):
    763         pattern = p
--> 764         p = sre_parse.parse(p, flags)
    765     else:
    766         pattern = None

/usr/local/lib/python3.7/sre_parse.py in parse(str, flags, pattern)
    928 
    929     try:
--> 930         p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
    931     except Verbose:
    932         # the VERBOSE flag was switched on inside the pattern.  to be

/usr/local/lib/python3.7/sre_parse.py in _parse_sub(source, state, verbose, nested)
    424     while True:
    425         itemsappend(_parse(source, state, verbose, nested + 1,
--> 426                            not nested and not items))
    427         if not sourcematch("|"):
    428             break

/usr/local/lib/python3.7/sre_parse.py in _parse(source, state, verbose, nested, first)
    652             if item[0][0] in _REPEATCODES:
    653                 raise source.error("multiple repeat",
--> 654                                    source.tell() - here + len(this))
    655             if item[0][0] is SUBPATTERN:
    656                 group, add_flags, del_flags, p = item[0][1]

error: multiple repeat at position 44
coleifer commented 5 years ago

0.4.1

danjac commented 5 years ago

Works great with 0.4.1, thank you.