Skip to content

Commit a236e77

Browse files
committed
rem
1 parent 06306c7 commit a236e77

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

examples/test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ async def on_progress(self, binaries: bytes):
1818
print(f'Download: %s ' % ((int(self.clength/self.length * 100)).__str__() + '%'), end='\r')
1919
async def on_finish(self, client: httpx.AsyncClient, response: httpx.Response):
2020
self.io.seek(0)
21+
2122
async def main(url):
2223
vid = await Fb().from_url(url)
2324
print(vid)
2425
dd = Download(await vid[1].get_size())
2526
await vid[1].download(dd)
2627
open('video.mp4','wb').write(dd.io.getvalue())
28+
2729
asyncio.run(main(url)) #type: ignore

snapsave/snapsave.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
def translate(text: str) -> bool:
1414
return text.lower() in ['iya', 'yes']
1515

16-
1716
class Regex:
1817
URL_FILTER = re.compile(r'(https?://[\w+&=\.%\-_/?;]+)')
1918
ORIGIN_URL = re.compile(r'https?://[\w\.-]+/')
@@ -23,6 +22,7 @@ class Regex:
2322
FROM_SNAPAPP = re.compile(r'^https?://snapsave\.app')
2423
QUALITY = re.compile(r'"video-quality">(\d+|Audio|HD|SD)')
2524
DECODER_ARGS = re.compile(r'\(\".*?,.*?,.*?,.*?,.*?.*?\)')
25+
COVER = re.compile(r'<img src=[\\]?"([\w://\.\=&?-]+)')
2626

2727

2828
def sorted_video(videos: list[FacebookVideo]) -> list[FacebookVideo]:
@@ -157,6 +157,11 @@ def __repr__(self) -> str:
157157
return f'{self.quality.value}::render={self.render}' + ('::'+[
158158
'SD', 'HD'][self.is_hd] if self.is_hd or self.is_sd else '')
159159

160+
class Videos(list):
161+
def __init__(self, cover: str):
162+
super().__init__()
163+
self.cover = cover
164+
160165

161166
class Fb(AsyncClient):
162167

@@ -190,7 +195,7 @@ async def from_url(self, url: str) -> list[FacebookVideo]:
190195
return await self.extract_content(dec)
191196

192197
async def extract_content(self, src: str) -> list[FacebookVideo]:
193-
data = []
198+
data = Videos(Regex.COVER.findall(src)[0])
194199
n = Regex.TABLE.findall(src)[0].replace('\\"', '"')
195200
for url, res, render in zip(
196201
Regex.URL_FILTER.findall(n),

0 commit comments

Comments
 (0)