File tree Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -467,13 +467,7 @@ def get_about(self):
467467 if not data :
468468 return {"code" : 404 , "message" : "No data found" , "data" : None }
469469
470- data = {
471- "code" : 200 ,
472- "message" : "OK" ,
473- "data" : data ,
474- }
475-
476- return data
470+ return {"code" : 200 , "message" : "OK" , "data" : data }
477471
478472 def get_socials (self ):
479473 """Get social media links
@@ -483,4 +477,7 @@ def get_socials(self):
483477
484478 data = extract_data ("socials" )
485479
486- return data
480+ if not data :
481+ return {"code" : 404 , "message" : "No results found" , "data" : None }
482+
483+ return {"code" : 200 , "message" : "OK" , "data" : data }
Original file line number Diff line number Diff line change @@ -80,7 +80,24 @@ def get_data(self):
8080
8181class SocialsExtractor (Extractor ):
8282 def get_data (self ):
83- pass
83+ page_source = self .get_source (BASE_URL )
84+ main_script_url = self .get_script (page_source )
85+ main_script_source = self .get_source (f"{ BASE_URL } /{ main_script_url } " )
86+
87+ match = re .findall (
88+ r"(?:href:\")"
89+ + r"(https:\/\/|https:\/\/www.(.*?)\..*?\/.*?)"
90+ + r"(?:\",target:\"_blank\",rel:\"noreferrer noopener\",className:)"
91+ + r"(?:\"Footer-(?:icon|patreon)\")" ,
92+ main_script_source ,
93+ )
94+
95+ if not match :
96+ return None
97+
98+ data = [{"name" : social [1 ], "link" : social [0 ]} for social in match ]
99+
100+ return data
84101
85102
86103class ExtractorFactory (ABC ):
You can’t perform that action at this time.
0 commit comments