update redditdownload.py
This commit is contained in:
parent
4ecaf1aa28
commit
cb78a5d31f
|
@ -1,7 +1,7 @@
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import readme
|
import re
|
||||||
|
|
||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
|
@ -47,9 +47,10 @@ def get_galleries_in_page(page_content):
|
||||||
def get_single_images_in_page(page_content):
|
def get_single_images_in_page(page_content):
|
||||||
images_url = []
|
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:
|
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)\&\;s\=\w+)", image_html).group().replace("amp;", "")
|
||||||
images_url.append(found)
|
images_url.append(found)
|
||||||
return images_url
|
return images_url
|
||||||
|
|
||||||
|
@ -160,4 +161,4 @@ def main():
|
||||||
full_gallery_url = get_full_url(libreddit_instance, gallery_url)
|
full_gallery_url = get_full_url(libreddit_instance, gallery_url)
|
||||||
download_gallery_content(libreddit_instance, full_gallery_url, destination)
|
download_gallery_content(libreddit_instance, full_gallery_url, destination)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue