mirror of
https://github.com/HorlogeSkynet/CDNUpdates
synced 2025-02-26 16:00:45 +01:00
30 lines
956 B
Python
30 lines
956 B
Python
|
|
from urllib.parse import urlparse
|
|
|
|
from CDNUpdates.CDNContent import CDNContent, CDNPROVIDERS
|
|
|
|
|
|
class CheckForCDNProviders():
|
|
def __init__(self, view, cdnContentList, regionList):
|
|
self.view = view
|
|
self.cdnContentList = cdnContentList
|
|
self.regionList = regionList
|
|
|
|
"""
|
|
Simple method to filter out the regions containing a link not handled.
|
|
"""
|
|
for region in self.regionList:
|
|
# We parse the URL taken from that region...
|
|
parsedResult = urlparse(
|
|
self.view.substr(region)
|
|
)
|
|
|
|
# ... to check if it's a known CDN provider
|
|
if parsedResult.netloc in CDNPROVIDERS:
|
|
# If this matches, we store it and move on to the next element.
|
|
self.cdnContentList.append(CDNContent(region, parsedResult))
|
|
|
|
# If not, we'll just ignore this region in the future
|
|
else:
|
|
pass
|