-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from michabirklbauer/develop
v1.1.3
- Loading branch information
Showing
8 changed files
with
143 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build the Docker image | ||
run: | | ||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username michabirklbauer --password-stdin | ||
docker build . --file Dockerfile --tag michabirklbauer/vscodownloader:latest | ||
docker push michabirklbauer/vscodownloader:latest | ||
GIT_SHA="$(git rev-parse --short HEAD)" | ||
docker tag michabirklbauer/vscodownloader:latest michabirklbauer/vscodownloader:$GIT_SHA | ||
docker push michabirklbauer/vscodownloader:$GIT_SHA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[theme] | ||
base="light" | ||
[server] | ||
maxUploadSize=2048 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Dockerfile with VSCO Downloader GUI | ||
# author: Micha Birklbauer | ||
# version: 1.0.0 | ||
|
||
FROM python:3.12.0 | ||
|
||
LABEL maintainer="[email protected]" | ||
|
||
RUN mkdir app | ||
RUN mkdir app/.streamlit | ||
RUN mkdir app/.streamlit/ico | ||
COPY requirements.txt app | ||
COPY vsco_downloader.py app | ||
COPY streamlit_app.py app | ||
COPY .streamlit/config.toml app/.streamlit | ||
COPY .streamlit/ico/download-icon.png app/.streamlit/ico | ||
WORKDIR app | ||
RUN pip install -r requirements.txt | ||
|
||
CMD ["streamlit", "run", "streamlit_app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
streamlit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# VSCO Downloader GUI | ||
# 2024 (c) Micha Johannes Birklbauer | ||
# https://github.com/michabirklbauer/ | ||
# [email protected] | ||
|
||
""" | ||
##################################################### | ||
## ## | ||
## -- STREAMLIT MAIN APP -- ## | ||
## ## | ||
##################################################### | ||
""" | ||
|
||
import streamlit as st | ||
from vsco_downloader import download as d | ||
|
||
# main page content | ||
def main_page(): | ||
|
||
title = st.title("VSCO Downloader") | ||
|
||
general_description = \ | ||
""" | ||
VSCO Downloader is a simple script to extract raw image and video paths from [VSCO](https://www.vsco.co/) posts. | ||
""" | ||
description = st.markdown(general_description) | ||
|
||
header_1 = st.subheader("Extract Post Media", divider = "rainbow") | ||
|
||
url = st.text_input("VSCO Post URL:", | ||
placeholder = "https://vsco.co/emilieristevski/media/561f648001146426743090fa", | ||
help = "URL of the VSCO post from which media should be extracted.") | ||
|
||
l1, l2, center_button, r1, r2 = st.columns(5) | ||
|
||
with center_button: | ||
download = st.button("Download!", type = "primary", use_container_width = True) | ||
|
||
if download: | ||
media_urls = d(url, True, False) | ||
header_2 = st.subheader("Extracted Post Media", divider = "rainbow") | ||
display_media_urls = st.markdown("\n".join([f"- Found media url: [{media_url}]({media_url})" for media_url in media_urls])) | ||
|
||
# side bar and main page loader | ||
def main(): | ||
|
||
about_str = \ | ||
""" | ||
VSCO Downloader is a simple script to extract raw image and video paths from [VSCO](https://www.vsco.co/) posts. | ||
""" | ||
|
||
st.set_page_config(page_title = "VSCO Downloader", | ||
page_icon = ":camera:", | ||
layout = "wide", | ||
initial_sidebar_state = "expanded", | ||
menu_items = {"Get Help": "https://github.com/michabirklbauer/vsco_downloader/discussions", | ||
"Report a bug": "https://github.com/michabirklbauer/vsco_downloader/issues", | ||
"About": about_str} | ||
) | ||
|
||
title = st.sidebar.title("VSCO Downloader") | ||
|
||
div_1 = st.sidebar.subheader("", divider = "rainbow") | ||
|
||
logo = st.sidebar.image(".streamlit/ico/download-icon.png", | ||
caption = "VSCO Downloader is a simple script to extract raw image and video paths from VSCO posts.") | ||
|
||
#doc = st.sidebar.markdown(about_str) | ||
|
||
div_2 = st.sidebar.subheader("", divider = "rainbow") | ||
|
||
info_str = "" | ||
info_str += "- **Contact:** \n [[email protected]](mailto:[email protected])\n" | ||
info_str += "- **License:** \n [MIT License](https://github.com/michabirklbauer/vsco_downloader/blob/master/LICENSE.md)\n" | ||
info_str += "- **Project Page:** \n [GitHub](https://github.com/michabirklbauer/vsco_downloader/)" | ||
info = st.sidebar.markdown(info_str) | ||
|
||
main_page() | ||
|
||
if __name__ == "__main__": | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
# https://github.com/michabirklbauer/ | ||
# [email protected] | ||
|
||
version = "1.0.2" | ||
version = "1.0.3" | ||
date = "20221230" | ||
|
||
import urllib.request as ur | ||
|
@@ -15,7 +15,7 @@ | |
import os | ||
import re | ||
|
||
def download(vsco_media_url, get_video_thumbnails = True): | ||
def download(vsco_media_url, get_video_thumbnails = True, save = True): | ||
|
||
request_header = { "User-Agent" : "Mozilla/5.0 (Windows NT 6.1; Win64; x64)" } | ||
request = ur.Request(vsco_media_url, headers = request_header) | ||
|
@@ -34,6 +34,10 @@ def download(vsco_media_url, get_video_thumbnails = True): | |
tb.print_exc() | ||
return 1 | ||
|
||
opener = ur.build_opener() | ||
opener.addheaders = [("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64)")] | ||
ur.install_opener(opener) | ||
|
||
media_urls = [] | ||
try: | ||
medias = json_data["medias"]["byId"] | ||
|
@@ -42,12 +46,14 @@ def download(vsco_media_url, get_video_thumbnails = True): | |
if not bool(info["isVideo"]) or get_video_thumbnails: | ||
media_url = "https://" + str(info["responsiveUrl"].encode().decode("unicode-escape")) | ||
media_name = str(media) + ".jpg" | ||
ur.urlretrieve(media_url, media_name) | ||
if save: | ||
ur.urlretrieve(media_url, media_name) | ||
media_urls.append(media_url) | ||
if bool(info["isVideo"]): | ||
media_url = "https://" + str(info["videoUrl"].encode().decode("unicode-escape")) | ||
media_name = str(media) + ".mp4" | ||
ur.urlretrieve(media_url, media_name) | ||
if save: | ||
ur.urlretrieve(media_url, media_name) | ||
media_urls.append(media_url) | ||
except Exception as e: | ||
print("ERROR: Failed to extract image/video location!") | ||
|