@@ -17,6 +17,29 @@ class Sources:
1717 instander : str = "https://raw.githubusercontent.com/the-dise/the-dise.github.io/master/instander/ota.json"
1818
1919
20+ class Gcam :
21+ headers : Dict [str , str ] = {
22+ "upgrade-insecure-requests" : "1" ,
23+ "accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" ,
24+ "sec-fetch-site" : "same-site" ,
25+ "sec-fetch-mode" : "navigate" ,
26+ "sec-fetch-user" : "?1" ,
27+ "sec-fetch-dest" : "document" ,
28+ "referer" : "https://www.celsoazevedo.com/" ,
29+ "accept-language" : "en-US,en;q=0.9" ,
30+ }
31+ regex : Pattern = re .compile (
32+ r"(?<=<a\shref=\")https://(?P<cdn>[\w-]+)\.celsoazevedo\.com/file/(?P<path>\w+/(?P<filename>[\w.-]+\.apk))(?=\">)"
33+ )
34+ cdns : Dict [str , str ] = {
35+ "1-dontsharethislink" : "7-dontsharethislink" ,
36+ "f" : "temp4-f" ,
37+ }
38+ best : Dict [str , str ] = {
39+ "begonia" : "https://www.celsoazevedo.com/files/android/google-camera/dev-wichaya/f/dl3/"
40+ }
41+
42+
2043class MiscDL :
2144 mixplorer_regex : Pattern
2245
@@ -91,3 +114,35 @@ async def niksgapps(self, varient: str = "basic") -> Optional[str]:
91114 r"<a href=\"(?P<link>\S+)\">direct\slink</a>" , text
92115 ):
93116 return match .group ("link" )
117+
118+ async def gcam (self , * args ) -> Optional [str ]:
119+ if not args :
120+ return
121+
122+ arg1 = args [0 ].strip ()
123+ if arg1 == "best" :
124+ gcam_link = Gcam .best .get (DEVICE .codename )
125+ elif arg1 .startswith ("https://" ):
126+ gcam_link = arg1
127+
128+ if not gcam_link :
129+ return
130+
131+ async with self .http .get (gcam_link ) as resp :
132+ assert resp .status == 200
133+ text = await resp .text ()
134+ if match := Gcam .regex .search (text ):
135+ cdn = match .group ("cdn" )
136+ if cdn in Gcam .cdns :
137+ return f"https://{ Gcam .cdns [cdn ]} .celsoazevedo.com/file/{ match .group ('path' )} "
138+
139+ async with self .http .get (
140+ match .group (0 ),
141+ allow_redirects = True ,
142+ headers = {
143+ "authority" : f"{ cdn } .celsoazevedo.com" ,
144+ "User-Agent" : self .ua ,
145+ ** Gcam .headers ,
146+ },
147+ ) as response :
148+ return response .url
0 commit comments