update redditdownload.py

This commit is contained in:
leca 2024-09-06 19:30:13 +03:00
parent 4ecaf1aa28
commit cb78a5d31f
1 changed files with 5 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import requests
import json
import os
import readme
import re
debug = False
@ -47,9 +47,10 @@ def get_galleries_in_page(page_content):
def get_single_images_in_page(page_content):
images_url = []
images_html = re.findall(r"(\<a href\=\".*\" class=\"post_media_image short\"\ >)", page_content)
images_html = re.findall(r"(\<a href\=\".*\" class=\"post_media_image short\"\s*\>)", page_content)
for image_html in images_html:
found = re.search(r"(\/img\/\w+\.((png)|(jpg)|(jpeg)|(mp3)|(flac)|(ogg)))", image_html).group()
print(image_html)
found = re.search(r"((\/img\/\w+\.((png)|(jpg)|(jpeg)|(mp3)|(flac)|(ogg))))|(\/preview\/external\-pre\/[\w\d\-\_]+.(png|jpg|jpeg|webp|svg|avif)\?auto\=(png|jpg|jpeg|webp|svg|avif)\&amp\;s\=\w+)", image_html).group().replace("amp;", "")
images_url.append(found)
return images_url