MCPcopy
hub / github.com/madhavanmalolan/awesome-reactnative-ui / getImage

Function getImage

extractor.py:32–44  ·  view source on GitHub ↗
(repo)

Source from the content-addressed store, hash-verified

30 return 1
31
32def getImage(repo):
33 base = "https://raw.githubusercontent.com/"+repo+ "/master/"
34 md = curl(base+"README.md")
35 images1 = re.findall("\!\[.*?\]\((.*?)\)",str(md))
36 images2 = re.findall("<img.*?src=[\'\"](.*?)[\&#x27;\"]",str(md))
37 images = images1+images2
38 images = sorted(images, key=lambda image : getRank(image), reverse=True)
39 if len(images) == 0:
40 return ''
41 image = images[0]
42 finalImage = image if image.startswith("http://") or image.startswith("https://") else base+image
43 print(repo +" : "+finalImage)
44 return finalImage
45
46
47

Callers 1

getRepoInfoFunction · 0.85

Calls 2

curlFunction · 0.85
getRankFunction · 0.85

Tested by

no test coverage detected